/* ---------- inbox page (ib-) ---------- */
.ib { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) minmax(260px, 310px); gap: 16px;
  height: calc(100dvh - var(--top-h) - 72px); min-height: 540px; }
.ib-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-1); }
.ib-pane > .empty { margin: auto; }
.ib-pad { padding: 16px; }

/* list pane */
.ib-lhead { display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 0; }
.ib-lhead h2 { font-size: 16px; }
.ib-filters { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.ib-scroll { overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.ib-scroll::-webkit-scrollbar { display: none; }
.ib-chips { display: flex; gap: 6px; }
.ib-chips .chip { height: 30px; flex: none; padding: 0 10px; }
.ib-chips .chip .mark { width: 20px; height: 20px; border-radius: 6px; }
.ib-n { margin-inline-start: 6px; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.ib-n.hot { color: var(--bad-text); font-weight: 700; }
.ib-cat { min-height: 36px; font-size: 13px; }
.ib-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; transition: opacity var(--t-fast); }
.ib-list.busy .ib-rows { opacity: 0.6; }

.ib-row { position: relative; display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 11px 12px; border: 0;
  border-radius: 12px; background: transparent; color: inherit; text-align: start; cursor: pointer; transition: background var(--t-fast); }
.ib-row + .ib-row { margin-top: 2px; }
.ib-row:hover { background: var(--surface-2); }
.ib-row.on { background: var(--accent-soft); }
.ib-row.hot::before { content: ''; position: absolute; inset-inline-start: 2px; top: 12px; bottom: 12px; width: 3px;
  border-radius: 3px; background: var(--warn); }
.ib-row.p1::before { background: var(--bad); }
.ib-row.closed { opacity: 0.6; }
.ib-rmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ib-rtop { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.ib-rtop b { font-size: 14px; font-weight: 500; color: var(--text-2); }
.ib-row.unread .ib-rtop b, .ib-row.hot .ib-rtop b { font-weight: 700; color: var(--text); }
.ib-ago { flex: none; }
.ib-rhandle { display: block; }
.ib-prev { line-height: 1.55; word-break: break-word; }
.ib-row.unread .ib-prev { color: var(--text); }
.ib-rtags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; }
.ib-unread { margin-inline-start: auto; background: var(--accent); color: var(--on-accent); }
.ib-senti { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; }
.ib-senti::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ib-senti.neg { color: var(--bad-text); }
.ib-senti.pos { color: var(--ok-text); }

/* thread pane */
.ib-thread-in { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ib-thead { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ib-back, .ib-info { display: none; flex: none; }
.ib-tactions { display: flex; align-items: center; gap: 4px; flex: none; }
.ib-msgs { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px;
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.ib-day { display: flex; justify-content: center; }
.ib-day span { padding: 2px 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3); }
.ib-onpost { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }

.ib-msg { display: flex; flex-direction: column; gap: 4px; max-width: min(78%, 580px); }
.ib-msg.in { align-self: flex-start; align-items: flex-start; }
.ib-msg.out { align-self: flex-end; align-items: flex-end; }
.ib-author { padding-inline: 4px; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.ib-bubble { padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.75; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-1); max-width: 100%; }
.ib-msg.in .ib-bubble { border-start-start-radius: 6px; }
.ib-msg.out .ib-bubble { background: var(--accent-soft); border-color: transparent; box-shadow: none; border-start-end-radius: 6px; }
.ib-msg.st-pending .ib-bubble { background: var(--warn-soft); border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.ib-msg.st-failed .ib-bubble { background: var(--bad-soft); }
.ib-msg.st-discarded .ib-bubble { opacity: 0.55; }
.ib-msg.st-discarded .ib-bubble p { text-decoration: line-through; }
.ib-mfoot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-inline: 4px; }
.ib-st { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-3); }
.ib-st.ok { color: var(--ok-text); }
.ib-st.warn { color: var(--warn-text); font-weight: 600; }
.ib-st.bad { color: var(--bad-text); font-weight: 600; }
.ib-err { padding-inline: 4px; color: var(--bad-text); }
.ib-ainote { display: flex; gap: 5px; align-items: flex-start; padding-inline: 4px; font-size: 11.5px; line-height: 1.6; color: var(--text-2); }
.ib-ainote svg { flex: none; margin-top: 3px; color: var(--accent-text); }
.ib-pending { align-self: stretch; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: var(--shadow-1); }
.ib-pending.row { justify-content: flex-end; }
.ib-pending .textarea { min-height: 96px; }
.ib-pnote { padding-inline: 4px; }

.ib-composer { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.ib-composer.ro { padding: 14px 16px; }
.ib-cnotice { padding: 8px 12px; font-size: 12.5px; }
.ib-input { width: 100%; min-height: 64px; max-height: 200px; padding: 10px 12px; border-radius: var(--r-ctl); border: 1px solid var(--line-2);
  background: var(--surface-2); line-height: 1.7; resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.ib-input::placeholder { color: var(--text-3); }
.ib-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.ib-cbar { display: flex; align-items: center; gap: 10px; }
.ib-hint { flex: 1; min-width: 0; text-align: center; }
.ib-thread-skel { padding: 16px; }
.ib-skel-out { display: flex; justify-content: flex-end; }

/* contact pane */
.ib-contact { overflow-y: auto; }
.ib-card { padding: 18px; }
.drawer-body .ib-card { padding: 0; }
.ib-chead { display: flex; gap: 12px; align-items: center; }
.ib-avatar { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 15px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 18px; font-weight: 700; }
.ib-name { width: 100%; padding: 2px 6px; margin-inline-start: -6px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  font-size: 15.5px; font-weight: 600; transition: border-color var(--t-fast), background var(--t-fast); }
.ib-name:hover { border-color: var(--line-2); }
.ib-name:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.ib-name-ro { display: block; font-size: 15.5px; }
.ib-consent { margin-top: 16px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.ib-consent.on { background: var(--ok-soft); border-color: transparent; }
.ib-consent.on .row svg { color: var(--ok-text); }
.ib-notes { min-height: 88px; }

@media (max-width: 1280px) {
  .ib { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .ib-contact { display: none; }
  .ib-info { display: grid; }
}
@media (max-width: 980px) {
  .ib { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--top-h) - 112px); min-height: 440px; }
  .ib.has-thread .ib-list { display: none; }
  .ib:not(.has-thread) .ib-thread { display: none; }
  .ib-back { display: grid; }
  .ib-msgs { padding: 14px; }
  .ib-msg { max-width: 88%; }
}
@media (max-width: 560px) {
  .ib-thead { gap: 8px; padding: 10px 12px; }
  .ib-btxt { display: none; }
  .ib-tactions .btn.sm { width: 32px; padding: 0; }
  .ib-composer { padding: 10px 12px; }
}
