/* ═════════════════════════════════════════════════════════════════════════════
   js/staff-chat.css — Internal staff chat (WhatsApp-style team messaging).

   Lives on the global Comms Dock as a 4th bubble (the black "person" button).
   - The dock bubble (.bubble-staff) renders INSIDE .comms-dock so it inherits
     the dock's .bubble base styles from comms-dock.css; only the variants +
     pulse live here.
   - The chat panel (.sc-panel) + the full-screen attention overlay
     (#staff-chat-attention) mount into #staff-chat-root at body level, so they
     carry their own design tokens (mirrors comms-dock.css).

   prefers-reduced-motion: reduce gates every pulse/beat animation.
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── Tokens (mirror comms-dock.css so the two surfaces match) ─────────────── */
.sc-panel,
.sc-attention {
  --sc-red: #C41230;
  --sc-red-dark: #A60F28;
  --sc-ink: #0A0A0A;
  --sc-s50: #FAFAF9;
  --sc-s100: #F5F5F4;
  --sc-s200: #E7E5E4;
  --sc-s300: #D6D3D1;
  --sc-s400: #A8A29E;
  --sc-s500: #78716C;
  --sc-s600: #57534E;
  --sc-s700: #44403C;
  --sc-s900: #1C1917;
  --sc-green: #15803D;
  --sc-blue: #1D4ED8;
  --sc-shadow-panel: 0 24px 60px -12px rgba(10,10,10,.35), 0 6px 16px rgba(10,10,10,.12);
  --sc-shadow-rest: 0 1px 2px rgba(10,10,10,.03), 0 1px 1px rgba(10,10,10,.02);
  --sc-ease: cubic-bezier(.4,0,.2,1);
  --sc-t: 180ms var(--sc-ease);
  font-family: var(--ff-sans, 'Archivo', system-ui, sans-serif);
}

/* ── Dock bubble — black circle, white person glyph. Pulses RED when a
      directed message (a DM, or a group @mention) is unread. ──────────────── */
