/* Admin › Mail as a mail client (Components/Shared/MailShell.razor and the Mail pages). One primary action per screen in
   filled SEIRC blue (New email in the rail, Send on the outbox bar, Add to outbox in compose); secondary outlined or
   tonal, tertiary text. Gold is the one attention colour (the outbox count). A mailbox's colour (General blue, Oxford
   blue + gold, London purple) marks its rail item, its messages and the compose sheet that sends from it. */
.mx-shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--s6); align-items: start; margin-top: var(--s3); }
.mx-main { min-width: 0; }

/* ---------- rail ---------- */
.mx-rail { position: sticky; top: var(--sticky-top); display: flex; flex-direction: column; gap: var(--s4); }
.mx-grp { display: flex; flex-direction: column; gap: 2px; }
.mx-cap { padding: 0 var(--s4) var(--s1); font: var(--t-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.mx-rail a { display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s3) 0 var(--s4); border-radius: var(--r-pill);
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; transition: background var(--mo-2) ease, color var(--mo-2) ease; }
.mx-rail a > .ic { color: var(--muted); flex: none; font-size: var(--ic-md); }
.mx-rail a > span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-rail a small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.2; }
.mx-rail a.mx-wait { min-height: 48px; }
.mx-rail a:hover { background: rgba(18,71,188,.06); }
.mx-rail a.on { background: var(--pale); color: var(--blue-2); font-weight: 700; }
.mx-rail a.on > .ic { color: var(--blue); }
.mx-rail a.mx-minor:not(.on) { color: var(--muted); }
.mx-rail a.mx-bad > .ic { color: var(--err); }
/* the primary action: filled SEIRC blue, set apart from the folders */
.mx-rail a.mx-new { align-self: flex-start; gap: var(--s2); min-height: 52px; padding: 0 var(--s5) 0 var(--s4); border-radius: 16px;
  background: var(--blue); color: #fff; font-weight: 700; box-shadow: 0 1px 2px rgba(18,71,188,.2), 0 4px 12px -4px rgba(18,71,188,.45); transition: box-shadow var(--mo-2) ease, background var(--mo-2) ease; }
.mx-rail a.mx-new > .ic { color: #fff; }
.mx-rail a.mx-new > span { overflow: visible; }
.mx-rail a.mx-new:hover { background: var(--blue-2); box-shadow: 0 2px 4px rgba(18,71,188,.25), 0 8px 18px -6px rgba(18,71,188,.5); }
/* counts: quiet pills; the outbox count is the one gold one */
.mx-c, .mx-n { flex: none; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; font: 700 11px/20px Inter, sans-serif; text-align: center; font-variant-numeric: tabular-nums; }
.mx-c { background: #EDF0F6; color: var(--muted); }
.mx-rail a.on .mx-c { background: #fff; }
.mx-bad .mx-c { background: var(--err-bg); color: var(--err); }
.mx-n { background: #F2B705; color: var(--ink); box-shadow: 0 1px 2px rgba(138,90,0,.25); }
/* mailboxes: a dot in the mailbox's colour, and the open one tinted in it */
.mx-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--blue); margin: 0 5px; display: inline-block; }
.mx-box.london .mx-dot, .london > .mx-dot, .mx-dot.london { background: var(--purple); }
.mx-box.oxford .mx-dot, .oxford > .mx-dot, .mx-dot.oxford { background: #1247BC; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #F2B705; }
.mx-box.any .mx-dot { background: conic-gradient(var(--blue) 0 50%, var(--purple) 0); }
.mx-rail a.mx-box.london:hover { background: rgba(107,63,160,.07); }
.mx-rail a.mx-box.london.on { background: var(--purple-pale); color: #4A2A75; }

/* ---------- page head: title (+ mailbox chip) left, tools right, one quiet help line ---------- */
.mx-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; min-height: 44px; }
.mx-title { display: flex; align-items: center; gap: var(--s3); margin-right: auto; min-width: 0; }
.mx-head h1 { font: 700 22px/1.2 Inter, sans-serif; letter-spacing: -.01em; margin: 0; }
.mx-tools { display: flex; align-items: center; gap: var(--s2); flex: 0 1 auto; }
.mx-tools form { margin: 0; }
.mx-search { flex: 0 1 320px; width: 320px; }
.mx-search input { width: 100%; min-height: 40px; box-shadow: none; font-size: 14px; }
.mx-search input:focus { border-color: var(--mid); box-shadow: 0 0 0 3px var(--pale); outline: none; }
.mx-check .ic { font-size: 18px; }
.mx-sub { font-size: 13px; color: var(--muted); margin: var(--s1) 0 var(--s4); max-width: 80ch; }
.mx-boxchip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 10px 3px 4px; border-radius: var(--r-pill); background: var(--pale); color: var(--blue-2); font: 600 13px/1.3 Inter, sans-serif; white-space: nowrap; }
.mx-boxchip.london { background: var(--purple-pale); color: #4A2A75; }
.mx-boxchip.sm { font-size: 12px; padding: 1px 8px 1px 2px; }
.mx-boxchip.sm .mx-dot { width: 8px; height: 8px; }

/* ---------- message list ---------- */
.mx-list { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.mx-row { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 60px; padding: 10px var(--s4) 10px var(--s5); border-bottom: 1px solid #EEF1F6;
  transition: background var(--mo-2) ease; }
.mx-row:last-child { border-bottom: 0; }
.mx-row:hover { background: #F7F9FD; }
.mx-row:has(.mx-link:focus-visible) { outline: 3px solid var(--mid); outline-offset: -3px; }
.mx-link:focus-visible { outline: none; }
/* the mailbox marker: a short bar on the leading edge */
.mx-row[class*="mk-"]::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--light); }
.mx-row.mk-oxford::before { background: linear-gradient(#F2B705 0 7px, var(--blue) 7px); }
.mx-row.mk-london::before { background: var(--purple); }
.mx-pick { position: relative; z-index: 1; width: 18px; height: 18px; margin: 0; accent-color: var(--blue); flex: none; }
.mx-row:has(.mx-pick:checked) { background: #EEF3FC; }
.mx-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 14px/1 Inter, sans-serif; background: #EDF0F6; color: var(--muted); }
.mx-av.in { background: var(--pale); color: var(--blue); }
.mx-av.wait { background: #FDF3D0; color: var(--warn); }
.mx-av.bad { background: var(--err-bg); color: var(--err); }
.mx-av.lg { width: 44px; height: 44px; font-size: 17px; }
.mx-av .ic { font-size: 18px; }
.mx-link { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--s4); color: inherit; text-decoration: none; }
.mx-link::after { content: ""; position: absolute; inset: 0; } /* the whole row opens the email */
.mx-who { flex: 0 0 196px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; color: var(--ink); }
.mx-what { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.mx-what b { font-weight: 600; color: var(--ink); }
.mx-snip { color: var(--muted); }
.mx-dash { font-style: normal; color: var(--placeholder); }
.mx-row.fresh .mx-who, .mx-row.fresh .mx-what b { font-weight: 800; }
.mx-row.failed .mx-who { color: var(--err); }
.mx-tags { display: flex; gap: 6px; align-items: center; flex: none; }
.mx-tags .pill { font-size: 11px; padding: 2px 8px; position: relative; z-index: 1; text-decoration: none; white-space: nowrap; }
.pill.info { background: #FDF3D0; color: var(--warn); border-color: transparent; } /* waiting in the outbox */
.pill.mx-mb { background: var(--pale); color: var(--blue-2); border-color: transparent; }
.pill.mx-mb.london { background: var(--purple-pale); color: #4A2A75; }
a.mx-ref:hover { background: var(--pale); color: var(--blue); }
.mx-clip { color: var(--muted); display: inline-flex; } .mx-clip .ic { font-size: 18px; }
.mx-time { flex: 0 0 56px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mx-row.fresh .mx-time { color: var(--blue-2); font-weight: 700; }
/* row actions: Send (tonal) and Discard (text) on outbox rows; quiet until the row is hovered or focused */
.mx-acts { display: flex; gap: 4px; flex: none; position: relative; z-index: 1; }
.mx-acts form { margin: 0; }
.mx-acts .ml-act { gap: 4px; min-height: 30px; padding: 0 10px; }
.mx-acts .ml-act .ic { font-size: 16px; }
.mx-row .ml-act.go { background: #DCE5F8; color: #0E2F7A; border-color: transparent; }
.mx-row:hover .ml-act:not(.go), .mx-row:focus-within .ml-act:not(.go) { color: var(--ink); }
.mx-row .ml-act:hover { background: var(--pale); border-color: transparent; }
.mx-row .ml-act.go:hover { background: #CCD9F5; }
.mx-more { font-size: 12px; text-align: center; margin: var(--s3) 0; color: var(--muted); }
.mx-main .es { padding: var(--s7) var(--s4); }

/* the outbox bulk bar heads the list; Send and Discard appear once something is ticked */
.mx-bulk { display: flex; align-items: center; gap: var(--s2); min-height: 52px; padding: var(--s1) var(--s3) var(--s1) var(--s5); border-bottom: 1px solid var(--line); background: #FAFBFD;
  transition: background var(--mo-2) ease; }
.mx-bulk .ob-all { display: inline-flex; align-items: center; gap: var(--s3); margin-right: auto; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); cursor: pointer; }
.mx-bulk .ob-all input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.mx-bulk-acts { display: none; gap: var(--s2); align-items: center; }
.mx-bulk-acts .ic { font-size: 18px; }
.mx-picked { display: none; color: var(--blue-2); }
.mx-list:has(.mx-pick:checked) .mx-bulk { background: var(--pale); }
.mx-list:has(.mx-pick:checked) .mx-bulk-acts { display: flex; animation: m-fade var(--mo-2) var(--e-settle); }
.mx-list:has(.mx-pick:checked) .mx-picked { display: inline; }
.mx-list:has(.mx-pick:checked) .mx-none-picked { display: none; }

@media (max-width: 1099px) { .mx-who { flex-basis: 150px; } .mx-row .mx-ref, .mx-row .mx-mb { display: none; } .mx-shell { grid-template-columns: 208px minmax(0, 1fr); gap: var(--s5); } }

/* Phone and small tablet: the rail becomes a scrolling row of chips (New email first, groups split by a hairline);
   rows stack (who + time, then subject, then snippet); the head stacks title over search. */
@media (max-width: 899px) {
  .mx-shell { grid-template-columns: minmax(0, 1fr); gap: var(--s3); margin-top: var(--s2); }
  .mx-rail { position: static; flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; gap: var(--s2); margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) var(--s1); }
  .mx-rail::-webkit-scrollbar { display: none; }
  .mx-grp { flex-direction: row; gap: var(--s2); flex: none; }
  .mx-grp + .mx-grp { border-left: 1px solid var(--line); padding-left: var(--s2); }
  .mx-cap, .mx-rail a small { display: none; }
  .mx-rail a { flex: none; min-height: 36px; padding: 0 var(--s3); gap: 6px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
  .mx-rail a > span { overflow: visible; }
  .mx-rail a.on { border-color: transparent; }
  .mx-rail a.mx-wait { min-height: 36px; }
  .mx-rail a.mx-new { min-height: 36px; border-radius: var(--r-pill); padding: 0 var(--s4) 0 var(--s3); border: 0; box-shadow: none; }
  .mx-rail .ic { font-size: 18px; }
  .mx-head h1 { font-size: 20px; }
  .mx-tools { flex: 1 1 100%; }
  .mx-search { flex: 1 1 auto; width: auto; }
  .mx-check span { display: none; }
  .mx-check { width: 40px; padding: 0; }
  .mx-sub { margin-bottom: var(--s3); }
  .mx-row { flex-wrap: wrap; align-items: flex-start; padding: 12px var(--s3) 12px var(--s4); gap: 4px var(--s3); }
  .mx-av { margin-top: 2px; }
  .mx-link { flex: 1 1 calc(100% - 48px - 76px); flex-direction: column; gap: 2px; padding-right: 52px; }
  .mx-who { flex: none; max-width: 100%; }
  .mx-what { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mx-what b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mx-snip { font-size: 12px; } .mx-dash { display: none; }
  .mx-time { flex: 0 0 auto; position: absolute; right: var(--s3); top: 14px; }
  .mx-tags, .mx-acts { margin-left: 48px; }
  .mx-picking .mx-tags, .mx-picking .mx-acts { margin-left: 78px; }
  .mx-tags:empty { display: none; }
  .mx-pick { margin-top: 9px; }
  .mx-acts .ml-act { min-height: 34px; padding: 0 12px; border-color: var(--line); }
  .mx-bulk { padding-left: var(--s4); flex-wrap: wrap; }
}

.mx-contact .mx-acts { min-width: 72px; justify-content: flex-end; }
@media (max-width: 899px) { .mx-contact .mx-acts { min-width: 0; } }
@media (prefers-reduced-motion: reduce) { .mx-rail a, .mx-row, .mx-bulk { transition: none; } .mx-bulk-acts { animation: none !important; } }

/* ---------- one email (AdminEmail.razor): action bar, subject, who/when block, the message ---------- */
.mv { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; border-top: 4px solid var(--light); animation: m-arrive var(--mo-3) var(--e-settle) both; }
.mv.blue { border-top-color: var(--blue); }
.mv.oxford { border-top-color: var(--blue); box-shadow: var(--shadow), inset 0 3px 0 #F2B705; }
.mv.london { border-top-color: var(--purple); }
.mv-bar { display: flex; align-items: center; gap: var(--s2); min-height: 56px; padding: var(--s2) var(--s4) var(--s2) var(--s2); border-bottom: 1px solid #EEF1F6; flex-wrap: wrap; }
.mv-back { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); flex: none; transition: background var(--mo-2) ease; }
.mv-back:hover { background: #EEF1F7; color: var(--ink); }
.mv-crumb { font-size: 13px; color: var(--muted); white-space: nowrap; }
.mv-crumb a { color: inherit; text-decoration: none; } .mv-crumb a:hover { color: var(--blue); }
.mv-acts { display: flex; align-items: center; gap: var(--s2); margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.mv-acts form { margin: 0; }
.mv-acts .ic { font-size: 18px; }
.mv-subj { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s5) var(--s5) var(--s2) calc(var(--s5) + 56px); }
.mv-subj h1 { font: 700 22px/1.3 Inter, sans-serif; letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; }
.mv-subj .pill { flex: none; margin-top: 3px; font-size: 12px; padding: 2px 10px; }
.mv-meta { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: var(--s3); row-gap: var(--s1); padding: var(--s2) var(--s5) var(--s4); }
.mv-meta .mx-av { grid-row: span 2; }
.mv-who { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; font-size: 15px; }
.mv-who b { font-weight: 700; }
.mv-to { color: var(--muted); font-size: 13px; }
.mv-addr { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.mv-when { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.mv-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px var(--s3); margin: 0; font-size: 13px; }
.mv-dl dt { color: var(--muted); font-weight: 600; }
.mv-dl dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.mv-dl a { color: var(--blue); text-decoration: none; font-weight: 600; } .mv-dl a:hover { text-decoration: underline; }
.mv-err { display: flex; gap: var(--s2); align-items: center; margin: 0 var(--s5) var(--s3); }
.mv-err .ic { font-size: 18px; flex: none; }
.mv .ev { padding: 0 var(--s5) var(--s5); }
.mv .ev-atts { margin: 0 0 var(--s3); gap: var(--s2); }
.mv .chip-a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: var(--r-pill); font-weight: 600; background: #F7F9FD; }
.mv .chip-a:hover { border-color: var(--light); background: var(--pale); }
.mv .chip-a .ic { font-size: 16px; color: var(--muted); }
.mv .ev-frame { display: block; height: max(480px, calc(100vh - 400px)); border: 1px solid var(--line); border-radius: var(--r-ctl); background: #EEF2F8; }
@media (max-width: 899px) {
  .mv { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; }
  .mv-bar { padding-right: var(--s3); }
  .mv-lbl { display: none; }
  .mv-subj { padding: var(--s4) var(--s4) var(--s2); }
  .mv-subj h1 { font-size: 19px; }
  .mv-meta { padding: var(--s2) var(--s4) var(--s3); grid-template-columns: 40px minmax(0, 1fr); }
  .mv-meta .mx-av.lg { width: 40px; height: 40px; font-size: 15px; }
  .mv-when { margin-left: 0; flex-basis: 100%; }
  .mv-err { margin-inline: var(--s4); }
  .mv .ev { padding: 0 var(--s3) var(--s4); }
  .mv .ev-frame { height: 70vh; }
}
@media (max-width: 599px) {
  .mv-crumb { display: none; }
  .mv-acts { gap: var(--s1); }
}

/* ---------- Mailbox settings (AdminMailboxes.razor): rows with the theme avatar, test results, the edit form ---------- */
.mb-av.london { background: var(--purple); color: #fff; } .mb-av.oxford { background: #1247BC; color: #fff; box-shadow: inset 0 -3px 0 #F2B705; } .mb-av.blue { background: var(--pale); color: var(--blue); }
.mb-row { flex-wrap: wrap; }
.mb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.mb-main b { font-size: 14px; }
.mb-main small { font-size: 12px; }
.mb-row .mx-acts .ml-act { color: var(--blue); border-color: var(--line); background: #fff; }
.mb-test { flex: 1 1 100%; display: grid; gap: var(--s2); margin: var(--s2) 0 var(--s1) 48px; padding: var(--s3); border-radius: var(--r-ctl); background: #F7F9FD; font-size: 13px;
  animation: mb-in 200ms ease; }
.mb-test > span { display: flex; gap: var(--s2); align-items: flex-start; overflow-wrap: anywhere; }
.mb-test b { white-space: nowrap; }
.mb-test .ok .ic { color: #1E8E3E; } .mb-test .bad .ic { color: var(--err); } .mb-test .na .ic { color: var(--muted); }
.mb-test .mb-send { align-items: center; flex-wrap: wrap; margin-top: var(--s1); }
.mb-form { display: grid; gap: var(--s4); margin-bottom: var(--s4); animation: mb-in 200ms ease; }
.mb-h { font: 700 17px/1.3 Inter, sans-serif; margin: 0; }
.mb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--s3); }
.mb-grid input { width: 100%; }
.mb-theme > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: var(--s1); }
.mb-theme .segctl button { display: inline-flex; align-items: center; gap: 6px; }
.mb-people { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s1); }
.mb-people legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: var(--s1); padding: 0; }
.mb-check { display: flex; align-items: center; gap: var(--s2); font-size: 13px; min-height: 32px; }
.mb-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; padding-top: var(--s2); border-top: 1px solid #EEF1F6; }
.mb-remove { margin-right: auto; color: var(--err) !important; }
@keyframes mb-in { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 899px) { .mb-test { margin-left: 0; } .mx-rail a.mx-box small { display: none; } }
@media (prefers-reduced-motion: reduce) { .mb-test, .mb-form, .mv { animation: none; } }

/* ---------- New email (AdminCompose.razor) ---------- */
.mc-head .mc-back { display: inline-flex; align-items: center; gap: 4px; }
.mc-head .mc-back .ic { font-size: 18px; }
.mc-head h1 { font: 700 22px/1.2 Inter, sans-serif; letter-spacing: -.01em; }
/* the sheet's accent follows the From mailbox */
.cw { --cw-c: var(--blue); --cw-pale: var(--pale); --cw-ink: var(--blue-2); --cw-hover: var(--blue-2);
  padding: 0; overflow: visible; border-top: 4px solid var(--cw-c); }
.cw.london { --cw-c: var(--purple); --cw-pale: var(--purple-pale); --cw-ink: #4A2A75; --cw-hover: #57328A; }
.cw.oxford { box-shadow: var(--shadow), inset 0 3px 0 #F2B705; }
.cw-row { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 52px; padding: 6px var(--s5); border-bottom: 1px solid #EEF1F6; }
.cw-k { flex: 0 0 56px; font-size: 13px; color: var(--muted); font-weight: 600; }
/* From: the mailbox as a chip in its colour (a select when there is a choice) */
.cw-from { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 100%; padding: 0 12px 0 6px; border-radius: var(--r-pill);
  background: var(--cw-pale); color: var(--cw-ink); font-size: 13px; transition: background var(--mo-2) ease, color var(--mo-2) ease; }
.cw-from b { font-weight: 700; white-space: nowrap; }
.cw-from small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw.london .mx-dot { background: var(--purple); }
.cw.oxford .cw-from .mx-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #F2B705; }
.cw .cw-from select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: 700 13px/1 Inter, sans-serif; min-height: 32px;
  padding: 0 22px 0 0; margin-right: -18px; cursor: pointer; min-width: 0; max-width: 100%; box-shadow: none; text-overflow: ellipsis; }
.cw .cw-from select:focus-visible { outline: none; }
.cw-from.pick:has(select:focus-visible) { box-shadow: 0 0 0 3px var(--mid); }
.cw-from.pick .ic { font-size: 18px; pointer-events: none; }
/* To / Cc / Bcc */
.cw-input { flex: 1 1 140px; min-width: 120px; border: 0; outline: none; background: transparent; font: inherit; font-size: 15px; padding: 6px 0; box-shadow: none; }
.cw .cw-input { background: transparent; border: 0; box-shadow: none; padding-inline: 0; min-height: 36px; }
.cw-input:focus { box-shadow: none; }
.cw-subject { font-weight: 600; }
.cw-chips { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cw-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 30px; padding: 0 4px 0 3px; border-radius: 15px; background: #EEF1F7; color: var(--ink);
  font-size: 13px; font-weight: 500; animation: m-chip var(--mo-2) var(--e-settle); }
.cw-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cw-chip-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #fff; color: var(--blue); font: 700 11px/1 Inter, sans-serif; }
.cw-chip.grp { background: var(--cw-pale); color: var(--cw-ink); font-weight: 600; padding-left: 8px; } .cw-chip.grp > .ic { font-size: 18px; }
.cw-chip.bad { background: var(--err-bg); color: var(--err); }
.cw-chip button { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; padding: 0; flex: none; }
.cw-chip button .ic { font-size: 16px; }
.cw-chip button:hover { background: rgba(27,36,64,.1); color: var(--ink); }
.cw-ccbcc { display: flex; gap: 2px; align-self: flex-start; padding-top: 6px; }
.cw-tog { border: 0; background: none; font: 600 13px/1 Inter, sans-serif; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.cw-tog:hover { background: #EEF1F7; color: var(--ink); }
/* suggestions: open only while typing; closes on pick, Escape, Tab or click-away */
.cw-hits { position: absolute; z-index: 20; left: calc(var(--s5) + 56px + var(--s3) - var(--s3)); top: calc(100% - 4px); width: min(480px, calc(100% - 56px - var(--s5))); padding: var(--s1);
  background: #fff; border-radius: 12px; box-shadow: 0 2px 6px rgba(27,36,64,.08), 0 16px 40px -8px rgba(27,36,64,.28); animation: m-slide var(--mo-2) var(--e-settle); --m-from: -4px; }
.cw-hits .mc-hit { border: 0; border-radius: 8px; padding: 8px var(--s3); gap: var(--s3); }
.cw-hits .mc-hit:hover { background: #F4F6FB; }
.cw-hits .mc-hit.hi { background: var(--pale); }
.cw-hits .mc-hit > .mx-av { flex: none; width: 32px; height: 32px; font-size: 13px; }
.cw-hits .mc-hit > span:last-child { flex: 1; min-width: 0; }
.cw-hits .mc-hit small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the message */
.cw-body { display: block; width: 100%; min-height: 360px; border: 0; border-radius: 0; padding: var(--s4) var(--s5); resize: vertical; font: 15px/1.6 Inter, sans-serif; color: var(--ink); box-shadow: none; background: #fff; }
.cw-body:focus { outline: none; box-shadow: none; }
.cw-body:disabled, .cw-input:disabled { background: #F7F9FD; color: var(--muted); }
.cw-atts { display: flex; flex-wrap: wrap; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.cw-att { padding-left: 8px; max-width: 320px; } .cw-att > .ic { font-size: 16px; color: var(--muted); } .cw-att small { flex: none; font-size: 11px; }
.cw-problem { display: flex; align-items: center; gap: var(--s2); margin: 0 var(--s4) var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-ctl); background: var(--err-bg); color: var(--err); font-size: 13px; font-weight: 600; }
.cw-problem .ic { font-size: 18px; flex: none; }
/* the footer sticks to the bottom of the screen while the sheet is taller than it */
.cw-foot { position: sticky; bottom: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s4);
  background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid #EEF1F6; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 -8px 16px -14px rgba(27,36,64,.35); }
.cw-tools, .cw-acts { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.cw-acts { gap: var(--s2); }
.cw-tpl { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-pill); color: var(--muted); background: #fff; min-width: 0; }
.cw-tpl:hover { border-color: #C5CDDD; }
.cw-tpl:has(select:focus-visible) { box-shadow: 0 0 0 3px var(--mid); }
.cw-tpl .ic { font-size: 18px; flex: none; }
.cw-tpl > .ic:last-child { pointer-events: none; }
.cw-tpl select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; box-shadow: none; padding: 0 18px 0 2px; margin-right: -16px; min-height: 34px;
  font: 600 13px/1 Inter, sans-serif; color: var(--ink); cursor: pointer; max-width: 210px; min-width: 0; text-overflow: ellipsis; }
.cw-tpl select:focus-visible { outline: none; }
.cw-fieldbtn { color: var(--muted); } .cw-fieldbtn .ic { font-size: 18px; }
.cw-discard { color: var(--muted); } .cw-discard .ic { font-size: 18px; }
.cw-discard.sure { color: var(--err); background: var(--err-bg); }
.cw .mbtn.cw-send { background: var(--cw-c); padding: 0 var(--s5) 0 var(--s4); }
.cw-foot .mbtn { white-space: nowrap; flex: none; }
.cw-discard:not(.sure) span { display: none; }
.cw-discard:not(.sure) { width: 36px; padding: 0; }
@media (min-width: 1100px) { .mc { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.cw .mbtn.filled:hover:not(:disabled) { background: var(--cw-hover); }
.cw .mbtn.text:not(.cw-discard):not(.cw-fieldbtn) { color: var(--cw-ink); }
.cw-done { display: inline-flex; align-items: center; gap: var(--s2); font-size: 14px; font-weight: 600; color: var(--ok); }
.cw-done .ic { font-size: 20px; }
/* Insert field: a native popover (closes on click-away and Escape), anchored above its button where supported */
.cw-fieldbtn { anchor-name: --cw-fields; }
.cw-pop { margin: 0; inset: auto; position-anchor: --cw-fields; bottom: calc(anchor(top) + 8px); left: anchor(left); width: min(440px, calc(100vw - 32px)); padding: var(--s3) var(--s4);
  border: 0; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(27,36,64,.08), 0 16px 40px -8px rgba(27,36,64,.3); position-try-fallbacks: flip-block; }
.cw-pop:popover-open { display: grid; gap: var(--s2); animation: m-slide var(--mo-2) var(--e-settle); --m-from: 4px; }
.cw-pop small { font-size: 12px; line-height: 1.45; }
.cw-pop > span { display: flex; gap: var(--s1); flex-wrap: wrap; }
@supports not (anchor-name: --a) { .cw-pop { inset: 0; margin: auto; height: fit-content; } }
/* the side: preview and who gets it */
.mc-label .ic { font-size: 16px; color: var(--muted); align-self: center; }
.cw-held { display: block; font-size: 12px; line-height: 1.45; margin: calc(-1 * var(--s1)) 0 var(--s2); }
.cw-saved { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ok); margin-bottom: var(--s2); }
.cw-saved .ic { font-size: 16px; }
@media (max-width: 599px) {
  .mc-head { margin-bottom: var(--s2); }
  .cw { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; }
  .cw-row { padding: 4px var(--s4); gap: var(--s2); min-height: 48px; } .cw-k { flex-basis: 44px; }
  .cw-from small { display: none; }
  .cw-hits { left: var(--s2); right: var(--s2); width: auto; }
  .cw-body { padding: var(--s3) var(--s4); min-height: 280px; }
  .cw-atts { padding: var(--s2) var(--s4); } .cw-att { max-width: 100%; }
  .cw-foot { flex-wrap: wrap; padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom)); border-radius: 0; gap: var(--s2); }
  .cw-acts { display: contents; }
  .cw-tools { flex: 1; }
  .cw-tpl select { max-width: 120px; }
  .cw-fieldbtn span { display: none; }
  .cw-fieldbtn { width: 36px; padding: 0; }
  .cw-foot .mbtn.cw-send { order: 3; flex: 1 1 100%; height: 44px; }
  .cw-tpl { flex: 0 1 auto; }
  .mc-side .mc-card { border-radius: var(--r); }
}
@media (prefers-reduced-motion: reduce) { .cw-chip, .cw-hits, .cw-pop:popover-open { animation: none; } }

/* Mailbox settings › Who sends what: name + when on the left, the pickers on the right (stacked on a phone). */
.mr { margin-top: var(--s6); display: grid; gap: var(--s2); }
.mr .mx-sub { margin: 0 0 var(--s2); }
.mr-row { flex-wrap: wrap; align-items: flex-start; gap: var(--s3); }
.mr-picks { display: flex; flex-wrap: wrap; gap: var(--s2); flex: 0 1 auto; justify-content: flex-end; }
.mr-f { display: grid; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.mr-f select { min-width: 0; width: 240px; max-width: 100%; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff; color: var(--ink); }
.mr-f select:disabled { background: #F7F9FD; color: var(--muted); }
.mr-warn { display: inline-block; align-self: flex-start; max-width: 100%; margin-top: 4px; font-size: 11px; line-height: 1.5; padding: 2px 10px; border-radius: 10px; }
.mr-warn .ic { font-size: 14px; vertical-align: -3px; margin-right: 4px; } .mr-warn small { font-weight: 500; opacity: .85; }
.mr-warn small::before { content: " · "; }
@media (max-width: 720px) {
  .mr-picks { width: 100%; justify-content: stretch; }
  .mr-f { flex: 1 1 100%; } .mr-f select { width: 100%; }
}
/* Who sends what › Hold in Outbox: an M3 switch with its state and the owner's default under it */
.mr-hold { flex: 1 1 100%; display: flex; padding-top: var(--s2); border-top: 1px dashed #E6EAF2; }
.mr-sw { display: inline-flex; align-items: center; gap: var(--s3); cursor: pointer; }
.mr-sw span { display: grid; gap: 1px; font-size: 13px; } .mr-sw small { font-size: 12px; color: var(--muted); } .mr-sw em { font-style: normal; color: #8A5A00; font-weight: 700; }
.mr-sw input[role=switch] { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 44px; min-width: 44px; height: 26px; min-height: 0; padding: 0; box-shadow: none; margin: 0; border-radius: 13px; border: 2px solid #79747E; background: #E7E0EC;
  transition: background var(--mo-1, 150ms), border-color var(--mo-1, 150ms); cursor: pointer; }
.mr-sw input::after { content: ""; position: absolute; top: 4px; left: 4px; width: 14px; height: 14px; border-radius: 50%; background: #79747E; transition: transform var(--mo-2, 250ms) var(--e-settle, ease), width var(--mo-2, 250ms), height var(--mo-2, 250ms), top var(--mo-2, 250ms), left var(--mo-2, 250ms), background var(--mo-1, 150ms); }
.mr-sw input:checked { background: var(--blue); border-color: var(--blue); }
.mr-sw input:checked::after { top: 1px; left: 1px; width: 20px; height: 20px; background: #fff; transform: translateX(18px); }
.mr-sw input:focus-visible { outline: 3px solid var(--mid); outline-offset: 2px; }
.mr-sw input:disabled { opacity: .55; cursor: default; }
.mr-hold.changed .mr-sw input:not(:checked) { border-color: #B98A00; }
.mr-always { display: inline-flex; align-items: center; gap: var(--s2); font-size: 12px; color: var(--muted); } .mr-always .ic { font-size: 16px; }
@media (prefers-reduced-motion: reduce) { .mr-sw input, .mr-sw input::after { transition: none; } }
/* Contacts › Lists: the lists above the people; one list's page adds one person or a paste from Excel, previewed first */
.cl { display: grid; gap: var(--s2); margin-bottom: var(--s5); }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.cl-new { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.cl-new input { width: 240px; max-width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); font: 14px Inter, sans-serif; }
.cl-people { margin: 0 0 2px; }
.cl-sure { color: var(--err); background: var(--err-bg); }
.cl-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--s3); margin-bottom: var(--s4); align-items: start; }
.cl-one, .cl-paste { display: grid; gap: var(--s2); }
.cl-fields { display: grid; gap: var(--s2); } .cl-fields .mbtn { justify-self: start; }
.cl-paste textarea { width: 100%; font: 13px/1.5 ui-monospace, Menlo, monospace; padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-ctl); resize: vertical; }
.cl-sum { margin: 0; font-size: 13px; font-weight: 600; }
.cl-preview { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.cl-preview li { display: flex; align-items: center; gap: var(--s3); padding: 6px var(--s3); font-size: 13px; border-bottom: 1px solid #F0F2F7; }
.cl-preview li:last-child { border-bottom: 0; }
.cl-preview li > span:nth-child(2) { flex: 1; min-width: 0; display: grid; } .cl-preview small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.cl-preview li .num { color: var(--muted); width: 3ch; text-align: right; font-size: 12px; flex: none; }
.cl-preview li.bad { background: #FFF8E6; } .cl-preview .cl-raw { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-acts { display: flex; gap: var(--s2); justify-content: flex-end; }
@media (max-width: 899px) { .cl-add { grid-template-columns: minmax(0, 1fr); } }
/* New email: the count before more than one copy goes; Save as template and Schedule popovers */
.cw-confirm { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin: 0 var(--s4) var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-ctl);
  background: var(--pale); font-size: 14px; font-weight: 600; animation: m-fade var(--mo-2) var(--e-settle); }
.cw-confirm > span { flex: 1; min-width: 200px; } .cw-confirm > .ic { color: var(--blue); }
.cw-undo { color: var(--ink); }
.cw-tplbtn { anchor-name: --cw-tpl; } .cw-pop-tpl { position-anchor: --cw-tpl; }
.cw-schedbtn { anchor-name: --cw-sched; } .cw-pop-sched { position-anchor: --cw-sched; left: auto; right: anchor(right); }
.cw-pop .f input { width: 100%; }
.cw-tplsaved { margin: var(--s2) var(--s4); }
@media (max-width: 599px) {
  .cw-tplbtn span { display: none; } .cw-tplbtn { width: 36px; padding: 0; }
  /* Schedule beside Send on their own row */
  .cw-foot .mbtn.cw-schedbtn { order: 3; flex: 1 1 35%; height: 44px; justify-content: center; }
  .cw-foot:has(.cw-schedbtn)::after { content: ""; order: 2; flex: 0 0 100%; height: 0; margin-top: calc(-1 * var(--s2)); }
  .cw-foot .mbtn.cw-send { flex: 1 1 55%; }
}
@media (prefers-reduced-motion: reduce) { .cw-confirm { animation: none; } }
.mx-time.mx-when { white-space: nowrap; min-width: max-content; }
