/* ---------------- emails (EM-1; EM-1.5's restyle partly reversed by Parity 9) ----------------
 * The Emails page: Billdr's three panes — project list, the
 * open project's merged stream, team + quick actions. EM-1.5
 * rebuilt the anatomy to Billdr's own page (right-headed send
 * cards, the filed PDF as an attachment chip with a ⋮ menu);
 * Parity 9 reversed the three moves that contradicted the
 * design of record — the status dropdown (§5.1: none, ever),
 * the per-stage pill palette forced on this list whatever
 * skin the portal wears, and the note affordance repeated
 * under every send card (the one door stands at the stream's
 * foot). Split
 * out of styles.css the way notifications.css was in NOTIF-1 —
 * styles.css rides the per-file upload ceiling, and this page's
 * styles are a module of their own. The shapes it borrows wear
 * their own files' rules as-is: the pin (.conv-pin, chat.css),
 * the stage pill, the composer and its attachments (chat.css),
 * the avatar chips (styles.css). */

.em-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 250px; gap: 18px; align-items: start; }

/* ---- the project list ---- */
.em-pane-list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
#em-search { width: 100%; margin-bottom: 10px; }
.em-row { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px; padding: 10px; cursor: pointer; font: inherit; color: inherit; }
.em-row:hover { background: #f2f5f9; }
.em-row.active { background: #e8edf3; }
.em-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.em-row-top { display: flex; align-items: baseline; gap: 8px; }
.em-row-name { font-weight: 700; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-row-date { margin-left: auto; flex: none; color: var(--muted); font-size: 12.5px; }
.em-row-addr { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-row-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.em-row-meta:empty { display: none; }
/* The unread pill: navy, like the Conversations list's — red
 * stays for errors and deletes. */
.em-unread { background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; }
.em-row:has(.em-unread) .em-row-name { color: var(--ink); }
/* The row's stage chip is the ONE shared chip
 * (projectStatusPill) in the portal skin's own colours —
 * the same dress the board and the Projects list wear
 * (design §4). Billdr's per-stage palette already lives in
 * styles.css under the Billdr skin, where it belongs;
 * EM-1.5's page-scoped copy of it is gone (Parity 9). */
#em-list-note { font-size: 12.5px; margin: 8px 2px 0; }
.em-loading { padding: 6px 2px; }

/* ---- the thread pane ---- */
.em-pane-thread { position: relative; min-width: 0; }
.em-back { display: none; margin-bottom: 10px; }
.em-thread-head { margin-bottom: 14px; }
.em-thread-head h2 { margin: 0 0 2px; }
.em-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.em-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.em-card-head .msg-av { margin: 0; flex: none; }
.em-card-time { margin-left: auto; flex: none; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.em-body { white-space: pre-wrap; word-break: break-word; }
.em-edited { font-size: 12px; margin: 4px 0 0; }
.em-more { padding: 0; font-size: 13px; }

/* Send cards wear the email shape (EM-1.5, Billdr's dress):
 * a head row — the kind named quietly at the left, the sender
 * at the right (name, time, avatar) — then the bold subject,
 * the To/Cc header block, the record's own lines, the filed
 * PDF as an attachment chip, and the standing parallel tag. */
.em-send-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.em-eyebrow { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.em-send-who { margin-left: auto; flex: none; display: flex; align-items: center; gap: 8px; min-width: 0; }
.em-send-who .em-card-time { margin-left: 0; }
.em-send-who .msg-av { margin: 0; flex: none; }
.em-tocc { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; margin-bottom: 10px; font-size: 13.5px; }
.em-tocc p { margin: 0; }
.em-tocc-k { color: var(--muted); font-weight: 700; }
.em-send-subject { font-weight: 700; font-size: 15px; margin: 0 0 4px; }
.em-send-line { margin: 0 0 4px; }
.em-pdf { margin: 0 0 4px; color: var(--muted); font-size: 13.5px; }
/* The filed PDF as an attachment chip (EM-1.5): file icon,
 * the document's name, and a ⋮ whose menu (Open · Download)
 * drops under its own button, right-aligned — never detached
 * to the other side of the card. */
.em-att { display: flex; align-items: center; gap: 9px; max-width: 460px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; padding: 7px 7px 7px 12px; margin: 0 0 8px; }
.em-att-name { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-att-wrap { position: relative; margin-left: auto; flex: none; }
.em-att-btn { display: inline-flex; align-items: center; background: none; border: 0; border-radius: 7px; padding: 5px; cursor: pointer; color: var(--muted); }
.em-att-btn:hover { background: #eef1f5; color: var(--ink); }
.em-att-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 148px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; display: flex; flex-direction: column; }
.em-att-menu.hidden { display: none; }
.em-att-item { background: none; border: 0; border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; color: var(--ink); }
.em-att-item:hover { background: #f2f5f9; }
.em-tagrow { margin: 8px 0 0; }
.em-ptag { display: inline-block; background: #fdf6e3; border: 1px solid #e7d9ae; color: #6d5a1e; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* Outcomes are events, not messages: a slimmer card. */
.em-outcome { background: #f7f9fc; box-shadow: none; padding: 11px 16px; }
.em-outcome-line { margin: 0 0 2px; font-size: 14.5px; }
.em-outcome p { margin: 0; }

/* Notes read quieter than messages — internal furniture. */
.em-note { background: #fffdf4; }
.em-tag { flex: none; background: #f3ecd4; color: #6d5a1e; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }

/* "+ Add internal note" — Billdr's quiet centred affordance. */
.em-addnote { text-align: center; margin: 2px 0 14px; }
.em-notebox { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.em-note-input { width: 100%; }
.em-notebox-bar { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* The visibility banner: one quiet line directly above the
 * composer, computed per project (emBannerText). */
.em-banner { background: #eef3e8; border: 1px solid #d3dec4; color: #3e5228; border-radius: 10px; padding: 9px 13px; font-size: 13.5px; margin: 0 0 10px; }
.em-banner:empty { display: none; }

/* The pane machinery's shadow list: rendered by chat.js after
 * a write, never shown — this page's stream is the reader. */
.em-shadow { display: none; }

/* ---- the right rail ---- */
.em-rail-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.em-rail-card h3 { font-size: 14px; margin: 0 0 10px; }
.em-member { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; }
.em-member:last-child { margin-bottom: 0; }
.em-member .msg-av { margin: 0; flex: none; }
.em-member-name { font-weight: 600; }
/* Quick actions wear Billdr's full-width outline dress. */
#em-actions .btn { display: block; width: 100%; text-align: center; }

/* ---- narrow screens: the panes stack, list → thread → rail
 * (the design's responsive note; the portal's ≤900px pattern —
 * the thread takes the column once a project is open, the back
 * button returns to the list). ---- */
@media (max-width: 1100px) {
  .em-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .em-rail { grid-column: 2; }
}
@media (max-width: 900px) {
  .em-layout { grid-template-columns: 1fr; }
  .em-rail { grid-column: auto; }
  .em-back { display: inline-flex; }
  .em-layout .em-pane-list { display: block; }
  .em-layout .em-pane-thread, .em-layout .em-rail { display: none; }
  .em-layout.show-thread .em-pane-thread { display: block; }
  .em-layout.show-thread .em-rail { display: block; }
  .em-layout.show-thread .em-pane-list { display: none; }
}

/* ======================= DW1 · Emails page (design wave, 2026-10-17) ======================= */
/* Capture §11 (Billdr's project Communications → Emails), in gold.
 * Three panes stay: the project list (ours — Billdr's page is per
 * project), the thread card, the rail. The thread becomes one white
 * card: chat-style bubbles in the right portion with the sender line
 * above each (bold name · grey time · avatar, right-aligned), internal
 * notes on the left in the dashed "internal" frame, the light-grey
 * info banner at the thread's foot, then the rounded composer. The
 * composer's own rules live in chat.css; they are overridden here,
 * scoped to #view-emails, so Chat and Conversations keep theirs. */

body.skin-billdr #app #view-emails .em-layout { grid-template-columns: 300px minmax(0, 1fr) 260px; gap: 20px; }

/* -- the project list: white card, full-width search, quiet rows -- */
body.skin-billdr #app #view-emails .em-pane-list { background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); padding: 12px; box-shadow: none; }
body.skin-billdr #app #view-emails #em-search { width: 100%; margin: 0 0 8px; font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-emails .em-row { border-radius: var(--ds-r-sm); padding: 12px 10px; gap: 8px; }
body.skin-billdr #app #view-emails .em-row + .em-row { margin-top: 2px; }
body.skin-billdr #app #view-emails .em-row:hover { background: var(--ds-tint); }
body.skin-billdr #app #view-emails .em-row.active { background: var(--ds-nav-active); }
body.skin-billdr #app #view-emails .em-row-name { font-size: var(--ds-fs); font-weight: 700; color: var(--ds-navy); }
body.skin-billdr #app #view-emails .em-row-date { font-size: var(--ds-fs-xs); color: var(--ds-muted); }
body.skin-billdr #app #view-emails .em-row-addr { font-size: var(--ds-fs-sm); color: var(--ds-muted); }
body.skin-billdr #app #view-emails .em-row-meta { margin-top: 6px; }
body.skin-billdr #app #view-emails .em-unread { background: var(--ds-navy); font-weight: 600; padding: 3px 7px; }
body.skin-billdr #app #view-emails #em-list-note { font-size: var(--ds-fs-xs); color: var(--ds-muted); }

/* -- the thread card -- */
body.skin-billdr #app #view-emails .em-pane-thread {
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); padding: 20px 24px 22px;
}
/* "All projects" is the narrow-screen back door only (the shared .btn
 * display rule had been showing it at desktop widths). */
body.skin-billdr #app #view-emails .em-back { display: none; }
body.skin-billdr #app #view-emails .em-thread-head { margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--ds-hair); }
body.skin-billdr #app #view-emails #em-title { font-size: var(--ds-fs-xl); font-weight: 700; color: var(--ds-navy); line-height: 1.25; margin: 0 0 2px; }
body.skin-billdr #app #view-emails #em-meta { font-size: var(--ds-fs-sm); color: var(--ds-muted); margin: 0; }
body.skin-billdr #app #view-emails #em-stream > .muted,
body.skin-billdr #app #view-emails #em-stream > .empty { font-size: var(--ds-fs-sm); color: var(--ds-muted); padding: 14px 0; }

/* bubbles: white, thin grey border, soft shadow, right portion */
body.skin-billdr #app #view-emails .em-card {
  position: relative; width: auto; max-width: 78%; margin: 40px 0 14px auto; padding: 14px 18px 16px;
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r);
  box-shadow: 0 1px 2px rgba(15, 34, 51, .05), 0 6px 16px -10px rgba(15, 34, 51, .18);
}
/* the sender line sits above its bubble, right-aligned */
body.skin-billdr #app #view-emails .em-card > :is(.em-card-head, .em-send-head) {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 7px); margin: 0;
  display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0;
}
body.skin-billdr #app #view-emails .em-chat > .em-card-head > b { order: 1; }
body.skin-billdr #app #view-emails .em-chat > .em-card-head > .em-card-time { order: 2; margin-left: 0; }
body.skin-billdr #app #view-emails .em-chat > .em-card-head > .msg-av { order: 3; }
body.skin-billdr #app #view-emails :is(.em-card-head, .em-send-who) > b { font-size: var(--ds-fs-sm); font-weight: 700; color: var(--ds-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.skin-billdr #app #view-emails .em-card-time { font-size: var(--ds-fs-xs); color: var(--ds-muted); white-space: nowrap; }
body.skin-billdr #app #view-emails :is(.em-card-head, .em-send-who) .msg-av { width: 28px; height: 28px; font-size: 10px; border: 0; }
/* send cards: the kind stays named quietly at the left of that line */
/* a send's line (kind · sender · time · avatar) may run wider than
 * its bubble: it grows leftward from the bubble's right edge. */
body.skin-billdr #app #view-emails .em-card > .em-send-head { left: auto; width: max-content; max-width: calc(100% / .78); gap: 12px; }
body.skin-billdr #app #view-emails .em-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ds-muted); }
body.skin-billdr #app #view-emails .em-send-who { gap: 8px; margin-left: auto; }
/* inside the bubble: bold subject, grey To:/Cc:, hairline, body */
body.skin-billdr #app #view-emails .em-send-subject { font-size: var(--ds-fs-md); font-weight: 700; color: var(--ds-navy); margin: 0 0 6px; }
body.skin-billdr #app #view-emails .em-tocc {
  background: none; border: 0; border-radius: 0; padding: 0 0 10px; margin: 0 0 12px;
  border-bottom: 1px solid var(--ds-hair); font-size: var(--ds-fs-sm); color: var(--ds-muted); line-height: 1.55;
}
body.skin-billdr #app #view-emails .em-tocc-k { color: var(--ds-muted); font-weight: 600; }
body.skin-billdr #app #view-emails .em-send-line { font-size: var(--ds-fs); color: var(--ds-ink); margin: 0 0 4px; }
body.skin-billdr #app #view-emails .em-pdf { font-size: var(--ds-fs-sm); color: var(--ds-muted); margin: 6px 0 4px; }
body.skin-billdr #app #view-emails .em-body { font-size: var(--ds-fs); color: var(--ds-ink); line-height: 1.55; margin: 0; }
body.skin-billdr #app #view-emails .em-more { display: inline-block; margin-top: 6px; font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-emails .em-edited { font-size: var(--ds-fs-xs); color: var(--ds-faint); }
/* attachment chip */
body.skin-billdr #app #view-emails .em-att {
  max-width: 380px; margin: 10px 0 4px; padding: 6px 6px 6px 12px; gap: 10px;
  background: var(--ds-tint); border: 1px solid var(--ds-line); border-radius: var(--ds-r-ctl);
}
body.skin-billdr #app #view-emails .em-att > .ico { color: var(--ds-muted); flex: none; }
body.skin-billdr #app #view-emails .em-att-name { font-size: var(--ds-fs-sm); font-weight: 600; color: var(--ds-navy); }
body.skin-billdr #app #view-emails .em-att-btn { color: var(--ds-gold-ink); border-radius: var(--ds-r-sm); }
body.skin-billdr #app #view-emails .em-att-btn .ico { stroke-width: 3; }
body.skin-billdr #app #view-emails .em-att-btn:hover { background: var(--ds-bg); color: var(--ds-gold-ink-hover); }
body.skin-billdr #app #view-emails .em-att-menu { border-color: var(--ds-line); border-radius: var(--ds-r-ctl); box-shadow: var(--ds-shadow-pop); padding: 4px; }
body.skin-billdr #app #view-emails .em-att-item { font-size: var(--ds-fs-sm); padding: 9px 10px; border-radius: 6px; }
body.skin-billdr #app #view-emails .em-att-item:hover { background: var(--ds-bg); }
/* the standing "parallel record" tag: the amber note tokens */
body.skin-billdr #app #view-emails .em-tagrow { margin: 10px 0 0; }
body.skin-billdr #app #view-emails .em-ptag { background: var(--ds-warn-bg); border: 1px solid var(--ds-warn-line); color: var(--ds-warn-ink); font-weight: 600; padding: 2px 10px; }

/* internal notes: left side, dashed grey "internal" frame, no shadow */
body.skin-billdr #app #view-emails .em-card.em-note {
  margin: 40px auto 14px 0; background: var(--ds-tint); border: 1px dashed var(--ds-line-strong); box-shadow: none;
}
body.skin-billdr #app #view-emails .em-note > .em-card-head { justify-content: flex-start; }
body.skin-billdr #app #view-emails .em-tag {
  background: var(--ds-neutral-bg); color: var(--ds-neutral-ink); border-radius: var(--ds-r-pill);
  padding: 2px 9px; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none;
}
/* outcomes are events: a slim centred grey line card */
body.skin-billdr #app #view-emails .em-card.em-outcome {
  margin: 18px auto; max-width: 78%; padding: 10px 16px; background: var(--ds-tint); border: 1px solid var(--ds-hair); box-shadow: none; text-align: center;
}
body.skin-billdr #app #view-emails .em-outcome-line { font-size: var(--ds-fs-sm); color: var(--ds-navy); }
body.skin-billdr #app #view-emails .em-outcome .muted { font-size: var(--ds-fs-xs); }
body.skin-billdr #app #view-emails .em-card.is-deleted { margin-top: 14px; background: var(--ds-tint); box-shadow: none; color: var(--ds-muted); font-size: var(--ds-fs-sm); }

/* "+ Add internal note": a faint grey link under the bubble column
 * (one per thread, at the stream's foot — Billdr repeats it under
 * every bubble; Parity 9 kept the single door). */
body.skin-billdr #app #view-emails .em-addnote { text-align: right; margin: -4px 0 16px; }
body.skin-billdr #app #view-emails #em-addnote-btn { color: var(--ds-muted); font-weight: 500; font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-emails #em-addnote-btn:hover { color: var(--ds-ink); }
body.skin-billdr #app #view-emails .em-notebox { background: var(--ds-tint); border: 1px dashed var(--ds-line-strong); border-radius: var(--ds-r); padding: 12px; margin: 0 0 16px; }
body.skin-billdr #app #view-emails .em-note-input { font-size: var(--ds-fs); }

/* the visibility banner: Billdr's light-grey info line at the thread foot */
body.skin-billdr #app #view-emails .em-banner {
  margin: 8px 0 12px; padding: 10px 14px 10px 40px; border: 0; border-radius: var(--ds-r-ctl);
  background: var(--ds-fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366717f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E") no-repeat 14px center / 17px 17px;
  color: var(--ds-neutral-ink); font-size: var(--ds-fs-sm); line-height: 1.5;
}

/* the composer (chat.css shape, re-dressed here): one rounded input
 * row, gold Send. Send appears only once there is something to send
 * (chat.js) — no greyed stand-in is drawn. */
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-main {
  align-items: center; min-height: 48px; padding: 4px 6px 4px 8px; gap: 4px;
  background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r);
}
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-main:focus-within { border-color: var(--ds-gold); box-shadow: var(--ds-focus); }
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-field textarea {
  border: 0; border-radius: 0; box-shadow: none; background: transparent; min-height: 0; padding: 8px 4px; font-size: var(--ds-fs);
}
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-field textarea:focus { border: 0; box-shadow: none; }
body.skin-billdr #app #view-emails #em-composer-slot :is(.emoji-btn, .chat-bar-btn) { margin-bottom: 0; }
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-btn { color: var(--ds-muted); }
body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-btn:hover { background: var(--ds-bg); color: var(--ds-navy); }
body.skin-billdr #app #view-emails #em-composer-slot :is(.chat-send, .chat-cancel) { min-height: 36px; border-radius: var(--ds-r-ctl); margin-bottom: 0; padding: 0 16px; }
body.skin-billdr #app #view-emails #em-composer-slot .chat-cerr { font-size: var(--ds-fs-xs); color: var(--ds-danger); }

/* -- the right rail: white cards, team = avatar + bold name over grey
 *    role, Quick actions = the gold outline button (rule 2) -- */
body.skin-billdr #app #view-emails .em-rail-card { background: var(--ds-card); border: 1px solid var(--ds-line); border-radius: var(--ds-r); box-shadow: none; padding: 18px 20px; margin: 0 0 16px; }
body.skin-billdr #app #view-emails .em-rail-card h3 { font-size: var(--ds-fs-md); font-weight: 700; color: var(--ds-navy); margin: 0 0 14px; }
body.skin-billdr #app #view-emails .em-member {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; margin: 0; padding: 8px 0;
}
body.skin-billdr #app #view-emails .em-member + .em-member { border-top: 1px solid var(--ds-hair); }
body.skin-billdr #app #view-emails .em-member .msg-av { grid-row: span 2; width: 34px; height: 34px; font-size: 11px; border: 0; }
body.skin-billdr #app #view-emails .em-member-name { font-size: var(--ds-fs); font-weight: 700; color: var(--ds-navy); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.skin-billdr #app #view-emails .em-member > .muted { font-size: var(--ds-fs-xs); color: var(--ds-muted); line-height: 1.3; }
body.skin-billdr #app #view-emails #em-team > p.muted,
body.skin-billdr #app #view-emails #em-actions > p.muted { font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-emails #em-view-project {
  display: flex; width: 100%; background: var(--ds-card); color: var(--ds-gold-ink); border: 1px solid var(--ds-gold); font-weight: 600;
}
body.skin-billdr #app #view-emails #em-view-project:hover { background: var(--ds-gold-tint); color: var(--ds-gold-ink-hover); }

@media (max-width: 1100px) {
  body.skin-billdr #app #view-emails .em-layout { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  body.skin-billdr #app #view-emails .em-layout { grid-template-columns: 1fr; }
  body.skin-billdr #app #view-emails .em-back { display: inline-flex; margin-bottom: 10px; }
}
/* phones: bubbles take the width, sender lines fold back inside them */
@media (max-width: 760px) {
  body.skin-billdr #app #view-emails .em-pane-thread { padding: 16px; }
  body.skin-billdr #app #view-emails .em-card,
  body.skin-billdr #app #view-emails .em-card.em-note,
  body.skin-billdr #app #view-emails .em-card.em-outcome { max-width: 100%; margin: 0 0 12px; }
  body.skin-billdr #app #view-emails .em-card > :is(.em-card-head, .em-send-head) {
    position: static; flex-wrap: wrap; justify-content: flex-start; margin: 0 0 8px; width: auto; max-width: none;
  }
  body.skin-billdr #app #view-emails .em-send-who { margin-left: 0; flex-wrap: wrap; }
  body.skin-billdr #app #view-emails .em-chat > .em-card-head > .msg-av { order: 0; }
  body.skin-billdr #app #view-emails #em-composer-slot .chat-bar-btn { width: 40px; height: 40px; }
  body.skin-billdr #app #view-emails .em-addnote { text-align: left; margin-top: 0; }
}

/* ======================= DW2 P12 · Emails (2026-10-18) ======================= */
/* EM-6: a chat card's foot carries the jump to Conversations. */
.em-card-foot { margin: 8px 0 0; }
.em-card-foot .linkbtn, .em-pdf-retry { font-size: 13px; }
.em-pdf-retry { margin-left: 4px; }
body.skin-billdr :is(.em-card-foot .linkbtn, .em-pdf-retry) { color: var(--ds-gold-ink); font-weight: 600; }
body.skin-billdr #app .em-card .em-card-foot .linkbtn,
body.skin-billdr #app .em-card .em-pdf-retry { font-size: var(--ds-fs-xs); padding: 0; min-height: 0; }
body.skin-billdr :is(.em-card-foot .linkbtn, .em-pdf-retry):hover { color: var(--ds-gold-ink-hover); }
/* EM-3: the client-dashboard door sits under View project, full width. */
#em-actions #em-client-dash { margin-top: 8px; }
/* ======================= /DW2 P12 ======================= */

/* ======================= wave107-comms (2026-10-25) =======================
 * Communications hub: texts, calls, voicemails and logged conversations in the
 * record, and the Unfiled tray above the list. Every rule below targets a class
 * only the comms leg draws — with the switch off none of these elements exist. */
.em-chip { flex: none; display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; line-height: 1.4; background: #e8eef5; color: #1d3a57; }
.em-chip-voicemail { background: #f3e8f5; color: #5b2a66; }
.em-chip-call { background: #e6f2ec; color: #1f5a3c; }
.em-chip-note { background: #f3ecd4; color: #6d5a1e; }
.em-chip-unreadable { background: #fbe7e4; color: #8a2a1c; }
.em-comms .em-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.em-comms-who { color: var(--muted); font-size: 12px; }
.em-comms-tx { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.em-comms-k { font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 0 4px; text-transform: uppercase; letter-spacing: .4px; }
.em-comms-rec { margin: 8px 0 0; font-size: 13px; }
.em-comms-flagrow { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; }
.em-comms-handled { font-size: 12px; margin: 10px 0 0; }
.em-flag { background: #fdecc8; color: #7a4b00; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; }
.em-card.em-needs { border-color: #e7c27a; }
.em-addnote-sep { color: var(--muted); margin: 0 4px; }
.em-logbox .em-log-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.em-logbox .em-log-row label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1 1 180px; }

.em-tray { border: 1px solid #e7c27a; background: #fffaf0; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.em-tray-h { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.em-tray-list { display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow: auto; }
.em-tray-row { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.em-tray-top { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
.em-tray-top .em-row-date { margin-left: auto; }
.em-tray-cli { margin: 4px 0 0; font-size: 12px; }
.em-tray-prev { margin: 4px 0 0; font-size: 13px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.em-tray-raw { margin: 6px 0 0; font-size: 12px; }
.em-tray-raw pre { max-height: 160px; overflow: auto; white-space: pre-wrap; word-break: break-all; background: #f6f6f6; padding: 6px; border-radius: 6px; }
.em-tray-num { font-size: 13px; }
/* wave154: the full-size tray view — read the whole item before choosing */
.em-trayview { position: fixed; inset: 0; background: rgba(20, 16, 8, .45); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.em-trayview-panel { background: var(--card); border-radius: 14px; max-width: 720px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; padding: 14px 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.em-trayview-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.em-trayview-head .btn { margin-left: auto; }
.em-trayview-body { overflow: auto; margin: 10px 0; font-size: 14px; }
.em-trayview-body pre { white-space: pre-wrap; word-break: break-word; background: #f6f6f6; padding: 10px; border-radius: 8px; font-size: 12.5px; }
.em-trayview-full { white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; }
.em-trayview-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.em-tray-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.em-tray-file select { flex: 1 1 160px; min-width: 0; }
.em-tray-remember { font-size: 12px; display: flex; align-items: center; gap: 4px; }
/* wave137: Genny's read on a tray card, and the Screened-out list */
.em-tray-genny { margin: 4px 0 0; font-size: 12px; color: var(--muted, #5b6472); }
.em-screened { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.em-screened summary { cursor: pointer; font-size: 13px; }
.em-screened-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.em-screened .em-tray-row { opacity: .88; }

/* billdr skin: the client's side (in) on the left like a note, ours (out) on the right like a send */
body.skin-billdr #app #view-emails .em-card.em-comms.em-in { margin: 40px auto 14px 0; }
body.skin-billdr #app #view-emails .em-card.em-comms.em-in > .em-card-head { justify-content: flex-start; }
body.skin-billdr #app #view-emails .em-chip { font-weight: 600; border-radius: var(--ds-r-pill); }
body.skin-billdr #app #view-emails .em-comms-who { color: var(--ds-muted); font-size: var(--ds-fs-xs); }
body.skin-billdr #app #view-emails .em-card.em-needs { border-color: var(--ds-warn-line); }
body.skin-billdr #app #view-emails .em-flag { background: var(--ds-warn-bg); color: var(--ds-warn-ink); border: 1px solid var(--ds-warn-line); font-weight: 600; }
body.skin-billdr #app #view-emails .em-tray { background: var(--ds-warn-bg); border-color: var(--ds-warn-line); border-radius: var(--ds-r); }
body.skin-billdr #app #view-emails .em-tray-row { background: var(--ds-card); border-color: var(--ds-line); border-radius: var(--ds-r-ctl); }
body.skin-billdr #app #view-emails :is(.em-tray-top, .em-tray-prev) { font-size: var(--ds-fs-sm); }
body.skin-billdr #app #view-emails .em-tray-h { font-size: var(--ds-fs-sm); color: var(--ds-navy); }
@media (max-width: 640px) {
  body.skin-billdr #app #view-emails .em-card.em-comms { max-width: 100%; }
}
/* ======================= /wave107-comms ======================= */

/* ======================= wave155-notifyreply ======================= */
/* Email cards filed by the reply threading: the Email chip, the subject
 * line, and the collapsed quoted-text block (Claude's wave155 return named
 * the classes; the minimal rules land with Hana's apply). */
.em-chip-email { background: #e3ecf7; color: #1d4e79; }
.em-email-subject { margin: 0 0 6px; font-size: 13.5px; color: #1d3a57; }
.em-comms-quoted { margin-top: 8px; border-top: 1px dashed #d5dde6; padding-top: 6px; }
.em-comms-quoted > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: #5a6b7d; }
/* ======================= /wave155-notifyreply ======================= */
