/* ============ 企业端四栏工作台 ============ */
.app {
  display: grid;
  grid-template-columns: 56px 300px minmax(0, 1fr) 348px;
  height: 100vh; overflow: hidden;
}

/* ---------- 左侧导航轨 ---------- */
.rail { background: #0F172A; display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 4px; }
.rail .logo { width: 32px; height: 32px; border-radius: 9px; margin-bottom: 14px;
  background: linear-gradient(135deg, #2563EB, #0E7490); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.rail-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; color: #64748B;
  display: flex; align-items: center; justify-content: center; transition: all .15s ease; }
.rail-btn:hover { color: #E2E8F0; background: rgba(255,255,255,.06); }
.rail-btn.on { color: #fff; background: rgba(59,130,246,.22); }
.rail-btn.on::before { content: ''; position: absolute; left: -9px; top: 9px; bottom: 9px; width: 2.5px; border-radius: 2px; background: #60A5FA; }
.rail-btn .dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: #F87171; border: 2px solid #0F172A; }
.rail .spacer { flex: 1; }
.rail .me { width: 30px; height: 30px; border-radius: 50%; background: #4F46E5; color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; border: 2px solid #1E293B; }

/* ---------- 频道列表 ---------- */
.list { background: var(--panel-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 16px 16px 12px; }
.list-head h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.search { margin-top: 12px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink-3); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.filters { display: flex; gap: 6px; padding: 10px 16px 6px; }
.filter { height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; color: var(--ink-2);
  display: inline-flex; align-items: center; border: 1px solid transparent; }
.filter:hover { background: var(--slate-soft); }
.filter.on { background: var(--ink); color: #fff; }

.channels { flex: 1; overflow-y: auto; padding: 4px 10px 14px; }
.ch { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-md); cursor: pointer; align-items: flex-start; transition: background .12s ease; }
.ch:hover { background: var(--slate-soft); }
.ch.on { background: var(--panel); box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 9px; }
.ch .avatar { margin-top: 2px; }
.ch-main { flex: 1; min-width: 0; }
.ch-top { display: flex; align-items: center; gap: 6px; }
.ch-top b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-top .presence { margin-left: auto; display: flex; }
.presence i { width: 6px; height: 6px; border-radius: 50%; background: #10B981; margin-left: -2px; border: 1.5px solid var(--panel-2); }
.ch-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ch-badge { margin-top: 6px; }

/* ---------- 主聊天区 ---------- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--canvas); }
.chat-head { height: 58px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.chat-head .title { min-width: 0; }
.chat-head .title h3 { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chat-head .title p { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.chat-head .actions { margin-left: auto; display: flex; gap: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #10B981; }

.msgs { flex: 1; overflow-y: auto; padding: 20px 22px 8px; }
.day-divider { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.day-divider::before, .day-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.sys-line { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 16px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.sys-line .i { width: 14px; height: 14px; margin-top: 2px; }

.msg { display: flex; gap: 10px; margin-bottom: 18px; }
.msg .avatar { width: 34px; height: 34px; }
.msg .m-body { min-width: 0; max-width: min(78%, 620px); }
.m-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--ink-3); }
.m-meta b { color: var(--ink); font-size: 13px; font-weight: 600; }
.m-meta .role { color: var(--brand); }
.bubble { position: relative; padding: 9px 13px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px 12px 12px 12px; font-size: 13.5px; line-height: 1.6; box-shadow: var(--shadow-sm); word-break: break-word; }

.msg.me { flex-direction: row-reverse; }
.msg.me .m-body { display: flex; flex-direction: column; align-items: flex-end; }
.msg.me .m-meta { flex-direction: row-reverse; }
.msg.me .bubble { background: var(--brand-soft); border-color: var(--brand-border); border-radius: 12px 4px 12px 12px; }

.read-state { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.read-state .i { width: 13px; height: 13px; color: var(--brand); }

/* 消息级风控标记 */
.msg.risk .bubble { border-color: var(--red-border); background: var(--red-soft); }
.risk-tag { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 9px; border-radius: var(--r-sm);
  background: var(--red-soft); border: 1px solid var(--red-border); color: var(--red); font-size: 11.5px; font-weight: 500; }

/* 内部私密笔记 */
.msg.internal .avatar { background: linear-gradient(135deg, #B45309, #92400E); }
.internal-wrap { background: var(--amber-soft); border: 1px solid var(--amber-border); border-radius: 4px 12px 12px 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.internal-tag { display: flex; align-items: center; gap: 6px; padding: 5px 11px; background: var(--amber-fill);
  border-bottom: 1px solid var(--amber-border); color: var(--amber); font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.internal-wrap .bubble { border: 0; background: transparent; box-shadow: none; }
.internal-wrap.bot { border-style: dashed; }

/* 附件行 */
.attach { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: var(--r-sm);
  background: var(--slate-soft); border: 1px solid var(--line); cursor: pointer; }
.attach:hover { border-color: #CBD5E1; }
.attach .i-lg { color: var(--brand); }
.attach b { font-size: 12.5px; display: block; }
.attach span { font-size: 11px; color: var(--ink-3); }

/* EN 译文折叠 */
.trans { margin-top: 6px; }
.trans-toggle { font-size: 11.5px; color: var(--brand); display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.trans-toggle .i { width: 12px; height: 12px; transition: transform .15s ease; }
.trans-toggle.open .i { transform: rotate(90deg); }
.trans-body { display: none; margin-top: 5px; padding: 7px 10px; border-left: 2px solid var(--brand-border);
  background: var(--slate-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 12.5px; color: var(--ink-2); }
.trans-toggle.open + .trans-body { display: block; }
.ai-tag { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; color: #7C3AED;
  background: #F5F3FF; border: 1px solid #EDE9FE; border-radius: 999px; padding: 2px 9px; }

/* 业务卡片 */
.cardbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); max-width: 560px; }
.cardbox-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.cardbox-head .i-lg { color: var(--brand); }
.cardbox-head b { font-size: 13px; }
.cardbox-head .chip { margin-left: auto; }
.cardbox-row { display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; font-size: 12.5px; }
.cardbox-row + .cardbox-row { border-top: 1px solid var(--line-soft); }
.cardbox-row .k { width: 64px; flex: none; color: var(--ink-3); font-size: 12px; }
.issue { display: flex; align-items: flex-start; gap: 8px; }
.issue .tick { width: 16px; height: 16px; flex: none; margin-top: 2px; border-radius: 5px; border: 1.5px solid #CBD5E1;
  display: flex; align-items: center; justify-content: center; color: #fff; }
.issue.done .tick { background: var(--emerald); border-color: var(--emerald); }
.issue.done span { color: var(--ink-3); text-decoration: line-through; }
.issue .pinno { flex: none; width: 17px; height: 17px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.cardbox-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); background: var(--panel-2); }
.confirm-state { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.confirm-state .big { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.confirm-state .big.signed { background: var(--emerald-soft); color: var(--emerald); border: 1px solid var(--emerald-border); }
.confirm-state .big.pending { background: var(--amber-fill); color: var(--amber); border: 1px solid var(--amber-border); animation: pulse-dot 1.8s ease infinite; }
.confirm-state b { display: block; font-size: 13px; }
.confirm-state span { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 输入区 ---------- */
.composer { flex: none; padding: 12px 18px 16px; background: linear-gradient(transparent, var(--canvas) 30%); }
.composer-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  transition: border-color .15s ease, box-shadow .15s ease; }
.composer-box:focus-within { border-color: #B6C6F0; box-shadow: 0 0 0 3px rgba(29,78,216,.08), var(--shadow-md); }
.composer.internal .composer-box { border-color: var(--amber-border); background: #FFFDF5; }
.composer-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.seg { display: flex; background: var(--slate-soft); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { height: 26px; padding: 0 12px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button.on.sec { color: var(--amber); }
.composer-top .hint { margin-left: auto; font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  padding: 10px 14px 4px; font-size: 13.5px; line-height: 1.55; max-height: 120px; min-height: 42px; }
.composer textarea::placeholder { color: var(--ink-3); }
.composer-tools { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px; }
.composer-tools .icon-btn { color: var(--ink-3); width: 32px; height: 32px; }
.composer-tools .icon-btn:hover { color: var(--brand); }
.composer-tools .send { margin-left: auto; height: 32px; padding: 0 16px; border-radius: 8px; background: var(--brand); color: #fff;
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.composer-tools .send:hover { background: var(--brand-strong); }
.composer.internal .composer-tools .send { background: var(--amber); }
.internal-banner { display: none; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12px; font-weight: 500;
  color: var(--amber); background: var(--amber-fill); border-bottom: 1px solid var(--amber-border); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.composer.internal .internal-banner { display: flex; }

/* ---------- 右侧审计抽屉 ---------- */
.drawer { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.drawer-tabs { display: flex; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-tabs button { flex: 1; height: 46px; font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: -1px; }
.drawer-tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.drawer-tabs button .n { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--slate-soft);
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.drawer-tabs button.on .n { background: var(--brand-soft); color: var(--brand); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px 20px; }
.d-section { margin-bottom: 18px; }
.d-section h4 { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

.d-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: var(--r-md); margin-bottom: 6px; background: var(--panel-2); }
.d-row:hover { border-color: #CBD5E1; }
.d-row .file-ic { width: 34px; height: 40px; flex: none; border-radius: 6px; border: 1.5px solid var(--brand); color: var(--brand);
  display: flex; align-items: center; justify-content: center; position: relative; background: var(--brand-soft); }
.d-row .file-ic::after { content: ''; position: absolute; top: -1px; right: -1px; width: 9px; height: 9px;
  background: var(--brand-soft); border-left: 1.5px solid var(--brand); border-bottom: 1.5px solid var(--brand); border-radius: 0 6px 0 0; }
.d-row .file-ic.locked { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-soft); }
.d-row .file-ic.locked::after { background: var(--emerald-soft); border-color: var(--emerald); }
.d-main { flex: 1; min-width: 0; }
.d-main b { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.d-main span { font-size: 11px; color: var(--ink-3); display: block; }
.d-row .ver { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.commit { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); margin-bottom: 6px; background: var(--panel-2); }
.commit .cl { display: flex; align-items: center; gap: 8px; }
.commit .cl b { font-size: 12.5px; }
.commit .cl .chip { margin-left: auto; }
.commit .val { font-size: 12.5px; color: var(--ink); margin: 4px 0 3px; }
.commit .src { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.commit .src a { color: var(--brand); cursor: pointer; }
.commit.warn { border-color: var(--red-border); background: var(--red-soft); }
.commit.warn .val { color: var(--red); font-weight: 500; }

.risk-row { padding: 10px 12px; border-radius: var(--r-md); margin-bottom: 6px; border: 1px solid var(--line-soft); background: var(--panel-2); }
.risk-row.high { border-color: var(--red-border); background: var(--red-soft); }
.risk-row.mid { border-color: var(--amber-border); background: var(--amber-soft); }
.risk-row .rl { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.risk-row .rl .i { color: var(--red); }
.risk-row.mid .rl .i { color: var(--amber); }
.risk-row .rs { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

.empty-state { text-align: center; padding: 28px 10px; color: var(--ink-3); font-size: 12px; }
.empty-state .i { width: 26px; height: 26px; margin-bottom: 8px; opacity: .5; }

/* 共享链接弹窗 */
.share-grid { display: grid; grid-template-columns: 1fr 132px; gap: 14px; align-items: center; }
.share-url { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--slate-soft);
  border: 1px solid var(--line); border-radius: var(--r-md); font-family: var(--mono); font-size: 12px; }
.qr { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.share-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.share-note { margin-top: 12px; font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: flex-start; }

/* ---------- 全文检索面板 ---------- */
.search-panel { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); max-height: 340px; overflow-y: auto; display: none; }
.sp-head { position: sticky; top: 0; background: var(--panel); padding: 10px 12px 6px;
  font-size: 11px; color: var(--ink-3); border-bottom: 1px solid var(--line-soft); }
.sp-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.sp-item:last-child { border-bottom: 0; }
.sp-item:hover { background: var(--slate-soft); }
.sp-item .sp-ch { font-size: 11px; color: var(--brand); margin-bottom: 2px; display: flex; justify-content: space-between; }
.sp-item .sp-txt { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.sp-item mark { background: var(--amber-fill); color: var(--amber); border-radius: 2px; padding: 0 2px; }
.sp-empty { padding: 16px 12px; font-size: 12px; color: var(--ink-3); text-align: center; }
.flash-msg { animation: flashmsg 1.6s ease; border-radius: var(--r-md); }
@keyframes flashmsg { 0%, 60% { box-shadow: 0 0 0 3px rgba(29,78,216,.22); background: var(--brand-soft); } }

/* ---------- 语音消息 / 撤回留痕 / 录音 ---------- */
.voice { display: flex; align-items: center; gap: 9px; padding: 3px 2px; min-width: 150px; }
.vplay { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: none; transition: background .15s ease; }
.vplay:hover { background: var(--brand-strong); }
.vplay.playing { background: var(--emerald); animation: pulse-dot 1.2s ease infinite; }
.vbars { display: flex; align-items: center; gap: 2.5px; height: 20px; }
.vbars i { width: 2.5px; border-radius: 2px; background: var(--brand); opacity: .7; }
.vdur { font-size: 11px; color: var(--ink-3); margin-left: auto; }
.vtag { margin-top: 6px; font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; }
.vtag .i { width: 12px; height: 12px; color: var(--emerald); }

.tombstone { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.tombstone .i { width: 13px; height: 13px; }
.tomb-toggle { color: var(--brand); font-size: 12px; text-decoration: underline dotted; text-underline-offset: 3px; }
.tomb-orig { display: none; width: 100%; margin-top: 6px; padding: 7px 10px;
  border-left: 2px solid var(--amber-border); background: var(--amber-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 12.5px; color: var(--ink-2); }
.tombstone.open .tomb-orig { display: block; }
.recall-btn { color: var(--ink-3); font-size: 11px; opacity: 0; transition: opacity .15s ease; }
.msg:hover .recall-btn { opacity: 1; }
.recall-btn:hover { color: var(--red); }
.icon-btn.rec-on { color: #fff; background: var(--red); animation: pulse-dot 1.2s ease infinite; }
.rec-chip { margin-left: 4px; }

@media (max-width: 1180px) { .app { grid-template-columns: 56px 260px minmax(0,1fr); } .drawer { display: none; } }

/* ---------- 实时状态与"正在输入" ---------- */
.tdots { display: inline-flex; gap: 4px; align-items: center; }
.tdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: tyk 1s ease infinite; }
.tdots i:nth-child(2) { animation-delay: .15s; }
.tdots i:nth-child(3) { animation-delay: .3s; }
@keyframes tyk { 40% { transform: translateY(-4px); opacity: .5; } }
