/* ══════════════════════════════════════
   INBOX / CHAT — css/inbox.css
══════════════════════════════════════ */
.inbox-layout { display:grid; grid-template-columns:268px 1fr 248px; flex:1; min-height:0; overflow:hidden; }

/* ── Conversation list ── */
.conv-col { border-right:1px solid var(--b); display:flex; flex-direction:column; background:var(--s1); }
.conv-search-wrap { padding:11px 12px; border-bottom:1px solid var(--b); flex-shrink:0; }
.conv-search { background:var(--s2); border:1px solid var(--b2); border-radius:9px; padding:7px 10px; display:flex; align-items:center; gap:6px; margin-bottom:8px; }
.conv-search input { background:transparent; border:none; outline:none; font-size:12px; color:var(--t); flex:1; width:100%; }
.conv-search input::placeholder { color:var(--m); }
.conv-filters { display:flex; gap:3px; overflow-x:auto; scrollbar-width:none; }
.conv-filters::-webkit-scrollbar { display:none; }
.conv-filter { font-size:9px; font-weight:700; padding:3px 8px; border-radius:20px; cursor:pointer; white-space:nowrap; border:1px solid var(--b2); color:var(--m2); background:transparent; transition:all .15s; }
.conv-filter.active { background:var(--bd); color:var(--blue); border-color:rgba(59,142,255,.3); }
.conv-list { flex:1; overflow-y:auto; }

