/**
 * sales-reps-email.css — Sales Reps: reps' own email (js/sales-reps-email.js, App.SalesRepsEmail).
 *
 * The "Your email" card on My settings, every email with a customer on their booking and deal (Follow-up), the rep's
 * Email and the manager's Team email (the list, and one thread beside it or, on a phone, taking the screen with Back),
 * the email line on the team lists and the owner's "Never keep emails with" card.
 *
 * Built from the app shell (.card, .card-head, .card-body, .btn, .badge, .field, .textarea, .input) and the shared Sales
 * Reps pieces (css/sales-reps.css: .sr-list, .sr-li, .sr-setrow, .sr-err), laid out as the call history lays out its
 * list and one call (css/sales-reps-call-history.css). Design tokens only. Every class is srem- or scoped under .srem,
 * so nothing else moves. After sales-reps.css and sales-reps-rep.css.
 */

/* ── small utilities ── */
.srem p { margin: 0; }
.srem .srem-muted { color: var(--text-3); }
.srem .srem-small { font-size: 13px; }
.srem .srem-mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 13.5px; overflow-wrap: anywhere; }
.srem .srem-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.srem .srem-grow { flex: 1; min-width: 0; }
.srem .srem-body { display: flex; flex-direction: column; gap: 12px; }
.srem .srem-line { font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
.srem .srem-warn { color: var(--warn); font-weight: 600; }
.srem .srem-empty { padding: 28px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
/* A staff session's line under buttons only the person can press (js staffLine); under a row, it sits close to it. */
.srem .srem-staffrow { padding-top: 0; }
.srem h2.card-title { margin: 0; }

/* ── one email: who and when, the subject, the words, and its Reply ── */
.srem .srem-li { display: block; padding: 14px 20px; }
.srem .srem-mail { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.srem .srem-mail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.srem .srem-who { font-weight: 600; font-size: 14px; color: var(--text); }
.srem .srem-mail.is-out .srem-who { color: var(--accent-deep); }
.srem .srem-subj { font-size: 13px; color: var(--text-3); }
.srem .srem-text { font-size: 15px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.srem .srem-mail .srem-row { margin-top: 2px; }
.srem .srem-reply { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 12px; }
.srem .srem-reply .field { margin: 0; }
.srem .srem-reply-text { min-height: 112px; resize: vertical; font-size: 15px; }
.srem [data-srem-box]:empty { display: none; }

/* ── the list: a mail app's rows, each opening its thread wherever it is tapped ── */
.srem .srem-thread { width: 100%; border: 0; border-top: 1px solid var(--border-soft); border-radius: 0; background: none; font: inherit; color: inherit;
  text-align: left; cursor: pointer; align-items: flex-start; min-height: 48px; }
.srem .srem-thread:first-child { border-top: 0; }
.srem .srem-thread:hover { background: var(--surface-2); }
.srem .srem-thread.is-on { background: var(--accent-softer); box-shadow: inset 3px 0 0 var(--accent); }
.srem .srem-thread.is-waiting .srem-name { font-weight: 700; }
.srem .srem-thread:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.srem .srem-thread .grow { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.srem .srem-thread-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.srem .srem-name { font-weight: 600; font-size: 14.5px; color: var(--text); overflow-wrap: anywhere; }
.srem .srem-meta { font-size: 13px; color: var(--text-3); }
.srem .srem-snip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; color: var(--text-2); }
.srem .srem-chev { color: var(--text-3); font-size: 20px; line-height: 1; align-self: center; }

/* ── one thread: its customer, every email oldest first, and the reply box under them ── */
.srem .srem-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; align-items: start; }
.srem .srem-split > .card + .card { margin-top: 0; }
.srem .srem-thread-card .card-head { align-items: flex-start; }
.srem .srem-x { font-size: 20px; line-height: 1; min-width: 40px; }
.srem .srem-backbar { display: none; }
.srem .srem-foot { border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 10px; }
.srem .srem-foot .srem-reply { margin: 0; }
.srem .srem-connect { margin-bottom: 16px; }
.srem .srem-connect + .srem-split, .srem .srem-connect + .srem-list { margin-top: 0; }
.srem .page-head .sub .srem-subline { display: block; }
.srem .page-head .sub .srem-state { display: block; margin-top: 4px; font-size: 13.5px; color: var(--text-3); }
.srem .srem-pick { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* Beside the list, the open thread stays in view while the list scrolls, as a mail reading pane does. It opens on the
   newest email and the reply box (js drawInbox), with the customer's name and Close kept at its top. */
@container sr-area (min-width: 761px) {
  .srem .srem-split > [data-srem-detail] { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .srem .srem-split > [data-srem-detail] > .card-head { position: sticky; top: 0; z-index: 1; background: var(--surface); }
}
/* One column (a phone, or a narrow window): the open thread takes the screen, as a message does in a mail app, with Back
   at its top in place of Close. */
@container sr-area (max-width: 760px) {
  .srem .srem-split { grid-template-columns: minmax(0, 1fr); }
  .srem .srem-split > [data-srem-list] { display: none; }
  .srem [data-srem-detail] .srem-x { display: none; }
  .srem .srem-backbar { display: block; padding: 10px 12px 0; }
  .srem .srem-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 8px 12px 8px 6px; font-size: 15px; font-weight: 600; }
  .srem .srem-li { padding: 14px 16px; }
  .srem .page-head { flex-wrap: wrap; gap: 12px; }
  .srem .srem-pick { max-width: 100%; }
}

/* A host's slot for a card this module draws: nothing there (a server without email yet) takes no room. */
[data-srr-mail]:empty, [data-sr-never-log]:empty { display: none; }

/* ── the team lists' line: whether each person's mailbox is connected ── */
.srem-teamline.is-stopped { color: var(--warn); font-weight: 600; }
.srem-teamline.is-on { color: var(--good); }

/* ── the owner's "Never keep emails with" ── */
.srem .srem-never-add { display: flex; gap: 8px; align-items: center; margin: 0; }
.srem .srem-never-add .input { flex: 1 1 auto; min-width: 0; }
.srem .srem-never-list { border-top: 1px solid var(--border-soft); }
.srem .srem-never-li { padding: 10px 20px; }
.srem .srem-err:empty { display: none; }
.srem .srem-err { color: var(--danger); font-size: 13px; }
