/* Team Chat: conversation list + thread, mobile friendly */
.ch { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 150px); min-height: 480px; border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; background: var(--bg-secondary); }
.ch-side { display: flex; flex-direction: column; border-right: 1px solid var(--border-subtle); min-width: 0; }
.ch-side-top { padding: 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border-subtle); }
.ch-side-top .row { display: flex; gap: 6px; }
.ch-list { flex: 1; overflow-y: auto; }
.ch-item { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.04); align-items: center; }
.ch-item:hover { background: rgba(255,255,255,.04); } .ch-item.on { background: rgba(56,189,248,.12); }
.ch-av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #04121c; position: relative; }
.ch-av .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #4ade80; border: 2px solid var(--bg-secondary); }
.ch-meta { min-width: 0; flex: 1; }
.ch-name { font-weight: 700; color: #f8fafc; display: flex; justify-content: space-between; gap: 6px; }
.ch-name small { font-weight: 400; color: var(--text-muted); white-space: nowrap; font-size: 11px; }
.ch-last { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; justify-content: space-between; gap: 6px; }
.ch-unread { background: #22c55e; color: #04121c; font-weight: 800; font-size: 11px; border-radius: 999px; padding: 1px 7px; flex-shrink: 0; }
.ch-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-primary, #0b1220); position: relative; }
.ch-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-secondary); }
.ch-head .t { font-weight: 800; color: #fff; } .ch-head .s { font-size: 12px; color: var(--text-muted); }
.ch-back { display: none; }
.ch-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.ch-day { align-self: center; font-size: 11px; color: var(--text-muted); background: rgba(148,163,184,.14); padding: 3px 12px; border-radius: 999px; margin: 10px 0 4px; }
.ch-sys { align-self: center; font-size: 12px; color: var(--text-muted); font-style: italic; margin: 4px 0; text-align: center; }
.ch-row { display: flex; max-width: 100%; } .ch-row.mine { justify-content: flex-end; }
.ch-bub { max-width: min(560px, 82%); background: var(--bg-tertiary); border: 1px solid var(--border-subtle); border-radius: 14px; border-top-left-radius: 4px; padding: 7px 11px; position: relative; overflow-wrap: anywhere; }
.ch-row.mine .ch-bub { background: rgba(14,165,233,.18); border-color: rgba(14,165,233,.35); border-top-left-radius: 14px; border-top-right-radius: 4px; }
.ch-sender { font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.ch-text { white-space: pre-wrap; color: #f1f5f9; font-size: 14px; line-height: 1.4; }
.ch-text a { color: #7dd3fc; }
.ch-foot { display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.ch-tick { font-size: 12px; letter-spacing: -2px; } .ch-tick.read { color: #38bdf8; } .ch-tick.bad { color: #f87171; letter-spacing: 0; }
.ch-quote { border-left: 3px solid #38bdf8; background: rgba(0,0,0,.18); padding: 4px 8px; border-radius: 6px; margin-bottom: 5px; font-size: 12px; color: #cbd5e1; cursor: pointer; }
.ch-quote b { display: block; color: #7dd3fc; font-size: 11.5px; }
.ch-fwd { font-size: 11px; color: var(--text-muted); font-style: italic; margin-bottom: 3px; }
.ch-media img { max-width: 100%; max-height: 280px; border-radius: 10px; display: block; cursor: zoom-in; }
.ch-media audio { width: 260px; max-width: 100%; } .ch-media video { max-width: 100%; max-height: 300px; border-radius: 10px; }
.ch-file { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px 10px; text-decoration: none; color: #e2e8f0; }
.ch-file i { font-size: 24px; font-style: normal; } .ch-file small { display: block; color: var(--text-muted); }
.ch-menu-btn { position: absolute; top: 2px; right: 4px; opacity: 0; background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 15px; }
.ch-bub:hover .ch-menu-btn { opacity: 1; }
.ch-pop { position: fixed; z-index: 3000; background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); padding: 4px; min-width: 150px; }
.ch-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; color: #e2e8f0; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ch-pop button:hover { background: rgba(255,255,255,.08); } .ch-pop button.bad { color: #f87171; }
.ch-compose { border-top: 1px solid var(--border-subtle); padding: 10px; background: var(--bg-secondary); }
.ch-reply-chip { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: rgba(56,189,248,.1); border-left: 3px solid #38bdf8; padding: 5px 10px; border-radius: 6px; margin-bottom: 6px; font-size: 12.5px; color: #cbd5e1; }
.ch-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ch-files span { background: rgba(148,163,184,.16); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.ch-input-row { display: flex; gap: 8px; align-items: flex-end; }
.ch-input-row textarea { flex: 1; resize: none; max-height: 140px; min-height: 40px; }
.ch-empty { margin: auto; text-align: center; color: var(--text-muted); padding: 30px; }
.ch-modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ch-box { background: var(--bg-secondary); border: 1px solid var(--border-subtle); border-radius: 14px; width: min(520px, 100%); max-height: 86vh; overflow: auto; padding: 16px; }
.ch-box h3 { margin: 0 0 10px; }
.ch-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: 10px; }
.ch-pick label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,.04); }
.ch-info table { width: 100%; font-size: 12.5px; border-collapse: collapse; } .ch-info td, .ch-info th { padding: 5px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.05); }
.ch-badge { background: #ef4444; color: #fff; border-radius: 999px; font-size: 10px; font-weight: 800; padding: 2px 6px; margin-left: auto; }
@media (max-width: 800px) {
  .ch { grid-template-columns: 1fr; height: calc(100vh - 130px); }
  .ch .ch-main { display: none; } .ch.open .ch-side { display: none; } .ch.open .ch-main { display: flex; }
  .ch-back { display: inline-flex; } .ch-bub { max-width: 90%; }
}
