/* ============================================================================
   Unified Replies page — SGM-701
   Cross-campaign reply triage. Colors/radius/shadow are app.css tokens only
   (zero raw hex); spacing is px (app.css has no spacing tokens).
   ============================================================================ */

.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.rp-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 3px; }
.rp-title .rp-cnt { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 8px; }
.rp-sub { font-size: 12.5px; color: var(--text-muted); margin: 0; }

/* stat tiles */
.rp-stats { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.rp-stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; }
.rp-stat .n { font-size: 20px; font-weight: 800; line-height: 1; }
.rp-stat .l { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.rp-stat.attn { border-color: var(--danger-border); background: var(--danger-bg); }
.rp-stat.attn .n { color: var(--danger); }

/* filter bar */
.rp-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; background: var(--primary-bg); border: 1px solid var(--primary-border); border-radius: var(--radius); margin-bottom: 16px; }
.rp-filters input, .rp-filters select { border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; background: var(--bg-input); color: var(--text); }
.rp-filters .rp-search { flex: 1; min-width: 220px; }
.rp-filters input:focus, .rp-filters select:focus { outline: none; border-color: var(--border-focus); }

/* table */
.rp-tbl { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rp-tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg-card-hover); }
.rp-tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
.rp-tbl tr:last-child td { border-bottom: none; }
.rp-tbl tbody tr:hover td { background: var(--bg-card-hover); }
.rp-tbl tr.unread td { background: var(--primary-bg); }
.rp-who { font-weight: 600; }
.rp-who .co { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.rp-snip { color: var(--text-secondary); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-camp { font-size: 12px; color: var(--text-muted); }
.rp-time { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.rp-unreaddot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--danger); display: inline-block; margin-right: 6px; vertical-align: middle; }

/* intent chips */
.rp-intent { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; border-radius: var(--radius-full); padding: 3px 9px; border: 1px solid transparent; white-space: nowrap; }
.rp-intent i { width: 12px; height: 12px; }
.rp-intent .conf { color: var(--text-dim); font-weight: 400; }
.rp-intent.opt_out { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-border); }
.rp-intent.high_intent { color: var(--accent); background: var(--accent-bg); border-color: var(--success-border); }
.rp-intent.question { color: var(--primary); background: var(--primary-bg); border-color: var(--primary-border); }
.rp-intent.not_interested { color: var(--text-muted); background: var(--bg-card-hover); border-color: var(--border); }
.rp-intent.out_of_office { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-border); }
.rp-intent.referral { color: var(--purple); background: var(--purple-bg); border-color: var(--purple-border); }
.rp-intent.pending { color: var(--text-dim); background: var(--bg-card-hover); border-color: var(--border); }

/* status */
.rp-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-full); }
.rp-status.new { color: var(--primary); background: var(--primary-bg); }
.rp-status.handled, .rp-status.skipped { color: var(--text-muted); background: var(--bg-card-hover); }
.rp-status.forwarded, .rp-status.replied { color: var(--accent); background: var(--accent-bg); }
.rp-status.suppressed { color: var(--danger); background: var(--danger-bg); }