@keyframes sc-pulse-attention {
  0%, 100% { box-shadow: var(--cdh-shadow-bubble), 0 0 0 0  rgba(196,18,48,.55); }
  70%      { box-shadow: var(--cdh-shadow-bubble), 0 0 0 16px rgba(196,18,48,0); }
}
.comms-dock .bubble-staff { background: var(--cdh-ink, #0A0A0A); }
.comms-dock .bubble-staff:hover { background: var(--cdh-s900, #1C1917); }
.comms-dock .bubble-staff.has-attention { animation: sc-pulse-attention 1.4s infinite; }
.comms-dock .bubble-staff .bubble-badge { background: var(--cdh-red, #C41230); }
.comms-dock .bubble-staff .bubble-badge.muted { background: var(--cdh-s500, #78716C); }
/* 60s-unanswered tier — pulse MUCH harder: red fill, bigger/faster ring + scale. */
@keyframes sc-pulse-hard {
  0%, 100% { transform: scale(1);    box-shadow: var(--cdh-shadow-bubble), 0 0 0 0  rgba(196,18,48,.9); }
  40%      { transform: scale(1.14); }
  70%      { transform: scale(1);    box-shadow: var(--cdh-shadow-bubble), 0 0 0 24px rgba(196,18,48,0); }
}
.comms-dock .bubble-staff.has-attention-hard {
  background: var(--cdh-red, #C41230);
  animation: sc-pulse-hard .62s cubic-bezier(.4,0,.2,1) infinite;
}
.comms-dock .bubble-staff.has-attention-hard:hover { background: var(--cdh-red-dark, #A60F28); }
@media (prefers-reduced-motion: reduce) {
  .comms-dock .bubble-staff.has-attention,
  .comms-dock .bubble-staff.has-attention-hard { animation: none !important; }
  .comms-dock .bubble-staff.has-attention-hard { background: var(--cdh-red, #C41230); }
}

/* ── Panel shell ──────────────────────────────────────────────────────────── */
@keyframes sc-fade-in-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.sc-panel {
  position: fixed;
  bottom: 24px;
  right: 96px;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border: 1px solid var(--sc-s200);
  border-radius: 18px;
  box-shadow: var(--sc-shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 61;
}

/* Header */
.sc-h {
  padding: 13px 16px;
  background: linear-gradient(135deg, #1A0E12 0%, #0A0A0A 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 11px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.sc-h::before {
  content: '';
  position: absolute;
  left: -30%; top: -50%;
  width: 60%; height: 200%;
  background: radial-gradient(circle, rgba(196,18,48,.25) 0%, transparent 60%);
  pointer-events: none;
}
.sc-h-title {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sc-h-title .sc-h-main { font-size: 14.5px; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; display: flex; align-items: center; gap: 7px; }
.sc-h-title .sc-h-sub { font-size: 11px; color: rgba(255,255,255,.6); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-h-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sc-red);
  color: #fff;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; z-index: 1;
}
.sc-h-av.group { background: #7C3AED; }
.sc-h-actions { display: flex; align-items: center; gap: 5px; position: relative; z-index: 1; }
.sc-h-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; border: none;
  font-family: inherit; font-size: 18px; line-height: 1;
  transition: all var(--sc-t);
}
.sc-h-btn:hover { background: rgba(255,255,255,.16); }
.sc-h-btn .ico { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Conversation-list filter tabs (All / Direct / Groups) */
.sc-ltabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--sc-s100); background: var(--sc-s50); flex-shrink: 0; }
.sc-ltab {
  flex: 1; padding: 7px 8px; background: none; border: none; border-radius: 7px;
  font-size: 11.5px; font-weight: 800; color: var(--sc-s500); cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: all var(--sc-t);
}
.sc-ltab:hover { color: var(--sc-ink); }
.sc-ltab.on { background: #fff; color: var(--sc-ink); box-shadow: var(--sc-shadow-rest); }
.sc-ltab-c { font-size: 9.5px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--sc-s200); color: var(--sc-s700); }
.sc-ltab.on .sc-ltab-c { background: var(--sc-ink); color: #fff; }

/* Body (scroll region) */
.sc-body { flex: 1; overflow-y: auto; background: #fff; min-height: 0; }
.sc-empty {
  padding: 40px 24px; text-align: center;
  font-size: 12.5px; color: var(--sc-s500); font-weight: 600; line-height: 1.55;
}
.sc-empty-sub { display: block; margin-top: 6px; font-size: 11px; color: var(--sc-s400); font-weight: 500; }
.sc-empty .ico { width: 30px; height: 30px; color: var(--sc-s300); stroke: currentColor; stroke-width: 1.6; fill: none; margin-bottom: 10px; }

/* ── Conversation list rows ──────────────────────────────────────────────── */
.sc-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--sc-s100);
  width: 100%; text-align: left; background: none; border-left: none; border-right: none; border-top: none;
  font-family: inherit; cursor: pointer; position: relative;
  transition: background var(--sc-t);
}
.sc-row:hover { background: var(--sc-s50); }
.sc-row.unread::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sc-green);
}
.sc-row.directed::before { background: var(--sc-red); }
.sc-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--sc-s200); color: var(--sc-s700);
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  position: relative;
}
.sc-av.group { background: #EDE9FE; color: #6D28D9; }
.sc-av .sc-presence {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid #fff; background: var(--sc-s300);
}
.sc-av .sc-presence.on { background: #22C55E; }
.sc-mid { flex: 1; min-width: 0; }
.sc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.sc-name { font-size: 13px; font-weight: 800; color: var(--sc-ink); letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.sc-name .ico { width: 12px; height: 12px; color: var(--sc-s400); stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.sc-time { font-size: 10px; color: var(--sc-s400); font-weight: 700; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.sc-snippet { font-size: 11.5px; color: var(--sc-s500); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-snippet b { color: var(--sc-s700); font-weight: 700; }
.sc-row-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--sc-green); color: #fff; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sc-row-badge.directed { background: var(--sc-red); }

/* Role chip (e.g. "Sales Rep") in the new-chat user list */
.sc-role {
  font-size: 9px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: var(--sc-s100); color: var(--sc-s600);
}

/* ── New-chat / new-group picker ─────────────────────────────────────────── */
.sc-newbar { padding: 10px 12px; border-bottom: 1px solid var(--sc-s100); background: var(--sc-s50); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.sc-search {
  width: 100%; padding: 9px 12px; border: 1px solid var(--sc-s200); border-radius: 10px;
  font-size: 13px; color: var(--sc-ink); background: #fff; font-family: inherit;
  transition: all var(--sc-t);
}
.sc-search:focus { outline: none; border-color: var(--sc-ink); box-shadow: 0 0 0 3px rgba(10,10,10,.05); }
.sc-mode { display: flex; gap: 4px; }
.sc-mode-btn {
  flex: 1; padding: 7px 8px; border: 1px solid var(--sc-s200); border-radius: 8px;
  background: #fff; color: var(--sc-s500); font-size: 11.5px; font-weight: 800; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all var(--sc-t);
}
.sc-mode-btn .ico { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.sc-mode-btn.on { background: var(--sc-ink); color: #fff; border-color: var(--sc-ink); }
.sc-group-name { display: none; }
.sc-group-name.show { display: block; }

/* selected member chips (group mode) */
.sc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--sc-ink); color: #fff;
  font-size: 11px; font-weight: 700;
}
.sc-chip button { background: rgba(255,255,255,.2); border: none; color: #fff; width: 16px; height: 16px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; }
.sc-pick-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--sc-s300);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff;
}
.sc-pick-check.on { background: var(--sc-ink); border-color: var(--sc-ink); }
.sc-pick-check .ico { width: 13px; height: 13px; stroke: currentColor; stroke-width: 3; fill: none; }
.sc-create-bar { padding: 10px 12px; border-top: 1px solid var(--sc-s100); background: #fff; flex-shrink: 0; }
.sc-btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--sc-red); color: #fff; font-size: 13.5px; font-weight: 800; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--sc-t);
}
.sc-btn-primary:hover:not(:disabled) { background: var(--sc-red-dark); transform: translateY(-1px); }
.sc-btn-primary:disabled { background: var(--sc-s200); color: var(--sc-s400); cursor: not-allowed; }
.sc-btn-primary .ico { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── Thread (messages) ───────────────────────────────────────────────────── */
.sc-thread {
  flex: 1; overflow-y: auto; padding: 14px 16px; min-height: 0;
  background: var(--sc-s50);
  background-image: radial-gradient(circle at 20% 20%, rgba(196,18,48,.02) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(21,128,61,.02) 0%, transparent 50%);
  display: flex; flex-direction: column; gap: 4px;
}
.sc-day { align-self: center; font-size: 10px; font-weight: 800; color: var(--sc-s400); background: #fff; padding: 3px 11px; border-radius: 11px; border: 1px solid var(--sc-s200); letter-spacing: 0.04em; margin: 10px 0 6px; }
.sc-msg { display: flex; flex-direction: column; max-width: 80%; }
.sc-msg.in { align-self: flex-start; align-items: flex-start; }
.sc-msg.out { align-self: flex-end; align-items: flex-end; }
.sc-msg-sender { font-size: 10.5px; font-weight: 800; color: var(--sc-blue); margin: 2px 0 2px 8px; letter-spacing: -0.005em; }
.sc-bubble {
  padding: 8px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; font-weight: 500;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(10,10,10,.04);
}
.sc-msg.in .sc-bubble { background: #fff; color: var(--sc-ink); border: 1px solid var(--sc-s200); border-bottom-left-radius: 5px; }
.sc-msg.out .sc-bubble { background: var(--sc-ink); color: #fff; border-bottom-right-radius: 5px; }
.sc-msg.out.mention-me .sc-bubble,
.sc-msg.in.mention-me .sc-bubble { box-shadow: 0 0 0 2px rgba(196,18,48,.55), 0 1px 2px rgba(196,18,48,.2); }
.sc-mention { font-weight: 800; color: var(--sc-blue); }
.sc-msg.out .sc-mention { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.sc-mention.me { background: rgba(196,18,48,.14); color: var(--sc-red); border-radius: 4px; padding: 0 3px; }
.sc-msg.out .sc-mention.me { background: rgba(255,255,255,.22); color: #fff; }
/* Job-number link inside a message — jumps straight to the job. */
.sc-joblink { color: var(--sc-red); font-weight: 800; text-decoration: none; border-bottom: 1.5px dashed currentColor; cursor: pointer; }
.sc-joblink:hover { opacity: .82; }
.sc-msg.out .sc-joblink { color: #fff; border-bottom-color: rgba(255,255,255,.7); }
.sc-meta { font-size: 9.5px; color: var(--sc-s400); font-weight: 600; margin: 2px 6px 4px; letter-spacing: 0.02em; }

/* ── Reactions (WhatsApp-style emoji on a message) ───────────────────────── */
/* bubble + the little react trigger sit on one row (trigger on the OUTER edge) */
.sc-bubble-row { display: flex; align-items: flex-end; gap: 5px; max-width: 100%; }
.sc-msg.out .sc-bubble-row { flex-direction: row-reverse; }
.sc-bubble-row .sc-bubble { min-width: 0; }
.sc-react-trigger {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--sc-s200); background: #fff; color: var(--sc-s500);
  font-size: 13px; line-height: 1; cursor: pointer; padding: 0; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.8); box-shadow: var(--sc-shadow-rest);
  transition: opacity var(--sc-t), transform var(--sc-t), background var(--sc-t);
}
.sc-msg:hover .sc-react-trigger { opacity: .9; transform: scale(1); }
.sc-react-trigger:hover { opacity: 1; background: var(--sc-s50); border-color: var(--sc-s300); }
/* touch devices (incl. the native app) have no hover — keep it gently visible */
@media (hover: none) { .sc-react-trigger { opacity: .5; transform: scale(1); } }

/* Reactions — A-298: a small pill that OVERLAPS the bubble's bottom edge like
   WhatsApp (pulled up with a negative margin, tucked to the near corner + a
   drop shadow so it reads as raised on the bubble), instead of a separate row
   floating underneath. */
.sc-reactions { display: flex; flex-wrap: wrap; gap: 3px; margin: -11px 0 2px; padding-left: 10px; position: relative; z-index: 3; }
.sc-msg.out .sc-reactions { justify-content: flex-end; padding-left: 0; padding-right: 10px; }
.sc-reaction {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 999px;
  background: #fff; border: 1px solid var(--sc-s200); box-shadow: 0 1px 3px rgba(0,0,0,.16);
  font-size: 12px; line-height: 1.3; cursor: pointer; font-family: inherit;
  transition: background var(--sc-t), border-color var(--sc-t), transform .1s var(--sc-ease);
}
.sc-reaction:hover { background: var(--sc-s50); border-color: var(--sc-s300); }
.sc-reaction:active { transform: scale(.92); }
.sc-reaction-e { font-size: 14px; line-height: 1; }
.sc-reaction-n { font-size: 10.5px; font-weight: 800; color: var(--sc-s600); font-variant-numeric: tabular-nums; }
.sc-reaction.mine { background: rgba(196,18,48,.08); border-color: rgba(196,18,48,.45); }
.sc-reaction.mine .sc-reaction-n { color: var(--sc-red); }
/* Dark: a raised pill on the dark chat surface (WhatsApp dark reaction). */
.sc-panel.sc-dark .sc-reaction { background: var(--scd-surface-2, #2A2F35); border-color: var(--scd-line, #3A4046); color: var(--scd-txt, #ECECED); box-shadow: 0 1px 3px rgba(0,0,0,.45); }
.sc-panel.sc-dark .sc-reaction:hover { background: #333940; }
.sc-panel.sc-dark .sc-reaction-n { color: var(--scd-txt-dim, #B8BCC2); }
.sc-panel.sc-dark .sc-reaction.mine { background: rgba(240,80,110,.22); border-color: rgba(240,80,110,.55); }
.sc-panel.sc-dark .sc-reaction.mine .sc-reaction-n { color: #F0506E; }

/* A-299 — scroll-to-latest FAB (WhatsApp): hidden until you scroll up off the
   bottom, then a round down-chevron floats above the composer. */
.sc-scroll-fab {
  position: absolute; right: 14px; bottom: 86px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%; padding: 0;
  background: #fff; border: 1px solid var(--sc-s200); box-shadow: var(--sc-shadow-panel);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--sc-s600);
  opacity: 0; transform: translateY(8px) scale(.9); pointer-events: none;
  transition: opacity .16s var(--sc-ease), transform .16s var(--sc-ease);
}
.sc-scroll-fab.show { opacity: 1; transform: none; pointer-events: auto; }
.sc-scroll-fab .ico { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.sc-scroll-fab:active { transform: scale(.9); }
.sc-panel.sc-dark .sc-scroll-fab { background: var(--scd-surface-2, #2A2F35); border-color: var(--scd-line, #3A4046); color: var(--scd-txt, #ECECED); }

/* A-300 — typing indicator (WhatsApp): a thin animated "X is typing…" row just
   above the composer. Hidden (no layout) until a peer types. */
.sc-typing { display: flex; align-items: center; gap: 7px; padding: 3px 16px 5px; font-size: 12px; font-weight: 600; color: var(--sc-s500); }
.sc-typing[hidden] { display: none; }
.sc-typing-dots { display: inline-flex; gap: 3px; }
.sc-typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--sc-s400); display: inline-block; animation: sc-typing-bounce 1.2s infinite ease-in-out both; }
.sc-typing-dots i:nth-child(2) { animation-delay: .15s; }
.sc-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sc-typing-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-3px); opacity: 1; } }
.sc-panel.sc-dark .sc-typing { color: var(--scd-txt-dim, #B8BCC2); }
.sc-panel.sc-dark .sc-typing-dots i { background: var(--scd-txt-dim, #8A8E94); }
@media (prefers-reduced-motion: reduce) { .sc-typing-dots i { animation: none; opacity: .8; } }

/* A-301 — double-tap-to-react heart pop (WhatsApp). */
.sc-bubble { position: relative; }
.sc-heart-pop {
  position: absolute; left: 50%; top: 50%; z-index: 6; pointer-events: none;
  font-size: 40px; line-height: 1; text-shadow: 0 2px 6px rgba(0,0,0,.3);
  animation: sc-heart-pop .7s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes sc-heart-pop {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.3); }
  28% { opacity: 1; transform: translate(-50%,-50%) scale(1.18); }
  70% { opacity: 1; transform: translate(-50%,-58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-96%) scale(.9); }
}
@media (prefers-reduced-motion: reduce) { .sc-heart-pop { animation: none; opacity: 0; } }

/* A-302 — in-chat message search bar (slides in under the header) + match highlight. */
.sc-search-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; flex-shrink: 0;
  background: var(--sc-s50); border-bottom: 1px solid var(--sc-s200);
  animation: sc-fade-in-down .16s var(--sc-ease);
}
@keyframes sc-fade-in-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.sc-search-ic { width: 15px; height: 15px; stroke: var(--sc-s500); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sc-search-input {
  flex: 1; min-width: 0; border: none; background: none; outline: none;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--sc-ink);
  padding: 3px 2px;
}
.sc-search-input::placeholder { color: var(--sc-s400); font-weight: 600; }
.sc-search-count { font-size: 11.5px; font-weight: 800; color: var(--sc-s500); min-width: 26px; text-align: right; flex-shrink: 0; }
.sc-search-nav, .sc-search-x {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: none;
  color: var(--sc-s600); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; font-family: inherit; transition: all var(--sc-t);
}
.sc-search-nav:hover, .sc-search-x:hover { background: var(--sc-s200); color: var(--sc-ink); }
.sc-search-nav .ico, .sc-search-x .ico { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* Highlight every hit; ring the current one. */
.sc-msg.sc-search-hit .sc-bubble { box-shadow: 0 0 0 2px rgba(196,18,48,.28); }
.sc-msg.sc-search-cur .sc-bubble { box-shadow: 0 0 0 2px var(--sc-red), 0 2px 10px rgba(196,18,48,.35); }
.sc-msg.sc-search-cur { animation: sc-search-flash .9s var(--sc-ease); }
@keyframes sc-search-flash { 0% { background: rgba(196,18,48,.10); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .sc-msg.sc-search-cur { animation: none; } .sc-search-bar { animation: none; } }
/* Dark */
.sc-panel.sc-dark .sc-search-bar { background: var(--scd-surface, #1C1D20); border-bottom-color: var(--scd-line, #2A2C30); }
.sc-panel.sc-dark .sc-search-ic { stroke: var(--scd-txt-dim, #9A9CA1); }
.sc-panel.sc-dark .sc-search-input { color: var(--scd-txt, #ECECED); }
.sc-panel.sc-dark .sc-search-input::placeholder { color: var(--scd-txt-faint, #6B6D72); }
.sc-panel.sc-dark .sc-search-count { color: var(--scd-txt-dim, #9A9CA1); }
.sc-panel.sc-dark .sc-search-nav, .sc-panel.sc-dark .sc-search-x { color: var(--scd-txt-dim, #B8BCC2); }
.sc-panel.sc-dark .sc-search-nav:hover, .sc-panel.sc-dark .sc-search-x:hover { background: var(--scd-surface-2, #26282C); color: var(--scd-txt, #ECECED); }
.sc-panel.sc-dark .sc-msg.sc-search-cur .sc-bubble { box-shadow: 0 0 0 2px #F0506E, 0 2px 10px rgba(240,80,110,.4); }

/* A-303 — pinned-message banner (WhatsApp). Sits under the header, above the thread. */
.sc-pin-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 14px; flex-shrink: 0; cursor: pointer;
  background: var(--sc-s50); border-bottom: 1px solid var(--sc-s200);
  border-left: 3px solid var(--sc-red);
  transition: background var(--sc-t);
  animation: sc-fade-in-down .16s var(--sc-ease);
}
.sc-pin-banner:hover { background: var(--sc-s100); }
.sc-pin-banner:active { background: var(--sc-s200); }
.sc-pin-ic { width: 15px; height: 15px; stroke: var(--sc-red); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sc-pin-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sc-pin-label { font-size: 10.5px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--sc-red); }
.sc-pin-text { font-size: 12.5px; font-weight: 600; color: var(--sc-s700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-pin-x {
  width: 28px; height: 28px; border-radius: 8px; border: none; background: none;
  color: var(--sc-s500); display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; font-family: inherit; transition: all var(--sc-t);
}
.sc-pin-x:hover { background: var(--sc-s200); color: var(--sc-ink); }
.sc-pin-x .ico { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* Dark */
.sc-panel.sc-dark .sc-pin-banner { background: var(--scd-surface, #1C1D20); border-bottom-color: var(--scd-line, #2A2C30); border-left-color: #F0506E; }
.sc-panel.sc-dark .sc-pin-banner:hover { background: var(--scd-surface-2, #26282C); }
.sc-panel.sc-dark .sc-pin-ic { stroke: #F0506E; }
.sc-panel.sc-dark .sc-pin-label { color: #F0506E; }
.sc-panel.sc-dark .sc-pin-text { color: var(--scd-txt, #ECECED); }
.sc-panel.sc-dark .sc-pin-x { color: var(--scd-txt-dim, #B8BCC2); }
.sc-panel.sc-dark .sc-pin-x:hover { background: var(--scd-surface-2, #26282C); color: var(--scd-txt, #ECECED); }

/* Floating emoji picker (the WhatsApp strip + an expandable "＋" grid) */
.sc-react-bar {
  z-index: 100002; background: #fff; border: 1px solid var(--sc-s200);
  border-radius: 999px; box-shadow: var(--sc-shadow-panel);
  padding: 5px 7px; display: inline-flex; flex-direction: column; gap: 6px;
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-react-bar.open { border-radius: 18px; }
.sc-react-row { display: inline-flex; align-items: center; gap: 1px; }
.sc-react-q, .sc-react-g, .sc-react-more {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: none;
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s var(--sc-ease), background var(--sc-t);
  /* let a vertical drag that STARTS on an emoji scroll the grid instead of
     being swallowed as a tap — without this the button-packed grid won't pan */
  touch-action: pan-y;
}
.sc-react-q:hover, .sc-react-g:hover, .sc-react-more:hover { background: var(--sc-s100); transform: scale(1.18); }
.sc-react-q.mine, .sc-react-g.mine { background: rgba(196,18,48,.12); }
.sc-react-more { font-size: 24px; color: var(--sc-s500); font-weight: 700; }
.sc-react-grid {
  display: none; grid-template-columns: repeat(6, 38px); gap: 1px;
  /* tall enough to show the whole set without scrolling when there's room
     (_placeReactBar caps this to the viewport when space is tight, and the
     grid then scrolls on touch via the props below) */
  max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; touch-action: pan-y;
  padding-top: 5px; border-top: 1px solid var(--sc-s100);
}
.sc-react-bar.open .sc-react-grid { display: grid; }
@media (prefers-reduced-motion: reduce) {
  .sc-react-bar { animation: none; }
  .sc-react-q:hover, .sc-react-g:hover, .sc-react-more:hover, .sc-reaction:active { transform: none; }
}

/* Image message */
.sc-bubble.has-img { padding: 4px; background: transparent !important; border: none !important; box-shadow: none; }
.sc-msg.out .sc-bubble.has-img, .sc-msg.in .sc-bubble.has-img { background: transparent !important; }
.sc-msg-img {
  display: block; max-width: 240px; max-height: 280px; width: auto; height: auto;
  border-radius: 14px; cursor: pointer; object-fit: cover;
  border: 1px solid var(--sc-s200); background: var(--sc-s100);
}
.sc-msg.out .sc-msg-img { border-bottom-right-radius: 5px; }
.sc-msg.in .sc-msg-img { border-bottom-left-radius: 5px; }
.sc-msg-img.uploading { opacity: .55; filter: saturate(.7); }
/* Video attachment — inline player, same footprint as a photo bubble */
.sc-msg-vid {
  display: block; max-width: 240px; max-height: 280px; width: auto; height: auto;
  border-radius: 14px; background: #000; border: 1px solid var(--sc-s200);
}
.sc-msg.out .sc-msg-vid { border-bottom-right-radius: 5px; }
.sc-msg.in .sc-msg-vid { border-bottom-left-radius: 5px; }
.sc-msg-vid.uploading { opacity: .55; filter: saturate(.7); }
/* Generic file attachment — downloadable card */
.sc-msg-file {
  display: flex; align-items: center; gap: 10px; max-width: 240px; padding: 10px 12px;
  border-radius: 14px; text-decoration: none; cursor: pointer;
}
.sc-msg.out .sc-msg-file { background: var(--sc-ink); color: #fff; border-bottom-right-radius: 5px; }
.sc-msg.in .sc-msg-file { background: #fff; color: var(--sc-ink); border: 1px solid var(--sc-s200); border-bottom-left-radius: 5px; }
.sc-msg-file.uploading { opacity: .6; }
.sc-file-ico { flex-shrink: 0; display: flex; }
.sc-msg-file .ico { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; }
.sc-file-meta { display: flex; flex-direction: column; min-width: 0; }
.sc-file-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-file-sub { font-size: 11px; opacity: .7; }
.sc-cap { margin-top: 4px; padding: 6px 10px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.sc-msg.out .sc-cap { background: var(--sc-ink); color: #fff; }
.sc-msg.in .sc-cap { background: #fff; color: var(--sc-ink); border: 1px solid var(--sc-s200); }

/* Full-screen image viewer */
.sc-lightbox {
  position: fixed; inset: 0; z-index: 100001; background: rgba(0,0,0,.86);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
  animation: sc-fade-in-up .15s var(--sc-ease);
}
.sc-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.sc-lightbox-x {
  position: fixed; top: 18px; right: 20px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; border: none; font-size: 24px; line-height: 1; cursor: pointer;
}
.sc-lightbox-x:hover { background: rgba(255,255,255,.26); }

/* Compose */
.sc-compose { padding: 10px 12px; border-top: 1px solid var(--sc-s100); background: #fff; flex-shrink: 0; position: relative; }
.sc-compose-row { display: flex; align-items: flex-end; gap: 7px; }
.sc-attach {
  width: 42px; height: 42px; border-radius: 11px; background: var(--sc-s100); color: var(--sc-s600);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; border: none; font-family: inherit;
  transition: all var(--sc-t);
}
.sc-attach:hover { background: var(--sc-s200); color: var(--sc-ink); }
.sc-attach .ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }
/* A-325: the composer is a contenteditable <div> (defeats OS Autofill, which only
   targets form fields). It auto-sizes to its content between min/max-height with no
   JS height math; white-space:pre-wrap renders the flat \n plain-text model and wraps
   long words. Placeholder is a :before on .sc-empty (contenteditable has no native
   placeholder). */
.sc-input {
  flex: 1; box-sizing: border-box; padding: 10px 12px; background: var(--sc-s50); border: 1px solid var(--sc-s200); border-radius: 11px;
  font-size: 13px; line-height: 1.4; min-height: 42px; max-height: 132px; color: var(--sc-ink); font-family: inherit;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; cursor: text; position: relative;
  overflow-y: hidden;   /* _autoGrow flips this to 'auto' only past the max-height cap */
  transition: background var(--sc-t), border-color var(--sc-t), box-shadow var(--sc-t);   /* NOT height — auto-grow must be instant, not animated */
}
.sc-input:focus { outline: none; background: #fff; border-color: var(--sc-ink); box-shadow: 0 0 0 3px rgba(10,10,10,.05); }
.sc-input.sc-empty:before { content: attr(data-sc-placeholder); color: var(--sc-ink); opacity: .42; pointer-events: none; }
.sc-send {
  width: 42px; height: 42px; border-radius: 11px; background: var(--sc-ink); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; border: none; font-family: inherit;
  transition: all var(--sc-t);
}
.sc-send:hover { background: var(--sc-red); transform: translateY(-1px); }
.sc-send .ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

/* @mention autocomplete popup (anchored above the compose box) */
.sc-mention-pop {
  position: absolute; left: 12px; right: 54px; bottom: 100%; margin-bottom: 6px;
  background: #fff; border: 1px solid var(--sc-s200); border-radius: 12px; box-shadow: var(--sc-shadow-panel);
  overflow: hidden; max-height: 200px; overflow-y: auto; z-index: 5;
}
.sc-mention-opt { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--sc-ink); }
.sc-mention-opt:hover, .sc-mention-opt.active { background: var(--sc-s100); }
.sc-mention-opt .sc-av { width: 26px; height: 26px; font-size: 10px; }

/* ── Full-screen attention overlay — pulses + beeps when a directed message
      goes 10 minutes without a response. Stops the moment it's acknowledged. ─ */
@keyframes sc-screen-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(196,18,48,0); }
  50%      { box-shadow: inset 0 0 90px 14px rgba(196,18,48,.55); }
}
@keyframes sc-toast-beat { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.04); } }
.sc-attention {
  position: fixed; inset: 0; z-index: 100000; pointer-events: none;
  animation: sc-screen-pulse 1.05s ease-in-out infinite;
}
.sc-attention::after {
  content: ''; position: absolute; inset: 0;
  border: 5px solid var(--sc-red); border-radius: 2px;
  animation: sc-screen-pulse 1.05s ease-in-out infinite;
}
.sc-attention-card {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  pointer-events: auto;
  background: linear-gradient(135deg, #1A0E12 0%, #0A0A0A 100%); color: #fff;
  border: 1px solid rgba(196,18,48,.6);
  border-radius: 14px; padding: 14px 16px; min-width: 300px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.6), 0 0 0 1px rgba(196,18,48,.4);
  display: flex; align-items: center; gap: 14px;
  animation: sc-toast-beat 1.05s ease-in-out infinite;
}
.sc-attention-ic {
  width: 42px; height: 42px; border-radius: 50%; background: var(--sc-red); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sc-attention-ic .ico { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.sc-attention-txt { flex: 1; min-width: 0; }
.sc-attention-h { font-size: 13.5px; font-weight: 800; letter-spacing: -0.01em; }
.sc-attention-s { font-size: 11.5px; color: rgba(255,255,255,.7); font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-attention-btn {
  background: var(--sc-red); color: #fff; border: none; border-radius: 10px; padding: 9px 16px;
  font-size: 12.5px; font-weight: 800; cursor: pointer; font-family: inherit; flex-shrink: 0; white-space: nowrap;
  transition: background var(--sc-t);
}
.sc-attention-btn:hover { background: var(--sc-red-dark); }
/* Escalation ramps the VISUAL too — faster, harder pulse the longer it goes
   unanswered (the audio gets louder in _beep; these match it). */
.sc-attention--loud { animation-duration: .72s; }
.sc-attention--loud::after { animation-duration: .72s; border-width: 7px; }
.sc-attention--loud .sc-attention-card { animation-duration: .72s; }
.sc-attention--max { animation-duration: .5s; }
.sc-attention--max::after { animation-duration: .5s; border-width: 9px; }
.sc-attention--max .sc-attention-card { animation-duration: .5s; }
@media (prefers-reduced-motion: reduce) {
  .sc-attention, .sc-attention::after, .sc-attention-card { animation: none !important; }
  .sc-attention { box-shadow: inset 0 0 70px 12px rgba(196,18,48,.4); }
}

/* ── Small screens — full-width panel ────────────────────────────────────── */
@media (max-width: 540px) {
  .sc-panel { right: 12px; left: 12px; bottom: 12px; width: auto; height: calc(100vh - 24px); max-height: none; }
}

/* ── Native sales app — full-screen Team chat. The comms floating bubble dock
   overlays this panel for nav (no footer tab bar). Gated on .sc-native (set only
   inside the Capacitor wrapper), so the desktop web CRM — even in a narrow window —
   is unaffected. Mirrors the full-screen comms deck: squared, edge-to-edge,
   header clears the status bar/notch. */
.sc-native.sc-panel {
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border: none;
}
.sc-native .sc-h { padding-top: calc(13px + env(safe-area-inset-top)); }

/* Native Team LIST header — matches the comms deck's web-style title bar (white,
   "Name's team", circular ✕). Uses the --cdh-* tokens (defined on .sc-panel via
   comms-dock.css) so it's pixel-consistent with the deck's other tabs. */
.sc-native .sc-h-deck {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: #fff;
  border-bottom: 1px solid var(--cdh-s100, #F5F5F4);
}
.sc-native .sc-deck-l { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.sc-native .sc-deck-ico { width: 18px; height: 18px; color: var(--cdh-s500, #78716C); stroke: currentColor; stroke-width: 2; fill: none; }
.sc-native .sc-deck-t { font-size: 14px; font-weight: 800; color: var(--cdh-ink, #0A0A0A); letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-native .sc-deck-t b { color: var(--cdh-red, #C41230); font-weight: 800; }
.sc-native .sc-deck-r { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sc-native .sc-deck-icbtn,
.sc-native .sc-deck-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: none; border: 1px solid var(--cdh-s200, #E7E5E4);
  color: var(--cdh-s500, #78716C); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: all .15s;
}
.sc-native .sc-deck-close { font-size: 18px; line-height: 1; }
.sc-native .sc-deck-icbtn .ico { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }
.sc-native .sc-deck-icbtn:hover,
.sc-native .sc-deck-close:hover { background: var(--cdh-s100, #F5F5F4); color: var(--cdh-ink, #0A0A0A); }

/* Auto-hide the panel while a CRM modal/overlay is open (mirrors comms-dock).
   Transitioned so any toggle is a smooth fade, never a hard flicker. */
.sc-panel { transition: opacity 120ms ease; }
#staff-chat-root.sc-overlay-open .sc-panel { visibility: hidden; opacity: 0; pointer-events: none; transition: opacity 120ms ease, visibility 0s 120ms; }

/* ── System notice line (X added Y / Z left / renamed) — centered inline pill,
      no bubble, no avatar. Mirrors WhatsApp's grey membership notices. ──────── */
.sc-system { align-self: center; max-width: 88%; margin: 6px 0; text-align: center; }
.sc-system span {
  display: inline-block; padding: 4px 12px; border-radius: 11px;
  background: var(--sc-s100); border: 1px solid var(--sc-s200); color: var(--sc-s600);
  font-size: 11px; font-weight: 700; line-height: 1.45;
}

/* ── Group info panel (member admin: rename / add / remove / leave) ────────── */
.sc-info { padding: 14px 14px 20px; display: flex; flex-direction: column; gap: 12px; }
.sc-info-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 0 4px; }
.sc-av.group.lg { width: 64px; height: 64px; }
.sc-info-name { font-size: 16px; font-weight: 800; color: var(--sc-ink); letter-spacing: -0.01em; text-align: center; }
.sc-info-sub { font-size: 11.5px; font-weight: 700; color: var(--sc-s500); }
.sc-info-rename { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 320px; }
.sc-rename {
  flex: 1; padding: 8px 11px; border: 1px solid var(--sc-s200); border-radius: 9px;
  font-size: 14px; font-weight: 700; color: var(--sc-ink); background: #fff; font-family: inherit; text-align: center;
}
.sc-rename:focus { outline: none; border-color: var(--sc-ink); box-shadow: 0 0 0 3px rgba(10,10,10,.05); }
.sc-btn-mini { padding: 8px 12px; border: none; border-radius: 9px; background: var(--sc-ink); color: #fff; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit; flex-shrink: 0; transition: background var(--sc-t); }
.sc-btn-mini:hover { background: var(--sc-red); }
.sc-info-add {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; border: 1px dashed var(--sc-s300); border-radius: 11px;
  background: var(--sc-s50); color: var(--sc-ink); font-size: 12.5px; font-weight: 800; cursor: pointer; font-family: inherit;
  transition: all var(--sc-t);
}
.sc-info-add:hover { background: var(--sc-s100); border-color: var(--sc-s400); }
.sc-info-add .ico { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; }
/* The list grows to its full height and the group-info panel body scrolls it.
   flex-shrink:0 is load-bearing: without it the .sc-info flex column squashes
   the list to the leftover space, and a nested overflow:auto scroller on the
   list itself does NOT respond to touch in the native WebView (only the panel's
   main scroller does) — so members got clipped with no way to reach them. */
.sc-info-mlist { display: flex; flex-direction: column; border: 1px solid var(--sc-s100); border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.sc-info-mrow { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-bottom: 1px solid var(--sc-s100); }
.sc-info-mrow:last-child { border-bottom: none; }
.sc-info-admin { font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: #EDE9FE; color: #6D28D9; flex-shrink: 0; }
.sc-info-x {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--sc-s200); background: #fff; color: var(--sc-s500);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all var(--sc-t);
}
.sc-info-x:hover { background: rgba(196,18,48,.08); border-color: rgba(196,18,48,.45); color: var(--sc-red); }
.sc-info-leave {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 4px;
  padding: 11px; border: 1px solid rgba(196,18,48,.3); border-radius: 11px; background: #fff; color: var(--sc-red);
  font-size: 12.5px; font-weight: 800; cursor: pointer; font-family: inherit; transition: all var(--sc-t);
}
.sc-info-leave:hover { background: rgba(196,18,48,.06); border-color: var(--sc-red); }
.sc-info-leave .ico { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.sc-btn-ghost {
  padding: 12px 16px; border: 1px solid var(--sc-s200); border-radius: 12px; background: #fff; color: var(--sc-s600);
  font-size: 13px; font-weight: 800; cursor: pointer; font-family: inherit; transition: all var(--sc-t); flex-shrink: 0;
}
.sc-btn-ghost:hover { background: var(--sc-s50); color: var(--sc-ink); }
/* The create/add bar holds either one primary button (new group) or Cancel +
   Add (group-info). Flex so the two-button case splits cleanly; one button fills. */
.sc-create-bar { display: flex; gap: 8px; }
.sc-create-bar .sc-btn-primary { flex: 1; width: auto; }

/* ── Edit / delete own messages ────────────────────────────────────────────── */
/* Soft-deleted tombstone bubble. */
.sc-bubble.sc-deleted { font-style: italic; opacity: .8; }
.sc-msg.in .sc-bubble.sc-deleted { background: var(--sc-s100); color: var(--sc-s500); border-color: var(--sc-s200); }
.sc-msg.out .sc-bubble.sc-deleted { background: var(--sc-s700); color: rgba(255,255,255,.75); }
/* ⋯ actions trigger — mirrors the react trigger (hover-revealed, touch-visible). */
.sc-msg-menu-trigger {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--sc-s200); background: #fff; color: var(--sc-s500);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.8); box-shadow: var(--sc-shadow-rest);
  transition: opacity var(--sc-t), transform var(--sc-t), background var(--sc-t);
}
.sc-msg:hover .sc-msg-menu-trigger { opacity: .9; transform: scale(1); }
.sc-msg-menu-trigger:hover { opacity: 1; background: var(--sc-s50); border-color: var(--sc-s300); }
@media (hover: none) { .sc-msg-menu-trigger { opacity: .5; transform: scale(1); } }
/* Floating Edit / Delete menu. */
.sc-msg-menu {
  z-index: 100002; background: #fff; border: 1px solid var(--sc-s200);
  border-radius: 12px; box-shadow: var(--sc-shadow-panel);
  padding: 5px; display: inline-flex; flex-direction: column; min-width: 132px;
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-mm-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 12px; border: none; background: none; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--sc-ink); cursor: pointer; font-family: inherit; text-align: left;
  transition: background var(--sc-t);
}
.sc-mm-item:hover { background: var(--sc-s100); }
.sc-mm-item.danger { color: var(--sc-red); }
.sc-mm-item.danger:hover { background: rgba(196,18,48,.08); }
/* "Editing message" bar above the compose box. */
.sc-editing-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  padding: 7px 10px; border-radius: 9px; background: var(--sc-s50); border: 1px solid var(--sc-s200);
  font-size: 11.5px; font-weight: 700; color: var(--sc-s600);
}
.sc-editing-bar .ico { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; }
.sc-editing-bar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-editing-bar button { background: none; border: none; color: var(--sc-red); font-size: 11.5px; font-weight: 800; cursor: pointer; font-family: inherit; padding: 0; flex-shrink: 0; }

/* ── Read-receipt ticks (own messages) ─────────────────────────────────────── */
.sc-ticks { margin-left: 5px; font-size: 10px; font-weight: 800; letter-spacing: -1.5px; vertical-align: middle; }
.sc-ticks.sent { color: var(--sc-s400); }
.sc-ticks.read { color: var(--sc-blue); }

/* ═══════════════════════════════════════════════════════════════════════════
   WhatsApp-native upgrade — long-press actions, reply/quote, compose emoji,
   attachment sheet, delete-for-me, + a DARK theme for phones.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── One subtle hover trigger per bubble → the full actions menu. Desktop only;
      touch devices long-press instead (hidden below). ─────────────────────── */
.sc-msg { position: relative; }
.sc-msg-trigger {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: transparent; color: var(--sc-s400);
  cursor: pointer; padding: 0; font-family: inherit; align-self: flex-start; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--sc-t), background var(--sc-t), color var(--sc-t);
}
.sc-msg-trigger .ico { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.sc-msg:hover .sc-msg-trigger { opacity: .85; }
.sc-msg-trigger:hover { opacity: 1; background: var(--sc-s100); color: var(--sc-ink); }
@media (hover: none) { .sc-msg-trigger { display: none; } }

/* Pressed (menu open) — lift the bubble above the dim backdrop + highlight. */
.sc-msg.sc-pressed { z-index: 100003; }
.sc-msg.sc-pressed .sc-bubble { box-shadow: 0 0 0 2px var(--sc-red), 0 8px 24px rgba(0,0,0,.28); }
/* Flash when a reply's quote is tapped (jump-to-original). */
@keyframes sc-flash { 0%,100% { box-shadow: 0 1px 1px rgba(10,10,10,.04); } 30% { box-shadow: 0 0 0 3px rgba(196,18,48,.5); } }
.sc-msg.sc-flash .sc-bubble { animation: sc-flash 1.3s var(--sc-ease); }
/* Swipe-to-reply feedback (touch). */
.sc-thread { overflow-x: hidden; }
.sc-msg.sc-swipe-armed .sc-bubble { box-shadow: 0 0 0 2px rgba(196,18,48,.6); }

/* ── Quoted block inside a bubble (a reply) ───────────────────────────────── */
.sc-quote {
  display: block; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
  border: none; border-left: 3px solid var(--sc-red);
  background: rgba(196,18,48,.08); border-radius: 6px;
  padding: 5px 9px; margin: 0 0 5px; overflow: hidden;
}
.sc-bubble.has-quote { padding-top: 7px; }
.sc-quote-name { display: block; font-size: 11px; font-weight: 800; color: var(--sc-red); letter-spacing: -.005em; }
.sc-quote-prev { display: block; font-size: 12px; font-weight: 500; color: var(--sc-s600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.sc-msg.out .sc-bubble .sc-quote { border-left-color: rgba(255,255,255,.85); background: rgba(255,255,255,.14); }
.sc-msg.out .sc-quote-name { color: #fff; }
.sc-msg.out .sc-quote-prev { color: rgba(255,255,255,.82); }

/* ── Reply-compose bar (above the input while replying) ───────────────────── */
.sc-reply-bar {
  display: flex; align-items: stretch; gap: 9px; margin-bottom: 8px;
  padding: 7px 10px; border-radius: 10px; background: var(--sc-s50); border: 1px solid var(--sc-s200);
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-reply-accent { width: 3px; border-radius: 3px; background: var(--sc-red); flex-shrink: 0; }
.sc-reply-body { flex: 1; min-width: 0; }
.sc-reply-name { font-size: 11.5px; font-weight: 800; color: var(--sc-red); display: flex; align-items: center; gap: 5px; }
.sc-reply-name .ico { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.2; fill: none; }
.sc-reply-prev { font-size: 12px; font-weight: 500; color: var(--sc-s600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.sc-reply-x { flex-shrink: 0; align-self: center; width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--sc-s200); color: var(--sc-s600); font-size: 15px; line-height: 1; cursor: pointer; }
.sc-reply-x:hover { background: var(--sc-s300); color: var(--sc-ink); }

/* ── "Who reacted" sheet (tap a reaction pill) ────────────────────────────── */
.sc-react-info {
  position: fixed; z-index: 100004; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(340px, calc(100vw - 32px)); max-height: min(70vh, 560px);
  background: #fff; border: 1px solid var(--sc-s200); border-radius: 18px;
  box-shadow: var(--sc-shadow-panel); display: flex; flex-direction: column; overflow: hidden;
  animation: sc-fade-in-up .14s var(--sc-ease);
}
.sc-ri-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px 10px; font-size: 14px; font-weight: 800; color: var(--sc-ink); }
.sc-ri-x { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--sc-s100); color: var(--sc-s600); font-size: 17px; line-height: 1; cursor: pointer; padding: 0; }
.sc-ri-x:hover { background: var(--sc-s200); color: var(--sc-ink); }
.sc-ri-tabs { display: flex; gap: 4px; padding: 0 12px 8px; overflow-x: auto; border-bottom: 1px solid var(--sc-s100); flex-shrink: 0; }
.sc-ri-tab { flex-shrink: 0; padding: 6px 12px; border: none; background: none; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; color: var(--sc-s500); cursor: pointer; }
.sc-ri-tab b { font-weight: 800; color: var(--sc-s400); }
.sc-ri-tab.on { background: var(--sc-ink); color: #fff; }
.sc-ri-tab.on b { color: rgba(255,255,255,.7); }
.sc-ri-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px; }
.sc-ri-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: none; background: none; border-radius: 10px; font-family: inherit; text-align: left; }
.sc-ri-row.mine { cursor: pointer; }
.sc-ri-row.mine:hover { background: rgba(196,18,48,.06); }
.sc-ri-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: var(--sc-ink); display: flex; flex-direction: column; }
.sc-ri-tap { font-size: 10.5px; font-weight: 600; color: var(--sc-red); margin-top: 1px; }
.sc-ri-emoji { font-size: 22px; line-height: 1; flex-shrink: 0; }
/* dark */
.sc-react-info.sc-dark { background: #1E1F22; border-color: #000; }
.sc-react-info.sc-dark .sc-ri-h { color: #ECECED; }
.sc-react-info.sc-dark .sc-ri-x { background: #2A2C30; color: #9A9CA1; }
.sc-react-info.sc-dark .sc-ri-tabs { border-bottom-color: #2A2C30; }
.sc-react-info.sc-dark .sc-ri-tab { color: #9A9CA1; }
.sc-react-info.sc-dark .sc-ri-tab.on { background: var(--sc-red); color: #fff; }
.sc-react-info.sc-dark .sc-ri-name { color: #ECECED; }
.sc-react-info.sc-dark .sc-ri-row .sc-av { background: #2A2C30; color: #ECECED; }
.sc-react-info.sc-dark .sc-ri-row.mine:hover { background: rgba(196,18,48,.18); }
@media (prefers-reduced-motion: reduce) { .sc-react-info { animation: none; } }

/* ── Compose emoji button ─────────────────────────────────────────────────── */
.sc-emoji-btn {
  width: 42px; height: 42px; border-radius: 11px; background: var(--sc-s100); color: var(--sc-s600);
  display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; border: none; font-family: inherit;
  transition: all var(--sc-t);
}
.sc-emoji-btn:hover { background: var(--sc-s200); }
.sc-emoji-glyph { font-size: 20px; line-height: 1; }

/* ── Unified action menu (WhatsApp long-press / right-click) ──────────────── */
.sc-actions-backdrop { position: fixed; inset: 0; z-index: 100001; background: rgba(10,10,10,.28); animation: sc-fade-in-up .12s var(--sc-ease); }
.sc-actions {
  z-index: 100004; background: #fff; border: 1px solid var(--sc-s200);
  border-radius: 16px; box-shadow: var(--sc-shadow-panel);
  padding: 6px; min-width: 210px; max-width: min(320px, calc(100vw - 16px));
  display: flex; flex-direction: column; gap: 4px;
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-act-react {
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--sc-s50); border-radius: 999px; margin-bottom: 2px;
}
.sc-ar {
  flex: 1; height: 38px; border-radius: 50%; border: none; background: none;
  font-size: 21px; line-height: 1; cursor: pointer; padding: 0; font-family: inherit;
  display: flex; align-items: center; justify-content: center; transition: transform .1s var(--sc-ease), background var(--sc-t);
}
.sc-ar:hover { background: var(--sc-s200); transform: scale(1.14); }
.sc-ar.mine { background: rgba(196,18,48,.14); }
.sc-ar-more { color: var(--sc-s500); }
.sc-ar-more .ico { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.sc-act-grid {
  display: none; grid-template-columns: repeat(7, 1fr); gap: 1px;
  max-height: 210px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 4px 0; border-bottom: 1px solid var(--sc-s100); margin-bottom: 2px;
}
.sc-actions.grid-open .sc-act-grid { display: grid; }
.sc-ag { height: 34px; border-radius: 8px; border: none; background: none; font-size: 19px; cursor: pointer; padding: 0; }
.sc-ag:hover { background: var(--sc-s100); }
.sc-ag.mine { background: rgba(196,18,48,.12); }
.sc-act-list { display: flex; flex-direction: column; }
.sc-act-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: none; background: none; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; color: var(--sc-ink); cursor: pointer; font-family: inherit; text-align: left;
  transition: background var(--sc-t);
}
.sc-act-item:hover { background: var(--sc-s100); }
.sc-act-item .ico { width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; fill: none; flex-shrink: 0; color: var(--sc-s600); }
.sc-act-item.danger { color: var(--sc-red); }
.sc-act-item.danger .ico { color: var(--sc-red); }
.sc-act-item.danger:hover { background: rgba(196,18,48,.08); }
.sc-act-confirm { display: flex; flex-direction: column; gap: 2px; }
.sc-act-confirm-h { font-size: 12.5px; font-weight: 800; color: var(--sc-s500); padding: 6px 12px 4px; }

/* ── Compose emoji picker ─────────────────────────────────────────────────── */
.sc-emoji-picker {
  z-index: 100002; background: #fff; border: 1px solid var(--sc-s200);
  border-radius: 16px; box-shadow: var(--sc-shadow-panel);
  width: 328px; display: flex; flex-direction: column; overflow: hidden;
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-ep-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--sc-s100); background: var(--sc-s50); }
.sc-ep-tab { flex: 1; height: 34px; border: none; background: none; border-radius: 8px; font-size: 18px; cursor: pointer; padding: 0; transition: background var(--sc-t); }
.sc-ep-tab:hover { background: var(--sc-s100); }
.sc-ep-tab.on { background: #fff; box-shadow: var(--sc-shadow-rest); }
.sc-ep-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px;
  padding: 8px; height: 240px; overflow-y: auto; overscroll-behavior: contain;
  /* A-298: touch-action pan-y is required so the grid actually scrolls under a
     finger inside the fixed picker on Android WebView (the owner: "Emoji scroll
     not working"). -webkit-overflow-scrolling gives it momentum. */
  -webkit-overflow-scrolling: touch; touch-action: pan-y;
}
/* On phones the picker is a bottom sheet — give the grid more height so more
   emoji show and the scroll has somewhere to go. */
.sc-emoji-picker.mobile .sc-ep-grid { height: min(44vh, 340px); }
.sc-ep-e { height: 34px; border: none; background: none; border-radius: 8px; font-size: 21px; line-height: 1; cursor: pointer; padding: 0; transition: transform .08s var(--sc-ease), background var(--sc-t); }
.sc-ep-e:hover { background: var(--sc-s100); transform: scale(1.16); }
/* Search row (WhatsApp emoji search) */
.sc-ep-search { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--sc-s100); background: #fff; }
.sc-ep-search .ico { width: 15px; height: 15px; stroke: var(--sc-s400); stroke-width: 2; fill: none; flex-shrink: 0; }
.sc-ep-search-input { flex: 1; min-width: 0; border: none; outline: none; background: none; font: inherit; font-size: 13px; color: var(--sc-ink); }
.sc-ep-search-input::placeholder { color: var(--sc-s400); }
.sc-ep-search-x { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--sc-s200); color: var(--sc-s600); font-size: 13px; line-height: 1; cursor: pointer; padding: 0; }
.sc-ep-body { display: flex; flex-direction: column; min-height: 0; }
.sc-ep-empty { grid-column: 1 / -1; padding: 28px 12px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--sc-s400); }
/* Dark variants for the new search bits */
.sc-emoji-picker.sc-dark .sc-ep-search { background: #161719; border-bottom-color: #2A2C30; }
.sc-emoji-picker.sc-dark .sc-ep-search-input { color: #ECECED; }
.sc-emoji-picker.sc-dark .sc-ep-search-x { background: #2A2C30; color: #9A9CA1; }
.sc-emoji-picker.sc-dark .sc-ep-empty { color: #6B6D72; }

/* ── Attachment sheet (Photos & Videos / Document / Camera) ───────────────── */
.sc-attach-sheet {
  z-index: 100002; background: #fff; border: 1px solid var(--sc-s200);
  border-radius: 16px; box-shadow: var(--sc-shadow-panel); padding: 8px;
  display: flex; flex-direction: column; gap: 2px; min-width: 210px;
  animation: sc-fade-in-up .12s var(--sc-ease);
}
.sc-as-opt {
  display: flex; align-items: center; gap: 13px; width: 100%; padding: 9px 10px;
  border: none; background: none; border-radius: 10px; cursor: pointer; font-family: inherit; text-align: left;
  font-size: 13.5px; font-weight: 700; color: var(--sc-ink); transition: background var(--sc-t);
}
.sc-as-opt:hover { background: var(--sc-s100); }
.sc-as-ic { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.sc-as-ic .ico { width: 19px; height: 19px; stroke: currentColor; stroke-width: 2; fill: none; }
.sc-as-opt.photo .sc-as-ic { background: linear-gradient(135deg, #7C3AED, #A855F7); }
.sc-as-opt.doc .sc-as-ic { background: linear-gradient(135deg, #1D4ED8, #3B82F6); }
.sc-as-opt.cam .sc-as-ic { background: linear-gradient(135deg, #C41230, #E11D48); }

/* ── Forward preview + message-info bits ──────────────────────────────────── */
.sc-fwd-preview {
  display: flex; align-items: center; gap: 9px; margin: 12px 14px; padding: 10px 12px;
  border-radius: 10px; background: var(--sc-s50); border: 1px solid var(--sc-s200);
  font-size: 12.5px; font-weight: 600; color: var(--sc-s600);
}
.sc-fwd-preview .ico { width: 15px; height: 15px; stroke: var(--sc-red); stroke-width: 2; fill: none; flex-shrink: 0; }
.sc-fwd-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-msginfo-bubble { display: flex; flex-direction: column; align-items: flex-end; padding: 8px 0 4px; }
.sc-msginfo-bubble .sc-bubble.out { background: var(--sc-ink); color: #fff; border-radius: 14px; border-bottom-right-radius: 5px; padding: 8px 12px; max-width: 100%; }

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME — phones (native app + touch web). Matches the dialpad/deck.
   Desktop keeps the light theme. `.sc-dark` is set on .sc-panel AND on the
   body-level popups (menu / emoji picker / attach sheet).
   ═══════════════════════════════════════════════════════════════════════════ */
.sc-panel.sc-dark {
  --scd-bg: #131315;
  --scd-thread: #0D0D0F;
  --scd-surface: #1C1D20;
  --scd-surface-2: #26282C;
  --scd-line: #2A2C30;
  --scd-in: #26282C;
  --scd-out: #7E1122;
  --scd-txt: #ECECED;
  --scd-txt-dim: #9A9CA1;
  --scd-txt-faint: #6B6D72;
  background: var(--scd-bg);
  border-color: #000;
}
.sc-panel.sc-dark .sc-body { background: var(--scd-bg); }
.sc-panel.sc-dark .sc-ltabs { background: #0F0F11; border-bottom-color: var(--scd-line); }
.sc-panel.sc-dark .sc-ltab { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-ltab:hover { color: var(--scd-txt); }
.sc-panel.sc-dark .sc-ltab.on { background: var(--scd-surface-2); color: #fff; box-shadow: none; }
.sc-panel.sc-dark .sc-ltab-c { background: #000; color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-ltab.on .sc-ltab-c { background: var(--sc-red); color: #fff; }
.sc-panel.sc-dark .sc-row { border-bottom-color: var(--scd-line); }
.sc-panel.sc-dark .sc-row:hover { background: var(--scd-surface); }
.sc-panel.sc-dark .sc-av { background: var(--scd-surface-2); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-av.group { background: #2E2440; color: #C4B5FD; }
.sc-panel.sc-dark .sc-name { color: var(--scd-txt); }
.sc-panel.sc-dark .sc-name .ico { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-time { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-snippet { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-snippet b { color: var(--scd-txt); }
.sc-panel.sc-dark .sc-role { background: var(--scd-surface-2); color: var(--scd-txt-dim); }
/* Thread */
.sc-panel.sc-dark .sc-thread {
  background: var(--scd-thread);
  background-image: radial-gradient(circle at 18% 12%, rgba(196,18,48,.05) 0%, transparent 42%),
                    radial-gradient(circle at 85% 88%, rgba(255,255,255,.02) 0%, transparent 45%);
}
.sc-panel.sc-dark .sc-day { background: var(--scd-surface); border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-msg.in .sc-bubble { background: var(--scd-in); color: var(--scd-txt); border-color: transparent; }
.sc-panel.sc-dark .sc-msg.out .sc-bubble { background: var(--scd-out); color: #fff; border-color: transparent; }
.sc-panel.sc-dark .sc-msg-sender { color: #67B0FF; }
.sc-panel.sc-dark .sc-meta { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-msg.in .sc-mention { color: #67B0FF; }
.sc-panel.sc-dark .sc-cap { background: var(--scd-in); color: var(--scd-txt); border-color: transparent; }
.sc-panel.sc-dark .sc-msg.out .sc-cap { background: var(--scd-out); color: #fff; }
.sc-panel.sc-dark .sc-ticks.read { color: #4FC3F7; }
.sc-panel.sc-dark .sc-ticks.sent { color: rgba(255,255,255,.55); }
.sc-panel.sc-dark .sc-msg-trigger { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-msg.in .sc-bubble .sc-quote { background: rgba(255,255,255,.07); border-left-color: #67B0FF; }
.sc-panel.sc-dark .sc-msg.in .sc-quote-name { color: #67B0FF; }
.sc-panel.sc-dark .sc-msg.in .sc-quote-prev { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-system span { background: var(--scd-surface); border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-deleted { }
.sc-panel.sc-dark .sc-msg.in .sc-bubble.sc-deleted { background: var(--scd-surface); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-msg.out .sc-bubble.sc-deleted { background: #4A1018; color: rgba(255,255,255,.7); }
/* Reactions */
.sc-panel.sc-dark .sc-reaction { background: var(--scd-surface-2); border-color: var(--scd-line); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-reaction-n { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-reaction.mine { background: rgba(196,18,48,.24); border-color: rgba(196,18,48,.6); }
/* Compose */
.sc-panel.sc-dark .sc-compose { background: var(--scd-bg); border-top-color: var(--scd-line); }
.sc-panel.sc-dark .sc-input { background: var(--scd-surface-2); border-color: var(--scd-line); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-input.sc-empty:before { content: attr(data-sc-placeholder); color: var(--scd-txt-faint); opacity: 1; }
.sc-panel.sc-dark .sc-input:focus { background: var(--scd-surface-2); border-color: var(--sc-red); box-shadow: 0 0 0 3px rgba(196,18,48,.2); }
.sc-panel.sc-dark .sc-emoji-btn,
.sc-panel.sc-dark .sc-attach { background: var(--scd-surface-2); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-emoji-btn:hover,
.sc-panel.sc-dark .sc-attach:hover { background: var(--scd-line); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-send { background: var(--sc-red); }
.sc-panel.sc-dark .sc-send:hover { background: var(--sc-red-dark); }
.sc-panel.sc-dark .sc-reply-bar { background: var(--scd-surface); border-color: var(--scd-line); }
.sc-panel.sc-dark .sc-reply-prev { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-reply-x { background: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-editing-bar { background: var(--scd-surface); border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-mention-pop { background: var(--scd-surface); border-color: var(--scd-line); }
.sc-panel.sc-dark .sc-mention-opt { color: var(--scd-txt); }
.sc-panel.sc-dark .sc-mention-opt:hover, .sc-panel.sc-dark .sc-mention-opt.active { background: var(--scd-surface-2); }
/* New-chat picker + search + group info (dark) */
.sc-panel.sc-dark .sc-newbar,
.sc-panel.sc-dark .sc-create-bar { background: var(--scd-bg); border-color: var(--scd-line); }
.sc-panel.sc-dark .sc-search,
.sc-panel.sc-dark .sc-rename { background: var(--scd-surface-2); border-color: var(--scd-line); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-search::placeholder { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-mode-btn { background: var(--scd-surface-2); border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-mode-btn.on { background: var(--sc-red); border-color: var(--sc-red); color: #fff; }
.sc-panel.sc-dark .sc-pick-check { border-color: var(--scd-line); }
.sc-panel.sc-dark .sc-pick-check.on { background: var(--sc-red); border-color: var(--sc-red); }
.sc-panel.sc-dark .sc-info-mlist { border-color: var(--scd-line); }
.sc-panel.sc-dark .sc-info-mrow { border-bottom-color: var(--scd-line); }
.sc-panel.sc-dark .sc-info-name, .sc-panel.sc-dark .sc-info-sub { color: var(--scd-txt); }
.sc-panel.sc-dark .sc-info-add { background: var(--scd-surface); border-color: var(--scd-line); color: var(--scd-txt); }
.sc-panel.sc-dark .sc-fwd-preview { background: var(--scd-surface); border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-empty { color: var(--scd-txt-dim); }
.sc-panel.sc-dark .sc-empty-sub { color: var(--scd-txt-faint); }
.sc-panel.sc-dark .sc-msg-file { }
.sc-panel.sc-dark .sc-msg.in .sc-msg-file { background: var(--scd-in); color: var(--scd-txt); border-color: transparent; }
.sc-panel.sc-dark .sc-msg.out .sc-msg-file { background: var(--scd-out); }
/* Native deck list header on dark */
.sc-native.sc-dark .sc-h-deck { background: #0A0A0B; border-bottom-color: var(--scd-line); }
.sc-native.sc-dark .sc-deck-t { color: #fff; }
.sc-native.sc-dark .sc-deck-icbtn, .sc-native.sc-dark .sc-deck-close { border-color: var(--scd-line); color: var(--scd-txt-dim); }
.sc-native.sc-dark .sc-deck-icbtn:hover, .sc-native.sc-dark .sc-deck-close:hover { background: var(--scd-surface-2); color: #fff; }

/* Body-level popups on dark */
.sc-actions.sc-dark { background: #1E1F22; border-color: #000; }
.sc-actions.sc-dark .sc-act-react { background: #2A2C30; }
.sc-actions.sc-dark .sc-ar:hover { background: #3A3C40; }
.sc-actions.sc-dark .sc-act-grid { border-bottom-color: #2A2C30; }
.sc-actions.sc-dark .sc-ag:hover { background: #2A2C30; }
.sc-actions.sc-dark .sc-act-item { color: #ECECED; }
.sc-actions.sc-dark .sc-act-item .ico { color: #9A9CA1; }
.sc-actions.sc-dark .sc-act-item:hover { background: #2A2C30; }
.sc-actions.sc-dark .sc-act-item.danger { color: #FF6B7E; }
.sc-actions.sc-dark .sc-act-item.danger .ico { color: #FF6B7E; }
.sc-actions.sc-dark .sc-act-confirm-h { color: #9A9CA1; }
.sc-emoji-picker.sc-dark { background: #1E1F22; border-color: #000; }
.sc-emoji-picker.sc-dark .sc-ep-tabs { background: #161719; border-bottom-color: #2A2C30; }
.sc-emoji-picker.sc-dark .sc-ep-tab:hover { background: #2A2C30; }
.sc-emoji-picker.sc-dark .sc-ep-tab.on { background: #2A2C30; box-shadow: none; }
.sc-emoji-picker.sc-dark .sc-ep-e:hover { background: #2A2C30; }
.sc-attach-sheet.sc-dark { background: #1E1F22; border-color: #000; }
.sc-attach-sheet.sc-dark .sc-as-opt { color: #ECECED; }
.sc-attach-sheet.sc-dark .sc-as-opt:hover { background: #2A2C30; }

@media (prefers-reduced-motion: reduce) {
  .sc-actions, .sc-emoji-picker, .sc-attach-sheet, .sc-actions-backdrop, .sc-reply-bar { animation: none !important; }
  .sc-ar:hover, .sc-ep-e:hover, .sc-ag:hover { transform: none; }
  .sc-msg.sc-flash .sc-bubble { animation: none; }
}

/* A-273 — Light/Dark theme toggle chip (rides sc-h-btn / sc-deck-icbtn base;
   the emoji glyph just needs sizing so it reads at a glance). */
.sc-theme-toggle { font-size: 15px; line-height: 1; }

/* ─────────────────────────────────────────────────────────────────────────────
   A-283 — thin, theme-matched scrollbars on the comms scrollers. A dark chat
   panel with a default OS/WebView scrollbar shows a stray light "bar" down the
   right edge (Phoenix: "weird bar down the side"). Make every chat scroller use
   a thin, semi-transparent overlay scrollbar that reads correctly on BOTH the
   light (desktop) and dark (phone) skins.
   ───────────────────────────────────────────────────────────────────────────── */
.sc-thread, .sc-body, .sc-list, .sc-ri-list, .sc-info-mlist,
.sc-mention-list, .sc-attach-grid, .sc-emoji-grid {
  scrollbar-width: thin;                         /* Firefox */
  scrollbar-color: rgba(140,140,150,.45) transparent;
}
.sc-thread::-webkit-scrollbar, .sc-body::-webkit-scrollbar, .sc-list::-webkit-scrollbar,
.sc-ri-list::-webkit-scrollbar, .sc-info-mlist::-webkit-scrollbar,
.sc-mention-list::-webkit-scrollbar, .sc-attach-grid::-webkit-scrollbar,
.sc-emoji-grid::-webkit-scrollbar { width: 6px; height: 6px; }
.sc-thread::-webkit-scrollbar-track, .sc-body::-webkit-scrollbar-track, .sc-list::-webkit-scrollbar-track,
.sc-ri-list::-webkit-scrollbar-track, .sc-info-mlist::-webkit-scrollbar-track,
.sc-mention-list::-webkit-scrollbar-track, .sc-attach-grid::-webkit-scrollbar-track,
.sc-emoji-grid::-webkit-scrollbar-track { background: transparent; }
.sc-thread::-webkit-scrollbar-thumb, .sc-body::-webkit-scrollbar-thumb, .sc-list::-webkit-scrollbar-thumb,
.sc-ri-list::-webkit-scrollbar-thumb, .sc-info-mlist::-webkit-scrollbar-thumb,
.sc-mention-list::-webkit-scrollbar-thumb, .sc-attach-grid::-webkit-scrollbar-thumb,
.sc-emoji-grid::-webkit-scrollbar-thumb { background: rgba(140,140,150,.45); border-radius: 6px; }
.sc-thread::-webkit-scrollbar-thumb:hover, .sc-body::-webkit-scrollbar-thumb:hover {
  background: rgba(140,140,150,.7);
}
