/* Inbound (redesign Phase 8): Two-pane inbox template (screens 36-37, reference-app/src/pages/Inbound.jsx).
   Glue on top of the design-system classes (inbox, inbox-list, conv, thread, thread-head, msgs, msg, reply, seg, chip). Tokens only. */

#inboundView { flex: 1; min-height: 0; overflow: hidden; background: var(--bg); color: var(--text); padding: 0; margin: 0; }
#inboundView [hidden] { display: none !important; }
#inboundView .in-inbox { width: 100%; height: 100%; flex: 1; min-width: 0; }
#inboundView .inbox-list { min-width: 0; background: var(--surface); }
#inboundView .in-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
#inboundView .in-title { margin: 0; font-size: var(--fs-20); font-weight: 600; letter-spacing: var(--tracking-tight); white-space: nowrap; }
#inboundView .in-total { white-space: nowrap; font-variant-numeric: tabular-nums; }
#inboundView .in-title-row .btn { margin-left: auto; }
#inboundView .in-search { width: 100%; }
#inboundView .inbox-list .select { height: 34px; width: 100%; font-size: var(--fs-13); }
#inboundView .in-seg { width: 100%; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
#inboundView .in-seg button { padding: 0 9px; white-space: nowrap; }
#inboundView .in-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Conversation list */
#inboundView .conv { align-items: flex-start; }
#inboundView .conv:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
#inboundView .conv .av { border-radius: 50%; }
#inboundView .in-conv-main { min-width: 0; flex: 1; }
#inboundView .in-conv-top { display: flex; gap: 8px; align-items: baseline; }
#inboundView .in-conv-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#inboundView .in-conv-top .t { flex: none; font-variant-numeric: tabular-nums; }
#inboundView .conv.unread b { color: var(--text); font-weight: 700; }
#inboundView .conv.unread p { color: var(--text); }
#inboundView .in-you { color: var(--text-3); font-weight: 600; }
#inboundView .in-conv-foot { display: flex; align-items: center; gap: 8px; }
#inboundView .in-rep { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
#inboundView .in-unread { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-11); font-weight: 600; color: var(--brand-text); }
#inboundView .in-unread .dot { width: 7px; height: 7px; background: var(--brand); }
#inboundView .in-list-empty, #inboundView .in-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px 20px; text-align: center; }
#inboundView .in-list-empty b, #inboundView .in-empty b { color: var(--text); font-weight: 600; }
#inboundView .in-empty { flex: 1; }
#inboundView .in-empty > span:last-child { max-width: 380px; line-height: 1.5; }
#inboundView .in-empty-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
#inboundView .in-skel { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
#inboundView .in-skel .skel { height: 56px; }

/* Thread */
#inboundView .in-thread { min-width: 0; position: relative; }
#inboundView .in-active { flex-direction: column; flex: 1; min-height: 0; width: 100%; }
#inboundView .in-head { flex-wrap: wrap; row-gap: 10px; background: var(--surface); }
#inboundView .in-av-lg { width: 40px; height: 40px; border-radius: 50%; font-size: var(--fs-14); flex: none; }
#inboundView .in-who { min-width: 0; flex: 1 1 220px; }
#inboundView .in-name { font-weight: 600; font-size: var(--fs-16); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#inboundView .in-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
#inboundView .in-phone { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 2px; }
#inboundView .in-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
#inboundView .in-actions .select { width: 170px; height: 32px; font-size: var(--fs-13); }
#inboundView .in-back { display: none; }
#inboundView .msgs { min-height: 0; }
#inboundView .in-marker { align-self: center; gap: 6px; }
#inboundView .in-day { align-self: center; font-size: var(--fs-11); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 0; }
#inboundView .msg { overflow-wrap: anywhere; }
#inboundView .in-sender { font-size: var(--fs-11); font-weight: 700; margin-bottom: 2px; opacity: 0.75; }
#inboundView .in-text { white-space: pre-wrap; }
#inboundView .msg time { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
#inboundView .in-ticks { display: inline-flex; }
#inboundView .in-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
#inboundView .msg.in .in-link { color: var(--brand-text); }
#inboundView .in-msg-skel { display: flex; flex-direction: column; gap: 10px; }
#inboundView .in-msg-skel .skel { height: 48px; width: 55%; border-radius: 14px; }
#inboundView .in-msg-skel .skel.out { align-self: flex-end; width: 45%; }

/* Composers (the engine switches them with style.display) */
#inboundView .in-composer[style*="none"] { display: none !important; }
#inboundView .in-composer .reply-row textarea { resize: none; height: 44px; padding: 11px 12px; line-height: 1.4; font: inherit; font-size: var(--fs-14); }
#inboundView .in-composer .reply-row .select { flex: 1; height: 44px; min-width: 0; font-size: var(--fs-13); }
#inboundView .in-send { height: 44px; flex: none; }
#inboundView .in-send:disabled { opacity: 0.6; }
#inboundView .in-expired-note { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); background: var(--warning-soft); color: var(--text); font-size: var(--fs-13); }
#inboundView .in-expired-note .ua-ic, #inboundView .in-expired-note svg { color: var(--warning); flex: none; margin-top: 2px; }

/* Convert modal: publisher choice as radio cards (forms-ui.css skins the fields) */
.in-convert .in-radio-cards { grid-template-columns: 1fr 1fr; }
.in-convert .radio-card { cursor: pointer; position: relative; }
.in-convert .radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.in-convert .radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.in-convert .radio-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--brand-soft-2); }
.in-convert .radio-card b { color: var(--text); font-weight: 600; }
.in-convert .in-gap { margin-top: var(--s-3); flex-direction: column; gap: var(--s-3); }
.in-convert .form-section h3 { margin: 0 0 var(--s-3); font-size: var(--fs-12); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }
.in-convert .modal-foot .btn-primary { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 900px) {
    #inboundView .inbox { grid-template-columns: 300px 1fr; }
    #inboundView .in-total { display: none; }
    #inboundView .in-seg button { padding: 0 7px; }
}
@media (max-width: 760px) {
    #inboundView .inbox { grid-template-columns: 1fr; }
    #inboundView .in-total { display: inline; }
    #inboundView .in-seg button { padding: 0 9px; }
    #inboundView .inbox-list { border-right: 0; }
    #inboundView .in-thread { display: none; }
    #inboundView.in-chat-open .inbox-list { display: none; }
    #inboundView.in-chat-open .in-thread { display: flex; }
    #inboundView .in-back { display: inline-flex; }
    #inboundView .thread-head { padding: 12px 16px; }
    #inboundView .in-who { flex-basis: calc(100% - 100px); }
    #inboundView .in-actions { width: 100%; margin-left: 0; }
    #inboundView .in-actions .select { flex: 1 1 100%; width: auto; }
    #inboundView .msgs { padding: 16px; }
    #inboundView .msg { max-width: 85%; }
    #inboundView .reply { padding: 12px 16px; }
    .in-convert .in-radio-cards, .in-convert .grid-2 { grid-template-columns: 1fr; }
}
