/* Inbox on a desktop: the topbar filters, search hits, the compose send and schedule menus, emoji picker,
   attachments and vCards, the composer, the conversation list, the row menu, the conversation and the linked-context
   cards. Split #7 of index.html: moved unchanged and linked at the exact spot it used to sit so the cascade order is
   the same. */
  /* DND icon button in thread header */
  .ia-icon-btn.dnd-on { background:rgba(239,68,68,0.1); border-color:rgba(239,68,68,0.35); color:#ef4444; }
  .ia-icon-btn.dnd-warn { background:rgba(239,68,68,0.1); border-color:rgba(239,68,68,0.35); color:#ef4444; }
  /* Inbox topbar — channel pills + filters */
  .inbox-channel-pills { display:flex; gap:4px; flex-wrap:wrap; }
  .inbox-pill { padding:6px 11px; border-radius:20px; border:1px solid rgba(255,255,255,0.18); background:rgba(255,255,255,0.06); color:rgba(255,255,255,0.85); font-size:11px; font-weight:600; cursor:pointer; font-family:inherit; display:inline-flex; align-items:center; gap:5px; transition:all 0.12s; }
  .inbox-pill:hover { background:rgba(255,255,255,0.12); color:#fff; }
  .inbox-pill.active { background:rgba(255,255,255,0.92); color:#1a2f5c; border-color:rgba(255,255,255,0.92); }
  .inbox-tb-select { background:rgba(255,255,255,0.06)!important; border-color:rgba(255,255,255,0.18)!important; color:rgba(255,255,255,0.95)!important; padding:0 24px 0 10px!important; }
  .inbox-fts-input { background:rgba(255,255,255,0.06)!important; border-color:rgba(255,255,255,0.18)!important; color:#fff!important; }
  .inbox-fts-input::placeholder { color:rgba(255,255,255,0.55); }
  .inbox-tb-btn {
    background: rgba(255,255,255,0.15) !important;
    border: 1px solid rgba(255,255,255,0.30) !important;
    color: #ffffff !important;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 2px 6px rgba(10,30,90,0.12) !important;
    border-radius: 999px;
  }
  .inbox-tb-btn:hover {
    background: rgba(255,255,255,0.25) !important;
    border-color: rgba(255,255,255,0.45) !important;
  }
  /* Search hits panel — message matches, listed under the contact matches */
  .fts-hits-list { padding:2px 0 6px; }
  .fts-hits-empty { padding:24px 16px; text-align:center; color:var(--text2); font-size:12px; }
  .fts-section-head {
    display:flex; align-items:baseline; justify-content:space-between; gap:8px;
    padding:9px 14px 5px; margin-top:2px;
    border-top:1px solid var(--border);
    font-size:10px; font-weight:700; letter-spacing:0.06em; text-transform:uppercase;
    color:var(--text3); background:var(--bg);
    position:sticky; top:0; z-index:1;
  }
  .fts-section-count { font-weight:600; letter-spacing:0; text-transform:none; color:var(--text3); }
  .fts-hit { padding:9px 14px; cursor:pointer; border-bottom:1px solid rgba(255,255,255,0.03); transition:background 0.1s; }
  .fts-hit:hover { background:rgba(99,102,241,0.08); }
  .fts-hit-name { font-size:12px; font-weight:600; color:var(--text); display:flex; justify-content:space-between; gap:6px; align-items:baseline; }
  .fts-hit-channel { font-size:9px; padding:1px 6px; border-radius:8px; background:var(--bg2); color:var(--text2); text-transform:uppercase; letter-spacing:0.04em; flex-shrink:0; }
  .fts-hit-snippet { font-size:11px; color:var(--text2); margin-top:3px; line-height:1.4; }
  .fts-hit-snippet mark { background:rgba(251,191,36,0.35); color:var(--text); padding:0 2px; border-radius:2px; }
  /* Schedule send dropdown */
  .compose-send-wrap { display:flex; align-items:stretch; }
  .compose-send-btn { border-radius:8px 0 0 8px; }
  .compose-send-arrow { padding:0 10px; border-radius:0 8px 8px 0; background:var(--accent); color:#fff; border:none; cursor:pointer; border-left:1px solid rgba(255,255,255,0.18); font-family:inherit; display:flex; align-items:center; }
  .compose-send-arrow:hover { opacity:0.88; }
  .schedule-pop { position:absolute; bottom:calc(100% + 6px); right:0; background:var(--bg); border:1px solid var(--border2); border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,0.18); z-index:90; min-width:200px; padding:4px 0; }
  .schedule-pop-item { padding:8px 14px; cursor:pointer; font-size:12px; color:var(--text); display:flex; justify-content:space-between; gap:8px; align-items:center; }
  .schedule-pop-item:hover { background:rgba(99,102,241,0.1); }
  .schedule-pop-item .when { color:var(--text2); font-size:11px; }
  /* Emoji picker (WhatsApp/native-style) */
  .emoji-pop { position:absolute; bottom:calc(100% + 6px); left:0; width:320px; max-width:92vw; height:340px; background:var(--bg); border:1px solid var(--border2); border-radius:12px; box-shadow:0 12px 32px rgba(0,0,0,0.22); z-index:95; display:flex; flex-direction:column; overflow:hidden; }
  .emoji-search-wrap { padding:8px; border-bottom:1px solid var(--border); }
  .emoji-search { width:100%; box-sizing:border-box; border:1px solid var(--border2); background:var(--bg2); color:var(--text); border-radius:8px; padding:7px 10px; font-size:13px; outline:none; font-family:inherit; }
  .emoji-search:focus { border-color:var(--accent); }
  .emoji-body { flex:1; overflow-y:auto; padding:4px 8px 8px; }
  .emoji-sec-label { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:var(--text3); padding:8px 2px 4px; position:sticky; top:0; background:var(--bg); box-shadow:0 -5px 0 var(--bg); }
  .emoji-grid { display:grid; grid-template-columns:repeat(8,1fr); gap:2px; }
  .emoji-cell { border:none; background:none; cursor:pointer; font-size:20px; line-height:1; padding:4px 0; border-radius:6px; transition:background 0.1s; }
  .emoji-cell:hover { background:var(--bg3); }
  .emoji-tabs { display:flex; border-top:1px solid var(--border); background:var(--bg2); }
  .emoji-tab { flex:1; border:none; background:none; cursor:pointer; font-size:16px; padding:7px 0; opacity:0.55; border-bottom:2px solid transparent; }
  .emoji-tab:hover { opacity:1; }
  .emoji-tab.active { opacity:1; border-bottom-color:var(--accent); }
  /* Scheduled banner above compose */
  .scheduled-banner { padding:8px 14px; background:rgba(251,191,36,0.08); border-top:1px solid rgba(251,191,36,0.2); border-bottom:1px solid rgba(251,191,36,0.2); font-size:12px; color:var(--text); display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .scheduled-banner .cancel { background:none; border:1px solid var(--border2); color:var(--text2); border-radius:6px; padding:3px 9px; font-size:11px; cursor:pointer; font-family:inherit; }
  .scheduled-banner .cancel:hover { color:#ef4444; border-color:rgba(239,68,68,0.4); }
  /* Attachment thumbs in message bubble */
  .msg-attachments { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
  .msg-attach { max-width:140px; max-height:140px; border-radius:8px; cursor:pointer; }
  .msg-attach.file { padding:6px 10px; background:rgba(255,255,255,0.06); border:1px solid var(--border2); font-size:11px; color:var(--text); display:flex; align-items:center; gap:6px; text-decoration:none; }
  /* An attachment that arrived and could not be saved — never a blank bubble. */
  .msg-attach.lost { flex:1 1 100%; min-width:230px; max-width:320px; padding:7px 10px; border-radius:8px; background:rgba(239,68,68,0.07); border:1px solid rgba(239,68,68,0.28); font-size:11px; color:var(--text); display:flex; align-items:flex-start; gap:6px; line-height:1.45; }
  .msg-attach.lost i { color:#dc2626; flex-shrink:0; margin-top:1px; }
  /* Download pill on an attachment tile. Same glass as the tab bar and the floating thread header. */
  .att-tile { position:relative; display:block; max-width:100%; }
  .att-tile.is-file { display:flex; }
  .att-tile.is-file > a { flex:1 1 auto; }
  .att-dl { position:absolute; z-index:2; display:inline-flex; align-items:center; justify-content:center; gap:4px;
    height:28px; padding:0 12px 0 8px; border-radius:22px; font:600 11px/1 'DM Sans',system-ui,sans-serif; letter-spacing:0; white-space:nowrap;
    color:var(--text); cursor:pointer; background:var(--c-head-glass); border:1px solid var(--border2);
    box-shadow:0 2px 12px rgba(24,24,27,.07); backdrop-filter:saturate(1.6) blur(18px); -webkit-backdrop-filter:saturate(1.6) blur(18px); }
  [data-theme="dark"] .att-dl { box-shadow:0 2px 12px rgba(0,0,0,.4); }
  .att-tile .att-dl { box-sizing:border-box; min-height:0; margin-bottom:0; }
  .att-dl svg { flex-shrink:0; }
  .att-tile.is-img .att-dl { left:50%; bottom:8px; transform:translateX(-50%); }
  .att-tile.is-file .att-dl { right:4px; top:50%; margin-top:-14px; }
  @media (hover:hover) and (pointer:fine) {
    .att-dl { opacity:0; pointer-events:none; transition:opacity .12s ease; }
    .att-tile:hover .att-dl, .att-tile:has(a:focus-visible) .att-dl, .att-dl:focus-visible { opacity:1; pointer-events:auto; }
    .att-dl:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
    /* File chip: the pill floats just above the chip's right edge, so it never covers the file name.
       While hovered, an invisible strip above the chip keeps the hover alive on the way to the pill. */
    .att-tile.is-file .att-dl { top:auto; bottom:calc(100% + 4px); right:0; margin-top:0; }
    .att-tile.is-file:hover::before { content:''; position:absolute; left:0; right:0; bottom:100%; height:36px; }
  }
  /* Touch: no hover, so a small always-visible icon in the corner; the 44px tap target is a transparent ::after. */
  @media (hover:none), (pointer:coarse) {
    .att-dl { width:28px; padding:0; }
    .att-dl .att-dl-t { display:none; }
    .att-dl::after { content:''; position:absolute; inset:-9px; }
    .att-tile.is-img .att-dl { left:auto; right:9px; bottom:9px; transform:none; }
    .att-tile.is-file > a { padding-right:40px; }
  }
  .msg-empty-note { color:var(--text2); font-style:italic; }
  /* A phone contact card, read out of the .vcf and shown in the thread. */
  .vcard-slot { display:block; }
  .vcard-card { margin-top:6px; padding:10px 12px; border:1px solid var(--border2); border-left:3px solid var(--accent); border-radius:12px; background:var(--bg2); min-width:238px; max-width:300px; }
  .vcard-kicker { font-size:9.5px; font-weight:700; color:var(--text2); text-transform:uppercase; letter-spacing:0.07em; display:flex; align-items:center; gap:5px; margin-bottom:5px; }
  .vcard-kicker i { width:11px; height:11px; color:var(--accent); }
  .vcard-name { font-size:13px; font-weight:700; color:var(--text); line-height:1.3; }
  .vcard-org { font-size:11px; color:var(--text2); margin-top:1px; }
  .vcard-rows { margin:7px 0 0; display:flex; flex-direction:column; gap:2px; }
  .vcard-row { display:flex; justify-content:space-between; gap:10px; font-size:11.5px; }
  .vcard-lbl { color:var(--text2); }
  .vcard-num { font-weight:600; color:var(--text); }
  .vcard-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:9px; }
  .vcard-btn { display:inline-flex; align-items:center; gap:5px; padding:5px 9px; border:1px solid var(--border2); border-radius:8px; background:transparent; color:var(--text2); font-size:11px; font-weight:600; font-family:inherit; cursor:pointer; }
  .vcard-btn i { width:12px; height:12px; }
  .vcard-btn:hover { color:var(--text); border-color:var(--text2); }
  .vcard-btn.primary { border-color:var(--accent); background:rgba(37,99,235,0.08); color:var(--accent); }
  .vcard-btn.primary:hover { background:var(--accent); color:#fff; }
  /* Linked context cards in detail panel */
  .ir-linked-card { position:relative; margin:10px 12px; padding:11px 13px; border:1px solid var(--border2); border-left:3px solid var(--accent); border-radius:12px; background:var(--bg2); box-shadow:0 1px 3px rgba(16,24,40,0.06); }
  .ir-linked-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px 8px; margin-bottom:9px; }
  .ir-linked-title { font-size:10px; font-weight:700; color:var(--text2); text-transform:uppercase; letter-spacing:0.07em; display:flex; align-items:center; gap:5px; }
  .ir-linked-title i { color:var(--accent); width:12px; height:12px; }
  .ir-linked-stage { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:20px; font-size:10.5px; font-weight:700; line-height:1.35; white-space:nowrap; background:var(--st-bg,rgba(37,99,235,0.10)); color:var(--st,var(--accent)); }
  .ir-linked-stage::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0; }
  /* .ir-linked-rows / .ir-linked-row went with the Contact panel's old linked-
     application card, which is now an ordinary grey Application section. The
     rules above still dress the Showings card, which is a different feature. */
  .ir-linked-open { display:flex; align-items:center; justify-content:center; gap:6px; width:100%; padding:8px; border:1px solid var(--accent); border-radius:8px; background:rgba(37,99,235,0.08); color:var(--accent); font-size:11.5px; font-weight:600; cursor:pointer; font-family:inherit; transition:background .12s ease, color .12s ease, transform .08s ease; }
  .ir-linked-open:hover { background:var(--accent); color:#fff; }
  .ir-linked-open:active { transform:scale(.985); }
  .ir-show-row { padding:6px 0; border-top:1px solid rgba(255,255,255,0.04); display:flex; justify-content:space-between; gap:8px; align-items:center; font-size:12px; }
  .ir-show-row:first-child { border-top:none; }
  .ir-show-row .show-when { color:var(--text2); font-size:11px; }
  /* Draft-reply button in compose toolbar */
  .compose-draft-btn { display:inline-flex; align-items:center; gap:5px; padding:5px 10px; border:1px solid var(--border2); background:var(--bg2); color:var(--text); border-radius:14px; font-size:11px; font-weight:600; font-family:inherit; cursor:pointer; transition:all 0.12s; }
  .compose-draft-btn:hover { background:rgba(99,102,241,0.12); border-color:rgba(99,102,241,0.4); color:var(--accent); }
  .compose-draft-btn:disabled { opacity:0.5; cursor:wait; }
  /* ───────── GHL-style composer ───────── */
  /* Channel dropdown — base styling so it works on desktop too (mobile block also styles it). */
  .inbox-compose-menu { position:fixed; z-index:1300; background:var(--bg); border:1px solid var(--border2); border-radius:12px; box-shadow:0 10px 30px rgba(0,0,0,0.22); padding:6px; min-width:170px; display:flex; flex-direction:column; }
  .inbox-compose-menu button { display:flex; align-items:center; gap:10px; padding:9px 12px; border:none; background:none; color:var(--text); font-size:13px; font-family:inherit; cursor:pointer; border-radius:8px; text-align:left; }
  .inbox-compose-menu button:hover { background:var(--bg2); }
  .inbox-compose-menu button.active { color:var(--accent); background:var(--accent-soft); }
  .inbox-compose-menu button svg { width:16px; height:16px; flex-shrink:0; }
  /* New GHL pieces are hidden by default; the >=769px block reveals them (mobile keeps its own bar). */
  .compose-ghl-head, .compose-foot { display:none; }
  @media (min-width:769px) {
    .compose-mode-tabs { display:none; }                       /* replaced by the GHL header */
    .compose-ghl-head { display:flex; align-items:center; gap:10px; min-height:36px; padding:0 14px; background:var(--accent-soft); border-bottom:1px solid var(--border2); overflow:hidden; }
    .compose-ch-pill { display:inline-flex; align-items:center; gap:6px; padding:5px 10px; border-radius:8px; background:var(--bg); border:1px solid var(--border2); color:var(--accent); font-size:11px; font-weight:700; font-family:inherit; cursor:pointer; white-space:nowrap; flex-shrink:0; }
    .compose-ch-pill svg { width:15px; height:15px; }
    .compose-ch-pill .cgh-caret { width:13px; height:13px; opacity:0.85; }
    .cgh-div { width:1px; height:18px; background:var(--border2); flex-shrink:0; }
    .compose-internal-toggle { display:inline-flex; align-items:center; gap:6px; padding:5px 8px; border:none; background:none; color:var(--text2); font-size:11px; font-weight:600; font-family:inherit; cursor:pointer; border-radius:8px; white-space:nowrap; }
    .compose-ghl-head .compose-internal-toggle .ci-label { font-size:11px; }
    .compose-internal-toggle svg { width:15px; height:15px; }
    .compose-internal-toggle:hover { color:var(--text); background:var(--bg); }
    .compose-internal-toggle.active { color:#b45309; background:rgba(251,191,36,0.18); }
    .cgh-spacer { flex:1; }
    .cgh-icon { width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center; border:none; background:none; color:var(--text3); border-radius:7px; cursor:pointer; }
    .cgh-icon svg { width:16px; height:16px; }
    .cgh-icon:hover { color:var(--text); background:var(--bg); }
    /* From / To row — bold labels + divider */
    .compose-from-row { gap:0; align-items:center; min-height:36px; padding:0 14px; }
    .compose-from-row .cfr-cell { padding:0 16px; display:inline-flex; align-items:center; white-space:nowrap; }
    .compose-from-row .cfr-cell:first-child { padding-left:0; }
    .compose-from-row .cfr-cell + .cfr-cell { border-left:1px solid var(--border2); }
    .compose-from-row b { color:var(--text); font-weight:700; }
    /* Toolbar — clean gray icon row */
    .compose-toolbar { padding:8px 12px 6px; }
    .compose-tool-btn { width:32px; height:32px; color:var(--text3); }
    .compose-tool-btn:hover { background:var(--bg2); color:var(--text); }
    .compose-tool-btn svg { width:16px; height:16px; }
    /* Send — light periwinkle split button, paper-plane only */
    .compose-send-wrap { border-radius:9px; overflow:hidden; }
    .compose-send-btn { background:var(--accent-soft); color:var(--accent); border-radius:9px 0 0 9px; padding:8px 13px; }
    .compose-send-btn .csb-label { display:none; }
    .compose-send-btn svg { width:18px; height:18px; }
    .compose-send-arrow { background:var(--accent-soft); color:var(--accent); border-left:1px solid rgba(37,99,235,0.22); padding:0 8px; }
    .compose-send-btn:hover, .compose-send-arrow:hover { background:rgba(37,99,235,0.18); opacity:1; }
    /* Chars / Segs footer */
    .compose-foot { display:flex; justify-content:flex-end; padding:0 14px 8px; }
    .compose-foot .compose-char-count { font-size:11px; color:var(--text3); }
    /* Minimize / expand */
    .inbox-compose.compose-expanded .compose-ta { min-height:200px; }
    .inbox-compose.compose-minimized .compose-from-row,
    .inbox-compose.compose-minimized .compose-body,
    .inbox-compose.compose-minimized .compose-staged,
    .inbox-compose.compose-minimized .compose-toolbar,
    .inbox-compose.compose-minimized .compose-foot { display:none; }
  }
  [data-theme="dark"] .compose-ghl-head { background:rgba(79,139,232,0.10); }

  /* The composer opened on a hard line: a 1px rule, a bright inset highlight and a
     flat blue slab all landing on the same row, which cut the thread off at the
     bottom the way the column borders used to cut it off at the sides. It now rises
     out of the thread instead — the surface starts on the thread's own bottom tone
     and settles into the composer's over the first 52px, and the blue tint is now a soft
     patch that fades on every side rather than a slab with four hard edges. Placed here because the base
     rules for both live earlier (one of them inside the >=769px block), and a
     `background` shorthand would otherwise win. */
  .inbox-compose { border-top-color:transparent;
    background:linear-gradient(180deg, var(--bg2) 0%, var(--bg) 52px, var(--bg) 100%); }
  [data-theme="dark"] .inbox-compose { border-top-color:transparent; box-shadow:none;
    background:linear-gradient(180deg, #0c1624 0%, #0e1828 52px, #0c1523 100%); }
  /* The tint is painted on a pseudo-element so it can be MASKED on all four sides.
     A masked element takes its children with it, and the channel pill sits at the far
     left of this row — it would fade out with the tint. Two mask layers combined with
     `intersect` multiply, giving one soft patch with no edge anywhere; stacked
     background gradients can only add, which is why the tint alone can't do this. */
  .compose-ghl-head { position:relative; z-index:0; background:none; border-bottom-color:transparent; }
  .compose-ghl-head::before {
    content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
    background:var(--accent-soft);
    -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 150px, #000 calc(100% - 150px), transparent 100%), linear-gradient(180deg, transparent 0, #000 50%, transparent 100%);
    -webkit-mask-composite:source-in;
    mask-image:linear-gradient(90deg, transparent 0, #000 150px, #000 calc(100% - 150px), transparent 100%), linear-gradient(180deg, transparent 0, #000 50%, transparent 100%);
    mask-composite:intersect;
  }
  /* The dark twin needs its own `background:none` — the flat tint it replaces is set
     at [data-theme="dark"] .compose-ghl-head, which out-specifies a bare class. */
  [data-theme="dark"] .compose-ghl-head { background:none; }
  [data-theme="dark"] .compose-ghl-head::before { background:rgba(79,139,232,0.16); }
  [data-theme="dark"] .compose-ch-pill { background:var(--bg3); }
  /* Narrow desktop / small preview pane: the 3-pane inbox squeezes the composer,
     so collapse the header to icons (eye-only Internal Comment, no min/expand)
     rather than letting it wrap. */
  @media (min-width:769px) and (max-width:1180px) {
    .compose-internal-toggle .ci-label { display:none; }
    .compose-ghl-head .cgh-icon { display:none; }
  }

  /* ══════════════════════════════════════════════════════════════════════════
     INBOX REFRESH — docs/design_handoff_inbox_refresh
     A desktop-only polish pass on Conversations: one page background, pill
     filters, a floating frosted thread header, in-bubble timestamps, a Telegram
     style composer that sits on the thread, and a contact panel that starts
     closed. Everything here is wrapped in @media (min-width:769px) or scoped to
     a class the mobile layout never sees — the phone inbox was designed
     separately and must stay exactly as it is.
     This block sits last on purpose: several rules below tie on specificity with
     the originals above, so source order is the only thing deciding them.
     ══════════════════════════════════════════════════════════════════════════ */
  @media (min-width:769px) {
    /* ── Global layout (G1) ───────────────────────────────────────────────────
       One page surface. The old inbox-only canvas — a tiled SVG shapes pattern
       plus a white ramp down each side — is gone, so Conversations sits on the
       same --bg2 as every other page. `background-image:none` is what retires
       it: the canvas is declared as a background-image stack further up, at a
       specificity a bare class here would otherwise lose to in dark mode. */
    .inbox-layout { padding:12px; gap:12px; background:var(--bg2); background-image:none; }
    /* The gradient header takes the shared .topbar.lp-page-header geometry
       (22px side inset, 10px from the top, 14px corners) like every other page.
       No Inbox-only margin here: a narrower inset made the Conversations header
       read wider than Calendar's (Reuven, 27 Nov). */
    [data-theme="dark"] .inbox-layout { background:var(--bg2); background-image:none; }
    .inbox-left, [data-theme="dark"] .inbox-left,
    .inbox-right, [data-theme="dark"] .inbox-right { background-image:none; }
    /* The whole column sits on the warm base, header included — the search and
       filter pills are part of the conversations list, not a separate surface
       floating above it. The list below carries the same tone, so the column
       reads as one sheet from the title down. */
    .inbox-left { background:var(--bg2); border-radius:12px 0 0 12px; border-color:transparent; box-shadow:none; width:300px; }
    [data-theme="dark"] .inbox-left { background:var(--bg2); border-color:transparent; box-shadow:none; }
    .inbox-right { background:var(--bg2); border-radius:0 12px 12px 0; border-color:transparent; box-shadow:none; }
    [data-theme="dark"] .inbox-right { background:var(--bg2); border-color:transparent; box-shadow:none; }

    /* ── 1. Conversation list ─────────────────────────────────────────────── */
    .inbox-left-header { padding:12px; border-bottom:none; }
    [data-theme="dark"] .inbox-left-header { border-bottom:none; }
    .inbox-search-wrap { padding:8px 12px 12px; }
    .inbox-search-icon { left:24px; }
    .inbox-contact-list { border-top:1px solid var(--f-row-bd); }

    /* Filter pills replace the underlined tab row. Snoozed, Automated and
       Assigned-to-me moved into the topbar ⋮ menu, so only four pills remain. */
    .inbox-filter-tabs { border-bottom:none; padding:8px 12px 0; gap:4px; }
    [data-theme="dark"] .inbox-filter-tabs { border-bottom:none; }
    .inbox-filter-tab {
      height:30px; padding:0 10px; border-radius:15px; border:1px solid var(--f-pill-bd);
      font-size:12.5px; font-weight:600; color:var(--text2); gap:4px;
    }
    .inbox-filter-tab:hover { background:var(--f-pill-hover); color:var(--text); }
    .inbox-filter-tab.active {
      background:var(--f-pill-on-bg); border-color:var(--f-pill-on-bd); color:var(--f-pill-on-fg);
    }
    /* The tab row's underline marker has no place on a filled pill. */
    .inbox-filter-tab.active::after { display:none; }
    /* The count rides inside the pill as plain text, not a blue chip. */
    .inbox-filter-tab .inbox-tab-badge {
      min-width:0; height:auto; padding:0; border-radius:0;
      background:none; color:var(--text2); font-size:12px; font-weight:500;
    }
    .inbox-filter-tab.active .inbox-tab-badge { color:var(--f-pill-on-fg); }
    /* These four live in the ⋮ filter menu now. */
    .inbox-filter-tabs .im-tab-snoozed,
    .inbox-filter-tabs .im-tab-automated,
    .inbox-filter-tabs .im-tab-mine { display:none; }
    /* The pills stay on ONE row that scrolls sideways (Reuven, 27 Nov 2026: "this
       used to be scrollable ... revert the changes ... where it shows as a list
       wrapped"). Do not make them wrap. */

    /* Rows. A selected row is a frosted blue card inset from the list edges, so
       the hairline separators of the rows around it read as one list. */
    .contact-item { padding:10px 12px; border-bottom:1px solid var(--f-row-bd); }
    [data-theme="dark"] .contact-item { border-bottom-color:var(--f-row-bd); }
    .contact-item.active,
    [data-theme="dark"] .contact-item.active {
      margin:4px 6px; padding:8px; border-radius:8px; border-bottom-color:transparent;
      background:var(--f-active-bg); box-shadow:inset 0 0 0 1px var(--f-active-bd);
    }
    /* Avatars are a soft wash of the brand blue with blue initials, not a solid
       blue tile with white ones — the same treatment the phone inbox already
       uses, so the two finally match. Dark mode was already this; only light
       changes. */
    .c-avatar, .thread-avatar, .ir-avatar { background:var(--f-av-bg); color:var(--f-av-fg); }
    .c-avatar { width:36px; height:36px; border-radius:8px; }
    /* Pace's row is a conversation like any other, so its avatar drops the solid
       indigo gradient too. The base rule carries !important (the mobile block sets
       .thread-avatar's background that way), so this has to as well. */
    .c-avatar.pace-av:not(.pace-av-orb) { background:var(--f-av-bg) !important; color:var(--f-av-fg) !important; }
    .c-name { font-size:13px; font-weight:500; }
    .contact-item.unread .c-name { font-weight:600; }
    .c-preview { font-size:12px; }
    .c-time { font-size:11px; }
    .contact-item.unread .c-time { color:var(--accent); font-weight:600; }
    .c-unread-badge { background:var(--f-fill); }
    /* R7 — a text that never arrived says so on the row itself. */
    .c-preview .c-undelivered {
      display:inline-flex; align-items:center; gap:4px; color:var(--f-danger); font-weight:600;
    }
    .c-preview .c-undelivered svg { width:11px; height:11px; flex-shrink:0; }
  }

  /* A11 — right-click a conversation. Same frosted menu family as the thread ⋯
     menu, and it works at every width (a trackpad two-finger click is not a
     desktop-only gesture), so it is deliberately outside the media query. */
  .inbox-row-menu {
    position:fixed; z-index:1350; width:196px; padding:5px; border-radius:10px;
    background:var(--f-menu-bg); box-shadow:var(--f-menu-sh);
    backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
    display:flex; flex-direction:column;
  }
  .inbox-row-menu button {
    display:flex; align-items:center; gap:9px; height:32px; padding:0 9px; border-radius:6px;
    border:none; background:none; font:inherit; font-size:13px; color:var(--text);
    cursor:pointer; text-align:left; white-space:nowrap;
  }
  .inbox-row-menu button:hover { background:var(--bg3); }
  .inbox-row-menu button svg { width:15px; height:15px; flex-shrink:0; color:var(--text2); }
  .inbox-row-menu .irm-div { height:1px; margin:4px 8px; background:var(--border2); }
  .contact-item.row-menu-open { box-shadow:inset 0 0 0 2px var(--f-fill); }


  /* ── 2. Conversation ──────────────────────────────────────────────────────
     The centre column is one surface with the thread painted on it. The header
     floats over the messages as two frosted pills (Telegram), the composer sits
     on the same surface with no panel of its own, and the messages scroll
     underneath both. */
  @media (min-width:769px) {
    .inbox-center {
      position:relative; isolation:isolate; border-radius:0;
      background:var(--c-thread-base);
    }
    /* The illustrated tile. A pseudo-element rather than a background layer on the
       thread itself: it has to sit BEHIND the messages and hold still while they
       scroll, and it needs mix-blend-mode, which a background layer cannot carry
       on its own. The two masks are intersected so the art fades under the header
       and above the composer AND at both side edges — one mask can only do one
       axis. It is pure decoration, so it takes no pointer events and switches off
       entirely when the viewer asks for less transparency. */
    .inbox-center::before {
      content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
      background-image:url("assets/chat-pattern.jpg");
      background-size:440px 440px; background-repeat:repeat;
      opacity:var(--c-pat-op); filter:var(--c-pat-filter); mix-blend-mode:var(--c-pat-blend);
      -webkit-mask-image:linear-gradient(180deg,#000 0,#000 calc(100% - 60px),transparent 100%),
        linear-gradient(90deg,transparent 0,#000 120px,#000 calc(100% - 120px),transparent 100%);
      -webkit-mask-composite:source-in;
      mask-image:linear-gradient(180deg,#000 0,#000 calc(100% - 60px),transparent 100%),
        linear-gradient(90deg,transparent 0,#000 120px,#000 calc(100% - 120px),transparent 100%);
      mask-composite:intersect;
    }
    @media (prefers-reduced-transparency: reduce) {
      .inbox-center::before { display:none; }
    }

    /* Header — two frosted pills floating over the thread. */
    .inbox-thread-header {
      position:absolute; top:10px; left:12px; right:12px; z-index:4;
      padding:0; gap:8px; background:none; background-image:none; border-bottom:none; box-shadow:none;
    }
    [data-theme="dark"] .inbox-thread-header {
      background:none; background-image:none; border-bottom:none; box-shadow:none;
    }
    .thread-pill {
      height:48px; border-radius:24px; background:var(--c-head-glass);
      border:1px solid var(--border2); box-shadow:0 2px 12px rgba(24,24,27,0.07);
      backdrop-filter:saturate(1.6) blur(18px); -webkit-backdrop-filter:saturate(1.6) blur(18px);
      display:flex; align-items:center;
    }
    .thread-pill-left { flex:1; min-width:0; gap:10px; padding:0 18px 0 8px; }
    .thread-pill-right { flex-shrink:0; gap:4px; padding:0 8px; }
    .inbox-thread-header .thread-avatar { width:32px; height:32px; border-radius:8px; font-size:12px; }
    /* The ONE round avatar in the app (design_handoff_tool_panels). Everywhere
       else stays a rounded square — a circle was denied for lists and panels,
       and the exception is this single 34px pill. */
    .lp-panels-v2 .inbox-thread-header .thread-avatar { width:34px; height:34px; border-radius:50%; font-size:12.5px; }
    .lp-panels-v2 .inbox-thread-header .thread-name { font-size:14.5px; font-weight:600; }
    /* "Pace is replying" sits right on the pill rather than inline after the
       channel, so the row reads name | channel ............ state. */
    .lp-panels-v2 .inbox-thread-header .thread-pace-state {
      margin-left:auto; flex-shrink:0; display:inline-flex; align-items:center; gap:6px;
      height:24px; padding:0 10px; border-radius:12px;
      background:var(--accent-soft); color:var(--accent);
      font-size:11.5px; font-weight:600; line-height:1; white-space:nowrap;
    }
    .lp-panels-v2 .inbox-thread-header .thread-pace-state svg { display:none; }
    /* Taken-over is the same pill in grey: it is a state, not an alert. */
    .lp-panels-v2 .inbox-thread-header .thread-pace-state.thread-pace-off {
      background:var(--bg3); color:var(--text2);
    }
    .lp-panels-v2 .inbox-thread-header .thread-pace-state::before {
      content:''; width:6px; height:6px; border-radius:50%; background:currentColor; flex-shrink:0;
    }
    .lp-panels-v2 .inbox-thread-header .thread-sub { gap:6px; }
    /* The pill can only sit right if the name/status column actually fills the
       pill — left to itself the flex item shrinks to its text. */
    .lp-panels-v2 .inbox-thread-header .thread-id { flex:1 1 auto; min-width:0; }
    /* ONE row: name, then the channel beside it, then the Pace pill pushed to
       the far right. Stacking the channel under the name made a 34px avatar sit
       beside two lines of 12px text, which reads as a cramped two-line card
       rather than a header. */
    .lp-panels-v2 .inbox-thread-header .thread-id-row {
      display:flex; align-items:center; gap:10px; width:100%;
    }
    /* Follow-up (26 Nov): the name clips with an ellipsis instead of spilling
       into the channel chip, so "(555) 010-4860" never touches "SMS". */
    .lp-panels-v2 .inbox-thread-header .thread-id-row .thread-name { flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; }
    .lp-panels-v2 .inbox-thread-header .thread-id-row .thread-sub {
      flex:1 0 auto; min-width:0; margin-top:0;
    }
    .inbox-thread-header .thread-name {
      font-size:15px; font-weight:600; letter-spacing:-0.01em; white-space:nowrap; cursor:copy;
    }
    .inbox-thread-header .thread-sub {
      font-size:11.5px; line-height:15px; color:var(--text2); margin-top:1px;
      white-space:nowrap; display:flex; align-items:center; gap:5px;
    }
    .inbox-thread-header .thread-sub svg { width:12px; height:12px; flex-shrink:0; }
    .thread-pace-state { display:inline-flex; align-items:center; gap:4px; color:var(--accent); font-weight:500; }
    /* 32px borderless circles. The 7px spacer between them is the only thing
       separating More from the panel toggle — a divider line read as a third
       control on a pill this small. */
    .thread-circ-btn {
      width:32px; height:32px; border-radius:50%; border:none; background:none;
      color:var(--text2); cursor:pointer; padding:0; flex-shrink:0;
      display:flex; align-items:center; justify-content:center;
    }
    .thread-circ-btn:hover { background:var(--bg3); color:var(--text); }
    .thread-circ-btn svg { width:15px; height:15px; }
    .thread-circ-btn.is-on { color:var(--accent); background:var(--accent-soft); }
    .thread-circ-gap { width:1px; height:18px; margin:0 3px; flex-shrink:0; }
    /* Take over, Call, SMS, Email, DND and Star all moved into the ⋯ menu, and the
       stage tag and Assign moved into the contact panel — the header is a name, a
       status line and two controls now. */
    .inbox-thread-header .inbox-action-btns { display:none; }

    /* ⋯ menu. Anchored under its button and right-aligned, with the gap bridged by
       padding rather than margin so the pointer never leaves the hover area on the
       way down to it. */
    .thread-more-wrap { position:relative; display:flex; }
    .thread-more-menu { position:absolute; top:100%; right:-8px; padding-top:10px; z-index:9; }
    .thread-more-menu-inner {
      width:236px; padding:5px; border-radius:12px; background:var(--f-menu-bg);
      box-shadow:var(--f-menu-sh); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
      display:flex; flex-direction:column;
    }
    .thread-more-menu button {
      display:flex; align-items:center; gap:9px; height:32px; padding:0 9px; border-radius:6px;
      border:none; background:none; font:inherit; font-size:13px; color:var(--text);
      cursor:pointer; text-align:left; white-space:nowrap;
    }
    .thread-more-menu button:hover { background:var(--bg3); }
    .thread-more-menu button svg { width:15px; height:15px; flex-shrink:0; color:var(--text2); }
    .thread-more-menu button.primary { color:var(--accent); font-weight:600; }
    .thread-more-menu button.primary svg { color:var(--accent); }
    .thread-more-menu .tmm-div { height:1px; margin:4px 8px; background:var(--border2); }

    /* Thread. The top padding is what clears the floating header; the messages
       genuinely scroll under it rather than starting below it. */
    .inbox-thread-body,
    .inbox-thread-body.thread-canvas,
    [data-theme="dark"] .inbox-thread-body,
    [data-theme="dark"] .inbox-thread-body.thread-canvas {
      padding:74px 16px 16px; gap:10px; background:none; background-image:none;
    }
    /* UI fix #18 (26 Nov 2026): the floating header no longer sits on top of a
       date pill (or any text). Whatever scrolls up under the header fades out
       just below it, and the pinned date (.thread-date-pin) takes over from the
       inline one at the same spot. The mask's colour is irrelevant, only its
       opacity is read, so any opaque token does. */
    .inbox-thread-body.thread-canvas {
      -webkit-mask-image:linear-gradient(to bottom, transparent 0, transparent 60px, var(--text) 74px);
              mask-image:linear-gradient(to bottom, transparent 0, transparent 60px, var(--text) 74px);
    }
    /* With a pending-tour card the body starts below the card, out from under the header. */
    .inbox-center.has-ptour .inbox-thread-body.thread-canvas {
      -webkit-mask-image:linear-gradient(to bottom, transparent 0, var(--text) 12px);
              mask-image:linear-gradient(to bottom, transparent 0, var(--text) 12px);
    }
    .msg-date-div { font-size:11px; font-weight:500; border-radius:20px; padding:3px 12px; }
    /* F4 — the day you are reading, pinned while you scroll. A copy of the inline
       pill, so nothing about it needs learning. */
    .thread-date-pin {
      position:absolute; top:70px; left:50%; transform:translateX(-50%); z-index:3;
      font-size:11px; font-weight:500; color:var(--text2);
      background:var(--c-date-bg); border:1px solid var(--c-date-bd); border-radius:20px;
      padding:3px 12px; white-space:nowrap; box-shadow:0 2px 8px rgba(24,24,27,0.10);
      backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
      opacity:0; transition:opacity 0.3s ease; pointer-events:none;
    }
    .thread-date-pin.on { opacity:1; }
    /* The inline pill the pin is copying steps aside while the pin shows (see
       inboxThreadScrolled), so only one date is ever on screen. */
    .msg-date-div.under-pin { visibility:hidden; }

    /* Bubbles. `display:flow-root` is what lets the floated timestamp sit on the
       last line of text and still be contained by the bubble. */
    .msg-bubble { padding:8px 12px 7px 13px; border-radius:18px; line-height:1.5; display:flow-root; }
    .msg-wrap { max-width:72%; }
    .msg-wrap.in .msg-bubble { background:var(--c-in-bg); border-color:var(--c-in-bd); box-shadow:var(--c-in-sh); }
    .msg-wrap.out .msg-bubble { background:var(--c-out-bg); box-shadow:var(--c-out-sh); }
    /* F1 — time, channel and delivery live INSIDE the bubble, floated to the end of
       the text. The meta line that used to sit above every bubble is gone. */
    .msg-channel-badge { display:none; }
    .msg-imeta {
      float:right; display:inline-flex; align-items:center; gap:3px;
      margin:5px 0 -4px 10px; font-size:10px; line-height:14px; white-space:nowrap;
      color:var(--text2);
    }
    .msg-imeta svg { width:10px; height:10px; flex-shrink:0; }
    .msg-imeta .mim-ticks svg { width:13px; height:13px; }
    .msg-wrap.out .msg-imeta { color:rgba(255,255,255,0.85); }
    .msg-imeta .mim-bad { color:#fecaca; font-weight:700; }
    .msg-wrap.in .msg-imeta .mim-bad { color:var(--f-danger); }
    /* A failed send's reason ("Not delivered — number not registered…") is too long
       for one nowrap line: it ran past the bubble's edge. Here the meta becomes its
       own full-width row, the time stays on the right and the reason wraps under it,
       so the bubble grows to hold all of it. Inside the pink failed bubble the
       white-on-blue meta colours were unreadable, so it takes the bubble's own text colour. */
    .msg-imeta.msg-imeta-fail {
      float:none; display:flex; flex-wrap:wrap; justify-content:flex-end; align-items:center;
      margin:4px 0 -2px; white-space:normal; text-align:right;
    }
    .msg-imeta.msg-imeta-fail .mim-bad { flex:1 1 100%; white-space:normal; overflow-wrap:anywhere; }
    .msg-wrap.out .msg-bubble.msg-failed .msg-imeta,
    .msg-wrap.out .msg-bubble.msg-failed .msg-imeta .mim-bad { color:inherit; }
    /* F2— a run from the same sender inside five minutes sits 4px apart, and only
       the last bubble of the run keeps its tail corner. */
    .msg-wrap.msg-grouped { margin-top:-6px; }
    .msg-wrap.in.msg-mid .msg-bubble { border-bottom-left-radius:18px; }
    .msg-wrap.in.msg-grouped .msg-bubble { border-top-left-radius:4px; }
    .msg-wrap.out.msg-mid .msg-bubble { border-bottom-right-radius:18px; }
    .msg-wrap.out.msg-grouped .msg-bubble { border-top-right-radius:4px; }
    /* Pace's 24px marker beside an outbound bubble. */
    .msg-row { align-items:flex-end; }

    /* Hover actions beside a bubble (WhatsApp-style). The bar is always laid out but invisible, and a hover on the
       bubble OR on the bar itself (the bar is inside the bubble) shows it. Two things keep it from vanishing as the
       pointer travels to it: a transparent ::before bridges the 8px gap between bubble and bar, and hiding is
       delayed (visibility waits .3s) so a diagonal or hesitant move still lands on it. It closes only after the
       pointer has left both. */
    .msg-hover-bar {
      position:absolute; top:50%; transform:translateY(-50%); display:flex; gap:1px; padding:2px;
      border-radius:8px; background:var(--bg); border:1px solid var(--border2);
      box-shadow:0 4px 12px rgba(24,24,27,0.12); z-index:20;
      opacity:0; visibility:hidden; pointer-events:none;
      transition:opacity .12s ease, visibility 0s linear .3s;
    }
    .msg-hover-bar::before { content:''; position:absolute; top:-8px; bottom:-8px; width:16px; }
    .msg-wrap.in .msg-hover-bar { left:calc(100% + 8px); }
    .msg-wrap.out .msg-hover-bar { right:calc(100% + 8px); }
    .msg-wrap.in .msg-hover-bar::before { right:100%; }
    .msg-wrap.out .msg-hover-bar::before { left:100%; }
    .msg-bubble:hover .msg-hover-bar, .msg-hover-bar:hover, .msg-hover-bar:focus-within {
      opacity:1; visibility:visible; pointer-events:auto; transition:opacity .12s ease, visibility 0s;
    }
    .msg-hover-bar button {
      width:26px; height:26px; border-radius:6px; border:none; background:none; padding:0;
      color:var(--text2); cursor:pointer; display:flex; align-items:center; justify-content:center;
    }
    .msg-hover-bar button:hover { background:var(--bg3); color:var(--text); }
    .msg-hover-bar button svg { width:14px; height:14px; }
    /* The tapback picker no longer appears on hover of its own — it is the "React"
       item in the More menu, which sets display inline and so still wins. Two
       toolbars fighting for the same hover was the state this replaces. */
    .msg-wrap:hover .msg-react-bar { display:none; }

    /* Search in conversation. It sits under the floating header, on the thread, and
       only ever appears while it is being used. */
    .thread-find {
      position:absolute; top:66px; left:12px; right:12px; z-index:7;
      height:38px; padding:0 6px 0 12px; border-radius:19px;
      display:flex; align-items:center; gap:6px;
      background:var(--c-head-glass); border:1px solid var(--border2);
      box-shadow:0 2px 12px rgba(24,24,27,0.10);
      backdrop-filter:saturate(1.6) blur(18px); -webkit-backdrop-filter:saturate(1.6) blur(18px);
    }
    .thread-find > svg { width:14px; height:14px; flex-shrink:0; color:var(--text2); }
    .thread-find input {
      flex:1; min-width:0; border:none; outline:none; background:none;
      font-family:inherit; font-size:13px; color:var(--text);
    }
    .thread-find input::-webkit-search-cancel-button { display:none; }
    .thread-find .tf-count { font-size:11.5px; color:var(--text2); white-space:nowrap; flex-shrink:0; }
    .thread-find .tf-btn {
      width:26px; height:26px; border-radius:50%; border:none; background:none; padding:0; flex-shrink:0;
      display:flex; align-items:center; justify-content:center; color:var(--text2); cursor:pointer;
    }
    .thread-find .tf-btn:hover { background:var(--bg3); color:var(--text); }
    .thread-find .tf-btn svg { width:14px; height:14px; }
    /* Every match is tinted; the one you are on is outlined as well, so stepping
       through them reads as movement rather than the same highlight twice. */
    .msg-wrap.find-hit .msg-bubble { box-shadow:0 0 0 2px rgba(245,158,11,0.45); }
    .msg-wrap.find-on .msg-bubble { box-shadow:0 0 0 2px #f59e0b, 0 4px 14px rgba(245,158,11,0.25); }

    /* "↓ N new" — sits just above the composer, not on top of it. */
    .thread-jump-pill {
      position:absolute; right:20px; bottom:124px; z-index:6;
      display:none; align-items:center; gap:6px; height:32px; padding:0 12px 0 10px;
      border-radius:16px; background:var(--bg); border:1px solid var(--border2);
      box-shadow:0 4px 14px rgba(24,24,27,0.14); color:var(--text);
      font-family:inherit; font-size:12px; font-weight:600; line-height:1; white-space:nowrap; cursor:pointer;
    }
    .thread-jump-pill.on { display:flex; }
    .thread-jump-pill svg { width:14px; height:14px; }
    .thread-jump-pill .tjp-dot { width:6px; height:6px; border-radius:50%; background:var(--accent); }

    /* Drag a file anywhere on the conversation to attach it. */
    .thread-drop-veil {
      position:absolute; inset:0; z-index:12; display:none;
      align-items:center; justify-content:center; flex-direction:column; gap:10px;
      background:var(--c-head-glass); backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
      border:2px dashed var(--accent); border-radius:12px;
      color:var(--accent); font-size:14px; font-weight:600; pointer-events:none;
    }
    .inbox-center.is-dropping .thread-drop-veil { display:flex; }
    .thread-drop-veil svg { width:26px; height:26px; }
  }


  /* ── Composer (Telegram / WhatsApp) ───────────────────────────────────────
     It sits ON the thread surface. The panel, the hard rule above it, the mode
     tabs, the From/To row and the toolbar of grey icons are all gone: a channel
     button, the number you are sending from, a round attach, a rounded field and
     a round send. Everything that came off the bar moved into one of the two
     menus rather than disappearing. */
  @media (min-width:769px) {
    .inbox-compose,
    [data-theme="dark"] .inbox-compose {
      position:relative; z-index:5; flex-shrink:0;
      padding:4px 16px 14px; gap:8px; display:flex; flex-direction:column;
      background:none; background-image:none; border-top:none; box-shadow:none;
    }
    /* The old GHL chrome. Kept in the markup — the phone still uses the toolbar, the
       mode tabs and the char counter, and inboxArrangeComposer moves the text field
       onto that toolbar down there — and hidden here.
       .compose-toolbar belongs on this list: without it the old grey icon row and its
       send button painted underneath the rebuilt bar, a second composer under the
       first. Nothing showed it until the render gate started asserting on it. */
    .inbox-compose .compose-ghl-head,
    .inbox-compose .compose-from-row,
    .inbox-compose .compose-status-line,
    .inbox-compose .compose-toolbar,
    .inbox-compose .compose-foot { display:none; }

    /* Top row. The 56px left inset lines the channel button up with the message
       bar, clearing the 44px attach circle and its 10px gap. */
    .cmp-top { display:flex; align-items:center; gap:12px; padding:0 4px 0 56px; }
    .cmp-ch {
      display:inline-flex; align-items:center; gap:6px; padding:5px 10px; border-radius:8px;
      background:var(--c-pill-bg); border:1px solid var(--border2); color:var(--accent);
      font-family:inherit; font-size:11px; font-weight:700; line-height:1; white-space:nowrap; cursor:pointer;
      transition:background 0.2s, color 0.2s, border-color 0.2s;
    }
    .cmp-ch svg { width:15px; height:15px; }
    .cmp-ch .cmp-caret { width:13px; height:13px; }
    .cmp-from { font-size:11px; color:var(--text2); white-space:nowrap; }
    .cmp-from b { color:var(--text); font-weight:600; }
    /* Two or more texting lines: From is a menu (send from another of your numbers). */
    .cmp-from-pick {
      display:inline-flex; align-items:center; gap:4px; height:24px; padding:0 7px; margin-left:-7px;
      border:none; border-radius:6px; background:none; font:inherit; font-size:11px; color:var(--text2);
      cursor:pointer; white-space:nowrap;
    }
    .cmp-from-pick:hover, .cmp-from-pick[aria-expanded="true"] { background:var(--bg3); }
    .cmp-from-pick .cmp-caret { width:12px; height:12px; opacity:0.55; }
    .cmp-from-lab { color:var(--text3); }
    .cmp-ch-menu.cmp-from-menu { width:260px; } /* beats .cmp-ch-menu's 210px below */
    .cmp-ch-menu.cmp-from-menu button { height:auto; min-height:40px; padding:5px 9px; }
    .cmp-from-txt { flex:1; display:flex; flex-direction:column; min-width:0; }
    .cmp-from-txt small { display:block; font-size:11px; color:var(--text3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .cmp-from-menu .cmp-pm-h, .cmp-from-foot { padding:4px 9px; font-size:11px; color:var(--text3); }
    .cmp-from-menu .cmp-pm-h { font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }

    /* Main row */
    .cmp-main { display:flex; align-items:flex-end; gap:10px; }
    .cmp-round {
      width:44px; height:44px; border-radius:50%; flex-shrink:0; padding:0;
      display:flex; align-items:center; justify-content:center; cursor:pointer;
      background:var(--c-cmp-field); border:1px solid var(--border2); color:var(--text2);
      box-shadow:0 1px 2px rgba(24,24,27,.05), 0 4px 14px rgba(24,24,27,.06);
    }
    .cmp-round:hover { background:var(--bg3); color:var(--text); }
    .cmp-round svg { width:19px; height:19px; }
    .cmp-field {
      flex:1; min-width:0; min-height:44px; border-radius:22px;
      background:var(--c-cmp-field); border:1px solid var(--border2);
      box-shadow:0 1px 2px rgba(24,24,27,.05), 0 4px 14px rgba(24,24,27,.06);
      display:flex; align-items:flex-end; gap:4px; padding:0 7px 0 18px;
      transition:background 0.2s, border-color 0.2s;
    }
    /* The textarea grows with the text and keeps the first line centred in a 44px
       bar. The 11px of padding lives on the WRAPPER, not the textarea: a 20px line
       plus 22px of padding plus the field's 1px border top and bottom is exactly 44,
       and it keeps scrollHeight equal to the text's own height, which is what
       inboxComposeAutoGrow measures. */
    .inbox-compose .compose-body { flex:1; min-width:0; padding:11px 0; }
    .inbox-compose .compose-ta {
      display:block; width:100%; height:20px; min-height:20px; max-height:170px; padding:0;
      border:none; outline:none; overflow-y:hidden;
      background:none; resize:none; color:var(--text); font-family:inherit;
      font-size:13.5px; line-height:20px;
    }
    .inbox-compose .compose-ta::placeholder { color:var(--text2); }
    .cmp-inline-btn {
      width:30px; height:30px; margin-bottom:6px; border-radius:50%; border:none; background:none; padding:0;
      display:flex; align-items:center; justify-content:center; color:var(--text2); cursor:pointer; flex-shrink:0;
    }
    .cmp-inline-btn:hover { background:var(--bg3); color:var(--text); }
    .cmp-inline-btn svg { width:17px; height:17px; }
    .cmp-inline-btn.cmp-emoji svg { width:19px; height:19px; }
    .cmp-send {
      width:44px; height:44px; border-radius:50%; flex-shrink:0; border:none; padding:0;
      display:flex; align-items:center; justify-content:center; cursor:pointer;
      background:var(--accent); color:#fff; box-shadow:0 2px 8px rgba(37,99,235,.28);
      transition:background 0.2s;
    }
    .cmp-send svg { width:18px; height:18px; }
    .cmp-send:hover { filter:brightness(1.06); }
    .cmp-send:disabled { opacity:0.45; cursor:not-allowed; box-shadow:none; }

    /* Menus. Both open UPWARD — there is nothing below the composer to open into. */
    .cmp-menu {
      position:absolute; bottom:calc(100% + 6px); left:0; z-index:9; padding:5px; border-radius:10px;
      background:var(--f-menu-bg); box-shadow:var(--f-menu-sh);
      backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
      display:flex; flex-direction:column;
    }
    .cmp-menu[hidden] { display:none; }
    .cmp-ch-menu { width:210px; }
    .cmp-ch-menu button {
      display:flex; align-items:center; gap:9px; height:30px; padding:0 9px; border-radius:6px;
      border:none; background:none; font:inherit; font-size:13px; color:var(--text);
      cursor:pointer; text-align:left; white-space:nowrap;
    }
    .cmp-ch-menu button:hover { background:var(--bg3); }
    .cmp-ch-menu button:disabled { opacity:0.45; cursor:not-allowed; }
    .cmp-ch-menu button:disabled:hover { background:none; }
    .cmp-ch-menu button > svg { width:15px; height:15px; flex-shrink:0; color:var(--text2); }
    .cmp-ch-menu .cmp-ch-name { flex:1; }
    .cmp-ch-menu .cmp-ch-tick { width:14px; height:14px; color:var(--accent); flex-shrink:0; }
    .cmp-menu .cmp-div { height:1px; margin:4px 8px; background:var(--border2); }
    .cmp-attach-menu { width:232px; bottom:calc(100% + 8px); border-radius:12px; }
    .cmp-attach-menu button {
      display:flex; align-items:center; gap:10px; padding:7px 9px; border-radius:7px;
      border:none; background:none; font:inherit; cursor:pointer; text-align:left; width:100%;
    }
    .cmp-attach-menu button:hover { background:var(--bg3); }
    .cmp-attach-ico {
      width:30px; height:30px; border-radius:50%; flex-shrink:0; color:#fff;
      display:flex; align-items:center; justify-content:center;
    }
    .cmp-attach-ico svg { width:15px; height:15px; }
    .cmp-attach-t { display:flex; flex-direction:column; min-width:0; }
    .cmp-attach-t b { font-size:13px; font-weight:500; color:var(--text); }
    .cmp-attach-t span { font-size:11px; color:var(--text2); }
    .cmp-anchor { position:relative; display:flex; flex-shrink:0; }

    /* Internal comment mode — the channel button, the field and send all turn
       orange together, so there is no way to mistake a note for a message. */
    .inbox-compose.compose-internal-note { background:none; }
    .compose-internal-note .cmp-ch { background:var(--note-bg); border-color:var(--note-bd); color:var(--note-fg); }
    .compose-internal-note .cmp-field { background:var(--note-field); border-color:var(--note-bd); }
    .compose-internal-note .cmp-send { background:var(--note-send); box-shadow:0 2px 8px rgba(217,119,6,.28); }

    /* P9 — WhatsApp with no provable consent. The inset matches the message bar so
       it reads as a note about the box below it, not a page-level banner. */
    .cmp-consent {
      margin-left:54px; display:flex; align-items:center; gap:8px; padding:7px 12px; border-radius:12px;
      background:var(--c-cmp-field); border:1px solid var(--f-danger); font-size:12px; color:var(--text);
    }
    .cmp-consent > svg { width:14px; height:14px; flex-shrink:0; color:var(--f-danger); }
    .cmp-consent .cmp-consent-t { flex:1; min-width:0; }
    .cmp-consent button {
      border:none; background:none; padding:0; font:inherit; font-size:12px; font-weight:600;
      color:var(--accent); cursor:pointer; white-space:nowrap;
    }

    /* Staged attachments and the translate bar keep their place, above the row. */
    .inbox-compose .compose-staged { padding:0 0 0 54px; }
    .inbox-compose .compose-xlate { margin-left:54px; border-radius:10px; }
    /* The email subject is a field on the same surface as the message bar, not a
       full-bleed strip with a hairline under it — there is no panel left for a
       hairline to divide. */
    .cmp-subject {
      margin-left:54px; padding:0 18px; height:36px; display:flex; align-items:center;
      border-radius:18px; background:var(--c-cmp-field); border:1px solid var(--border2);
    }
    /* Same for the two bars that stand in for the composer when a channel will not
       carry free text: the WhatsApp template rule, and a number the carrier has
       permanently refused. They keep their colours; they lose their hard edges. */
    .inbox-compose .wa-tpl-bar, .inbox-compose .sms-dead-bar {
      margin-left:54px; border-radius:12px; border-bottom:none;
      border:1px solid rgba(217,119,6,.28); padding:8px 12px;
    }
    .inbox-compose .sms-dead-bar { border-color:rgba(220,38,38,.28); }
    [data-theme="dark"] .inbox-compose .wa-tpl-bar { border-color:rgba(251,191,36,.26); }
    [data-theme="dark"] .inbox-compose .sms-dead-bar { border-color:rgba(220,38,38,.30); }
  }

  /* UI fix #19 (26 Nov 2026): a listing link in a message reads "View listing"
     (see _msgLinkify); the full address is its tooltip. Both widths. */
  .msg-link.msg-link-listing { font-weight:600; white-space:nowrap; }

  /* UI fix #20 (26 Nov 2026), revised 27 Nov: the contact panel's column is
     wider on a large screen so its fields aren't cramped. The short labels that
     sat under each rail icon were removed on 27 Nov (Reuven: too busy); each
     tool keeps its hover tooltip (data-tip) and aria-label. The rail stays 58px
     so the panel's column does not move; the icons are 40px squares in it.
     Desktop Conversations rail (#inbox-right) and, below, the Contacts drawer;
     the Pace rail reuses the strip and keeps its own look. ID selectors because
     the panel's base widths sit after this sheet in index.html. */
  @media (min-width:769px) {
    #inbox-right { width:348px; }
    #inbox-right.ir-collapsed { width:58px; }
    #inbox-right .ir-icon-strip { width:58px; padding:8px 4px; gap:4px; }
    #inbox-right .ir-strip-btn,
    #inbox-right .ir-strip-btn.ir-strip-ai {
      width:40px; height:40px; border-radius:10px;
    }
  }
  /* The Contacts page's drawer is the same panel (inboxRenderDetail into
     #contact-drawer-body), so its tool rail matches. */
  @media (min-width:769px) {
    #contact-drawer-body .ir-icon-strip { width:58px; padding:8px 4px; gap:4px; }
    #contact-drawer-body .ir-strip-btn,
    #contact-drawer-body .ir-strip-btn.ir-strip-ai {
      width:40px; height:40px; border-radius:10px;
    }
  }
  @media (min-width:1400px) {
    #inbox-right { width:384px; }
    #inbox-right .ir-main { width:326px; flex:0 0 326px; }
  }

  /* UI fix #21 (26 Nov 2026): the "nothing open yet" pane. Desktop only; a phone
     shows the list, not this pane. */
  .inbox-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; padding:32px 24px; text-align:center; }
  .inbox-empty-ic { width:64px; height:64px; border-radius:20px; display:flex; align-items:center; justify-content:center;
    background:var(--accent-soft); color:var(--accent); margin-bottom:6px; }
  .inbox-empty-ic svg { width:30px; height:30px; }
  .inbox-empty-t { font-family:var(--font-display, inherit); font-size:20px; font-weight:700; letter-spacing:-.01em; color:var(--text); }
  .inbox-empty-s { max-width:360px; font-size:14px; line-height:1.5; color:var(--text2); }
  .inbox-empty-acts { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-top:8px; }
  .inbox-empty-acts .btn { display:inline-flex; align-items:center; gap:6px; }
  .inbox-empty-acts .btn svg { width:15px; height:15px; }
  @media (min-width:769px) {
    #inbox-right:has(> .ir-empty-ph) { width:58px; }
  }

/* Inbox side panel cleanup (Reuven, 27 Nov 2026). Spec: Fix Mds/inbox-side-panel-cleanup-1127-spec.md */

/* 1. Send a unit: "Send our website" / "Send our contact card" slide fully out
   of view once the unit list is scrolled (lppSitebarScrolled toggles
   .lpp-site-off on the panel) and slide back at the top. The bar keeps its own
   height in a max-height it can ease to 0; the extra 10px of bottom padding,
   pulled back with a negative margin, is room for the pills' soft shadow, which
   overflow:hidden would otherwise cut. Desktop Units tab and the phone sheet. */
#inbox-right .lpp > .lpp-sitebar,
#contact-drawer-body .lpp > .lpp-sitebar,
html body #units-share-overlay .lpp > .lpp-sitebar {
  overflow:hidden; max-height:260px; padding-bottom:10px; margin-bottom:-10px;
  transition:max-height .34s cubic-bezier(.32,.72,0,1), padding .34s cubic-bezier(.32,.72,0,1),
    margin .34s cubic-bezier(.32,.72,0,1), opacity .2s ease, visibility 0s linear 0s;
}
#inbox-right .lpp.lpp-site-off > .lpp-sitebar,
#contact-drawer-body .lpp.lpp-site-off > .lpp-sitebar,
html body #units-share-overlay .lpp.lpp-site-off > .lpp-sitebar {
  max-height:0; padding-top:0; padding-bottom:0; margin-bottom:0; opacity:0;
  visibility:hidden; pointer-events:none;
  transition:max-height .34s cubic-bezier(.32,.72,0,1), padding .34s cubic-bezier(.32,.72,0,1),
    margin .34s cubic-bezier(.32,.72,0,1), opacity .2s ease, visibility 0s linear .34s;
}
@media (prefers-reduced-motion:reduce) {
  #inbox-right .lpp > .lpp-sitebar,
  #contact-drawer-body .lpp > .lpp-sitebar,
  html body #units-share-overlay .lpp > .lpp-sitebar { transition:none; }
}

/* 3. Every switch in the side panel (Tasks Open/Done, Appointments, Units
   Matches/All) fills the panel's column instead of stopping at 266px and
   sitting off to the left: the desktop rail, the Contacts drawer and the
   phone's full-screen tool sheet (#ics-tabsheet). The phone Send-a-unit sheet
   is already full width. */
#inbox-right .lpp-seg,
#contact-drawer-body .lpp-seg,
#ics-tabsheet .lpp-seg { max-width:none; }
