/* Client Inbox — live SMS + email (ci- namespace) */

.ci-page { padding: 4px 0 24px; display: flex; flex-direction: column; height: calc(100vh - 150px); }

.ci-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 14px; flex-shrink: 0; }
.ci-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); margin-bottom: 4px; }
.ci-title { font-family: var(--font-display); font-size: 30px; font-weight: 500; margin: 0 0 6px; color: var(--text); }
.ci-sub { color: var(--text-dim); font-size: 13.5px; max-width: 720px; line-height: 1.5; }
.ci-head-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.ci-unread-total { background: var(--accent-ghost); border: 1px solid var(--accent-dim); color: var(--accent); border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.ci-unread-total b { font-size: 15px; }

.ci-btn { background: var(--bg-2); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: var(--radius); cursor: pointer; }
.ci-btn:hover { border-color: var(--accent-dim); }
.ci-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.ci-btn.ghost { background: transparent; }
.ci-btn:disabled { opacity: 0.55; cursor: default; }

.ci-loading, .ci-empty { color: var(--text-dim); padding: 40px 16px; text-align: center; font-size: 14px; }
.ci-error { background: oklch(0.70 0.16 25 / 0.12); border: 1px solid oklch(0.70 0.16 25 / 0.4); color: var(--text); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin: 6px 0; }

/* ── split layout ── */
.ci-split { display: grid; grid-template-columns: 360px 1fr; gap: 0; flex: 1; min-height: 0; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); overflow: hidden; }

/* thread list */
.ci-list { border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; min-height: 0; }
.ci-list-tools { padding: 12px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.ci-search { width: 100%; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 9px 12px; font: inherit; font-size: 13px; margin-bottom: 10px; box-sizing: border-box; }
.ci-search:focus { outline: none; border-color: var(--accent-dim); }
.ci-tabs { display: flex; gap: 6px; }
.ci-tab { flex: 1; background: transparent; border: 1px solid var(--border); color: var(--text-dim); font: inherit; font-size: 12px; font-weight: 600; padding: 6px 4px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.ci-tab.active { background: var(--accent-ghost); border-color: var(--accent-dim); color: var(--accent); }

.ci-threads { overflow-y: auto; flex: 1; }
.ci-thread { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border-soft); padding: 12px 14px; cursor: pointer; font: inherit; color: var(--text); }
.ci-thread:hover { background: var(--bg-2); }
.ci-thread.active { background: var(--accent-ghost); }
.ci-thread.unread .ci-thread-name { font-weight: 700; }
.ci-thread.unread .ci-thread-preview { color: var(--text); }
.ci-ch-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; background: var(--bg-2); }
.ci-thread-main { flex: 1; min-width: 0; }
.ci-thread-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.ci-thread-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-thread-time { color: var(--text-faint); font-size: 11px; white-space: nowrap; }
.ci-thread-preview { color: var(--text-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-badge { background: var(--accent); color: var(--accent-fg); font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0 6px; flex-shrink: 0; }

/* conversation pane */
.ci-convo { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ci-convo-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-faint); font-size: 14px; }
.ci-convo-empty-icon { font-size: 34px; opacity: 0.6; }
.ci-convo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.ci-convo-name { font-size: 15px; font-weight: 700; color: var(--text); }
.ci-convo-handle { color: var(--text-dim); font-size: 12.5px; margin-top: 1px; }
.ci-ch-pill { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; border-radius: 5px; padding: 3px 8px; }
.ci-ch-pill.ci-ch-sms { background: oklch(0.78 0.12 150 / 0.15); color: var(--good); border: 1px solid oklch(0.78 0.12 150 / 0.4); }
.ci-ch-pill.ci-ch-email { background: oklch(0.78 0.09 230 / 0.15); color: var(--info); border: 1px solid oklch(0.78 0.09 230 / 0.4); }

.ci-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.ci-msg { max-width: 74%; border-radius: 14px; padding: 10px 14px; font-size: 13.5px; line-height: 1.5; }
.ci-msg.in { align-self: flex-start; background: var(--bg-2); color: var(--text); border-bottom-left-radius: 4px; }
.ci-msg.out { align-self: flex-end; background: var(--accent-ghost); border: 1px solid var(--accent-dim); color: var(--text); border-bottom-right-radius: 4px; }
.ci-msg-subject { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; color: var(--text); }
.ci-msg-body { white-space: pre-wrap; word-break: break-word; }
.ci-msg-time { color: var(--text-faint); font-size: 10.5px; margin-top: 5px; text-align: right; }

.ci-reply { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px 6px; border-top: 1px solid var(--border-soft); flex-shrink: 0; }
.ci-reply-input { flex: 1; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 10px 12px; font: inherit; font-size: 13.5px; resize: none; }
.ci-reply-input:focus { outline: none; border-color: var(--accent-dim); }
.ci-send-err { margin: 6px 18px 0; }
.ci-guard-note { color: var(--text-faint); font-size: 11px; padding: 4px 18px 12px; }

@media (max-width: 900px) {
  .ci-split { grid-template-columns: 1fr; }
  .ci-list { display: none; }
  .ci-split:has(.ci-convo-empty) .ci-list { display: flex; }
  .ci-page { height: auto; }
  .ci-msgs { max-height: 50vh; }
}