/* Conversation item */
.conv-item { display:flex; gap:9px; padding:10px 12px; border-bottom:1px solid var(--b); cursor:pointer; transition:background .15s; position:relative; }
.conv-item:hover { background:rgba(255,255,255,.024); }
.conv-item.active { background:rgba(59,142,255,.07); }
.conv-item.unread::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--blue); }
.ci-avatar { width:32px; height:32px; border-radius:9px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:#fff; font-family:var(--mo); }
.ci-body { flex:1; min-width:0; }
.ci-row1 { display:flex; align-items:center; gap:4px; margin-bottom:2px; }
.ci-name { font-size:12px; font-weight:700; }
.ci-time { font-size:9px; color:var(--m); margin-left:auto; font-family:var(--mo); }
.ci-preview { font-size:11px; color:var(--m2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-bottom:3px; }
.ci-tags { display:flex; gap:3px; flex-wrap:wrap; }
.unread-dot { width:6px; height:6px; background:var(--blue); border-radius:50%; flex-shrink:0; }

/* ── Chat area ── */
.chat-col { display:flex; flex-direction:column; background:var(--s2); overflow:hidden; }
.chat-header { padding:10px 14px; border-bottom:1px solid var(--b); display:flex; align-items:center; gap:9px; background:var(--s1); flex-shrink:0; }
.chat-hd-avatar { width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:#fff; flex-shrink:0; font-family:var(--mo); }
.chat-hd-name   { font-size:13px; font-weight:700; }
.chat-hd-status { font-size:10px; color:var(--green); display:flex; align-items:center; gap:3px; }
.chat-hd-status::before { content:''; width:4px; height:4px; background:var(--green); border-radius:50%; animation:blink 1.5s ease-in-out infinite; }
.chat-hd-actions { margin-left:auto; display:flex; gap:6px; }

/* AI mode banner */
.ai-mode-banner { padding:6px 14px; background:rgba(59,142,255,.07); border-bottom:1px solid rgba(59,142,255,.14); display:flex; align-items:center; gap:7px; font-size:11px; color:var(--blue); font-weight:600; flex-shrink:0; }
.ai-mode-banner.human { background:rgba(255,181,71,.07); border-color:rgba(255,181,71,.18); color:var(--amber); }
.ai-banner-right { margin-left:auto; display:flex; align-items:center; gap:8px; }

/* Messages */
.chat-messages { flex:1; overflow-y:auto; padding:12px 14px; display:flex; flex-direction:column; gap:8px; }
.msg-row { display:flex; align-items:flex-end; gap:6px; }
.msg-row.from-patient { justify-content:flex-start; }
.msg-row.from-ai, .msg-row.from-human { justify-content:flex-end; }
.msg-avatar-wrap { width:22px; height:22px; border-radius:7px; flex-shrink:0; margin-bottom:2px; display:flex; align-items:center; justify-content:center; }
.msg-avatar-wrap.ai { background:linear-gradient(135deg,var(--blue),var(--green)); }
.msg-avatar-wrap svg { width:10px; height:10px; }
.bubble { max-width:78%; padding:8px 12px; font-size:12px; line-height:1.55; color:var(--t); word-break:break-word; }
.bubble.patient { background:rgba(20,28,46,.97); border:1px solid var(--b2); border-radius:13px 13px 13px 3px; }
.bubble.ai      { background:linear-gradient(135deg,var(--blue2),var(--blue)); border-radius:13px 13px 3px 13px; }
.bubble.human   { background:rgba(255,181,71,.1); border:1px solid rgba(255,181,71,.25); border-radius:13px 13px 3px 13px; }
.bubble-label { font-size:8px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; margin-bottom:3px; display:flex; align-items:center; gap:3px; opacity:.75; }
.bubble.ai .bubble-label     { color:rgba(255,255,255,.85); }
.bubble.human .bubble-label  { color:var(--amber); }
.bubble-dot { width:3px; height:3px; background:rgba(255,255,255,.7); border-radius:50%; animation:blink 1.2s ease-in-out infinite; }

/* Appointment card bubble */
.appt-card-bubble { background:rgba(12,18,34,.98); border:1px solid rgba(59,142,255,.3); border-radius:12px; overflow:hidden; max-width:224px; }
.acb-header { background:linear-gradient(135deg,rgba(59,142,255,.22),rgba(0,229,160,.1)); padding:9px 11px; border-bottom:1px solid rgba(59,142,255,.15); }
.acb-title  { font-size:10px; font-weight:800; color:var(--t); }
.acb-sub    { font-size:9px; color:rgba(255,255,255,.4); }
.acb-body   { padding:8px 11px; display:flex; flex-direction:column; gap:4px; }
.acb-row    { font-size:10px; color:rgba(255,255,255,.7); }
.acb-row strong { color:#fff; }
.acb-actions { display:flex; border-top:1px solid rgba(255,255,255,.07); }
.acb-btn { flex:1; padding:8px; text-align:center; font-size:10px; font-weight:700; border:none; background:transparent; cursor:pointer; transition:background .15s; }
.acb-btn.confirm { color:var(--green); border-right:1px solid rgba(255,255,255,.07); }
.acb-btn.confirm:hover { background:rgba(0,229,160,.1); }
.acb-btn.edit    { color:var(--m2); }
.acb-btn.edit:hover { background:rgba(255,255,255,.05); }

/* Typing indicator */
.typing-indicator { background:rgba(20,28,46,.97); border:1px solid var(--b2); border-radius:13px; padding:10px 13px; display:flex; gap:4px; width:fit-content; }
.typing-dot { width:5px; height:5px; background:rgba(255,255,255,.3); border-radius:50%; animation:typing 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay:.2s; }
.typing-dot:nth-child(3) { animation-delay:.4s; }

/* System events & date dividers */
.date-divider { text-align:center; font-size:9px; color:rgba(255,255,255,.2); font-family:var(--mo); margin:4px 0; }
.system-event { display:flex; justify-content:center; margin:4px 0; }
.system-event-text { font-size:10px; color:var(--m2); background:var(--s2); padding:3px 10px; border-radius:20px; border:1px solid var(--b); }

/* Chat input area */
.chat-input-area { padding:9px 12px; border-top:1px solid var(--b); background:var(--s1); flex-shrink:0; }
.ai-warning-bar { display:flex; align-items:center; gap:6px; background:rgba(255,181,71,.07); border:1px solid rgba(255,181,71,.18); border-radius:8px; padding:6px 10px; margin-bottom:7px; font-size:11px; color:var(--amber); font-weight:600; }
.chat-input-row { display:flex; gap:6px; align-items:flex-end; }
.chat-textarea {
  flex:1; background:var(--s2); border:1px solid var(--b2); border-radius:9px;
  padding:8px 11px; font-size:12px; color:var(--t); resize:none; outline:none;
  min-height:36px; max-height:90px; transition:border-color .2s; line-height:1.5;
}
.chat-textarea:focus { border-color:rgba(59,142,255,.4); }
.chat-textarea::placeholder { color:var(--m); }
.send-btn { width:34px; height:34px; border-radius:8px; background:var(--blue); border:none; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .15s; }
.send-btn:hover { background:var(--blue2); }
.send-btn svg { width:14px; height:14px; }
.quick-replies { display:flex; gap:5px; margin-top:6px; flex-wrap:wrap; }
.quick-reply { font-size:10px; font-weight:600; padding:3px 9px; border-radius:20px; background:var(--s2); border:1px solid var(--b2); color:var(--m2); cursor:pointer; transition:all .15s; }
.quick-reply:hover { color:var(--t); border-color:var(--b3); }

/* ── Detail panel ── */
.detail-col { border-left:1px solid var(--b); background:var(--s1); overflow-y:auto; display:flex; flex-direction:column; }
.detail-sec { padding:13px 14px; border-bottom:1px solid var(--b); }
.detail-sec:last-child { border-bottom:none; }
.detail-sec-label { font-size:9px; font-weight:700; color:var(--m); letter-spacing:.12em; text-transform:uppercase; margin-bottom:9px; font-family:var(--mo); }
.patient-hd { display:flex; align-items:center; gap:9px; margin-bottom:12px; }
.patient-hd-av { width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; font-family:var(--mo); flex-shrink:0; }
.patient-hd-name { font-size:13px; font-weight:700; }
.patient-hd-since { font-size:11px; color:var(--m2); }
.detail-row { display:flex; justify-content:space-between; align-items:center; padding:5px 0; border-bottom:1px solid var(--b); }
.detail-row:last-child { border-bottom:none; }
.dr-key { font-size:11px; color:var(--m2); }
.dr-val { font-size:11px; font-weight:600; }
.dr-val.blue   { color:var(--blue); }
.dr-val.green  { color:var(--green); }
.dr-val.amber  { color:var(--amber); }
.hist-item { padding:6px 0; border-bottom:1px solid var(--b); }
.hist-item:last-child { border-bottom:none; }
.hi-date      { font-size:9px; color:var(--m); font-family:var(--mo); }
.hi-procedure { font-size:12px; font-weight:600; margin:1px 0; }
.hi-doctor    { font-size:11px; color:var(--m2); }
.alert-chip { font-size:11px; padding:5px 9px; border-radius:8px; margin-bottom:5px; display:block; }
.alert-chip.warning { background:rgba(255,181,71,.1); border:1px solid rgba(255,181,71,.22); color:var(--amber); }
.alert-chip.info    { background:var(--s2); border:1px solid var(--b); color:var(--m2); }
.note-textarea { width:100%; background:var(--s2); border:1px solid var(--b2); border-radius:8px; padding:8px 10px; font-size:12px; color:var(--t); resize:none; outline:none; height:64px; margin-top:8px; line-height:1.5; }
.note-textarea::placeholder { color:var(--m); }
.detail-actions { display:flex; flex-direction:column; gap:6px; padding:12px 14px; }
.det-action { width:100%; padding:8px; border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; border:none; transition:all .15s; text-align:center; }
.det-action.primary   { background:var(--blue); color:#fff; }
.det-action.primary:hover { background:var(--blue2); }
.det-action.secondary { background:var(--s2); color:var(--m3); border:1px solid var(--b2); }
.det-action.secondary:hover { color:var(--t); }