/* row actions */
.rp-acts { display: flex; gap: 4px; }
.rp-iact { width: 28px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.rp-iact:hover { background: var(--bg-card-hover); }
.rp-iact i { width: 14px; height: 14px; }
.rp-iact.primary { border-color: var(--primary-border); color: var(--primary); background: var(--primary-bg); }

/* reply drawer — reuses the inbox drawer shell (inbox.css) for the composer;
   this only styles the read-only "in reply to" context block. */
.rp-context { background: var(--bg-card-hover); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }
.rp-context .rp-context-h { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }

/* rows open the full reply on click */
.rp-tbl tr.rp-row { cursor: pointer; }
.rp-sender { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* SGM-704: detail drawer thread (original sent email + full reply) */
/* SGM-7: the drawer body (.inbox-drawer-body) is a flex column with
   overflow:hidden; the thread is its sole child, so it must be the scroll
   region — flex:1 to fill the space between the fixed head/foot, min-height:0
   to allow it to shrink below content size (else overflow:auto never engages),
   overflow-y:auto to scroll long threads. Head + foot stay pinned. */
.rp-thread { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* SGM-7: the global assistant FAB is fixed bottom-right at a high z-index and
   overlaps the drawer footer's Reply button. Hide it while any drawer overlay
   is open (the drawer covers that corner anyway). */
body:has(.inbox-drawer-overlay) .assistant-fab { display: none; }
.rp-msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.rp-msg.out { background: var(--primary-bg); border-color: var(--primary-border); }
.rp-msg.in { background: var(--bg-card); }
.rp-msg-h { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; }
.rp-msg-subj { font-weight: 700; font-size: 13.5px; color: var(--text); margin-bottom: 6px; }
.rp-msg-body { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.rp-msg-body a { color: var(--primary); }
/* Real signatures carry unbroken tracking URLs that otherwise blow out the card. */
.rp-msg-body { overflow-wrap: anywhere; }

/* ============================================================================
   SGM-137 — the conversation drawer.
   Colors/radius/shadow are app.css tokens only (zero raw hex); spacing is px,
   matching this file's existing convention. Both themes come free because every
   token below is redefined under [data-theme="dark"] in app.css.
   ============================================================================ */

/* Queue context — what is still going to happen to this person. One line, above
   the thread, never a message: `approved` rows are future sends and `cancelled`
   ones were pulled, so rendering them as messages would show the recipient words
   they never received. */
.rp-qctx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font-size: 11.5px; color: var(--text-muted); padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-card-hover); border: 1px solid var(--border);
  border-radius: var(--radius); flex-shrink: 0; }
.rp-qctx i { width: 13px; height: 13px; }
.rp-qctx .stop { color: var(--warning); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.rp-qctx .sched { display: inline-flex; align-items: center; gap: 5px; }

/* The fold. ONE control whatever the thread length — Miller's Law is the binding
   constraint here, and collapsing is the feature rather than decoration. */
.rp-fold { width: 100%; text-align: left; cursor: pointer; font-size: 12px;
  font-weight: 600; color: var(--text-secondary); background: var(--bg-card-hover);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px;
  display: flex; align-items: center; gap: 8px; }
.rp-fold:hover { background: var(--bg-card); }
.rp-fold:focus-visible { outline: none; border-color: var(--border-focus); }
.rp-fold i { width: 14px; height: 14px; color: var(--text-muted); }
.rp-fold .n { color: var(--text-muted); font-weight: 400; }

/* A folded message: exactly one line, so the arc of the sequence reads with no
   body text at all. Keyboard-operable — it carries role=button + tabindex. */
.rp-foldrow { display: flex; align-items: baseline; gap: 8px; padding: 7px 12px;
  font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); cursor: pointer; }
.rp-foldrow:hover { background: var(--bg-card-hover); }
.rp-foldrow:focus-visible { outline: none; border-color: var(--border-focus); }
.rp-foldrow .dir { width: 13px; height: 13px; flex-shrink: 0; color: var(--text-dim); }
.rp-foldrow .who { font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.rp-foldrow .subj { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; min-width: 0; flex: 1; }
.rp-foldrow .t { margin-left: auto; color: var(--text-dim); font-size: 11px;
  white-space: nowrap; flex-shrink: 0; }

/* The reply being triaged. A 3px accent, NOT a colour change — the card already
   carries direction colour, and a second dialect in one region is pill soup. */
.rp-msg.cur { border-left: 3px solid var(--primary); }

/* Per-message sender identity. Greg Clough's thread crosses three addresses, so a
   thread-level "from" would be actively misleading. */
.rp-msg-h .from { color: var(--text-secondary); font-weight: 600; }
.rp-msg-h .sep { color: var(--text-dim); }

/* 4,865 sent rows have no stored body. Say so — the message WAS sent, and a blank
   card would make the history wrong. */
.rp-msg-empty { font-size: 13px; color: var(--text-dim); font-style: italic; }

/* An out-of-office is context, not a work item: labelled, never hidden. */
.rp-autolbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-dim); border: 1px solid var(--border);
  border-radius: var(--radius-full); padding: 1px 7px; margin-left: 6px; }

/* Outbound bodies clamp; inbound never does. The reply is what Emma came to read,
   a 3,000-character marketing email is what buries it. */
.rp-more { border: none; background: none; padding: 0; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--primary); }
.rp-more:hover { text-decoration: underline; }
.rp-more:focus-visible { outline: none; text-decoration: underline; }
