/* Mail tab — same soft language as app.css / social.css (rounded cards,
   hairlines, soft shadows, one blue). Tokens from app.css :root. */

main.mail-main { padding-bottom: 20px; }

/* Readability (WCAG AA, light + dark): inside the Mail tab secondary text is
   86 % ink, tertiary (previews, dates, captions) 72 % — ≥ 4.9:1 on every
   surface here (white, alt, selected row). Blue text is a shade deeper /
   lighter than the brand fill so it passes on the tinted rows too. */
.mbx, .aob { --ink-2: rgba(var(--ink-rgb), .86); --ink-3: rgba(var(--ink-rgb), .72); --brand-text: #005BC7; }
:root[data-theme="dark"] .mbx, :root[data-theme="dark"] .aob { --brand-text: #99C7FF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mbx, :root:not([data-theme="light"]) .aob { --brand-text: #99C7FF; } }
.mbx {
  display: grid; grid-template-columns: 232px minmax(300px, 380px) minmax(0, 1fr); gap: 16px;
  height: calc(100dvh - 57px - 40px); min-height: 460px;
}
.mbx > .card { min-height: 0; overflow: hidden; }

/* ---------- sidebar ---------- */
.mbx-side { padding: 12px; overflow-y: auto !important; display: flex; flex-direction: column; gap: 4px; }
.mbx-compose { margin-bottom: 8px; min-height: 46px; }
.mbx-compose svg { width: 18px; height: 18px; }
.mbx-views { display: flex; flex-direction: column; gap: 2px; }
.mbx-h { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding: 14px 10px 4px; }
.mbx-f.mbx-mk { color: var(--brand-text); }
.mbx-f.mbx-mk .ic { color: var(--brand-text); }
.mc-noaddr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.mbx-f {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 12px;
  cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 14px; text-align: left; min-height: 40px; text-decoration: none;
}
.mbx-f .ic { width: 18px; height: 18px; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.mbx-f .ic svg { width: 18px; height: 18px; }
.mbx-f .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbx-f .cnt { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mbx-f:hover { background: var(--line); color: var(--ink); }
.mbx-f.on { background: var(--brand-soft); color: var(--brand-text); }
.mbx-f.on .ic, .mbx-f.on .cnt { color: var(--brand-text); }
.mbx-f.on-soft { color: var(--ink); background: var(--surface-alt); }

.mbx-settings { margin-top: auto; }

/* ---------- list ---------- */
.mbx-list { display: flex; flex-direction: column; }
/* Chip row above the rows: All · Mine · Awaiting reply · Closed · Café replies only (· labels). One line, scrolls sideways on phones. */
.mbx-chips { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.mbx-chips::-webkit-scrollbar { display: none; }
.mbx-chips[hidden] { display: none; }
.mbx-chips .chip { min-height: 32px; padding: 0 12px; font-size: 13px; white-space: nowrap; flex: none; gap: 6px; }
.mbx-chips .chip small { font-weight: 700; opacity: .8; }
.mbx-chips .chip svg { width: 14px; height: 14px; }
.mbx-chip-sep { width: 1px; height: 20px; background: var(--line-2); flex: none; margin: 0 2px; }

/* ---------- settings panel (addresses + approval queue) ---------- */
.mset { display: flex; flex-direction: column; }
.mset-sec { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.mset-sec h3 { margin: 0; font-size: 15px; }
.mset-list { display: flex; flex-direction: column; gap: 2px; }
.mset-addr { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 12px; cursor: pointer; color: var(--ink); text-align: left; min-height: 44px; }
.mset-addr:hover { background: var(--line); }
.mset-addr.on { background: var(--brand-soft); }
.mset-addr .ic { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.mset-addr .ic svg { width: 18px; height: 18px; }
.mset-addr .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.mset-addr .cnt { font-size: 12px; font-weight: 700; color: var(--brand-text); }
.mail-queue-embed { display: flex; flex-direction: column; gap: 10px; }
.mail-queue-embed .card.section { box-shadow: none; }

/* From hint under the sender select (smart sender). */
.mcf-hint { margin: -6px 0 0 84px; }
.mbx-search { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); }
.mbx-search .input { min-height: 40px; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.mbx-foldbtn { display: none !important; }
.mbx-rows { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mrow {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; border: 0; border-bottom: 1px solid var(--line); background: none;
  padding: 12px 14px; text-align: left; cursor: pointer; color: var(--ink);
}
.mrow:hover { background: var(--surface-alt); }
/* social.css styles the chat member list with the same .mrow class (offline
   members at 55 % opacity, .on = online) — that made every unselected mail
   row look washed out. Mail rows are always fully opaque. */
.mbx-rows .mrow { opacity: 1; border-radius: 0; }
.mrow.on { background: var(--brand-soft); }
.mrow .av, .mmsg .av {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface-alt); color: var(--ink-2); border: 1px solid var(--line);
}
.mrow.unread .av { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }
.mrow .mc { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mrow .l1 { display: flex; gap: 8px; align-items: baseline; }
.mrow .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.mrow .dt { font-size: 12px; color: var(--ink-3); flex: none; }
.mrow .l2 { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.mrow .l3 { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .l4 { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.mrow.unread .who, .mrow.unread .l2 { color: var(--ink); font-weight: 700; }
.mrow.unread .dt { color: var(--brand-text); font-weight: 700; }
.mrow .l2 .faint, .mrow .who .faint { color: var(--ink-3); }
.udot { width: 8px; height: 8px; color: var(--brand); flex: none; display: inline-grid; }
.udot svg { width: 8px; height: 8px; }
.drafttag { color: var(--danger); font-weight: 700; }
.pill svg { width: 12px; height: 12px; }
.cafe-pill { background: color-mix(in srgb, var(--s-replied) 14%, transparent); color: color-mix(in srgb, var(--s-replied) 80%, var(--ink)); }
.cafe-pill.link { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; transition: background .15s, box-shadow .15s; }
.cafe-pill.link:hover, .cafe-pill.link:focus-visible { background: color-mix(in srgb, var(--s-replied) 26%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--s-replied) 45%, transparent); text-decoration: underline; text-underline-offset: 2px; }
.cafe-pill.link:focus-visible { outline: 2px solid var(--s-replied); outline-offset: 1px; }
/* Ticket state of a cafe thread (crm_threads): status chip · unread · assignee. */
.pill.tk { padding: 2px 8px; font-size: 11px; gap: 5px; }
.pill.tk .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.tk-open { background: var(--brand-soft); color: var(--brand-text); }
.pill.tk-waiting { background: color-mix(in srgb, var(--s-meeting) 16%, transparent); color: color-mix(in srgb, var(--s-meeting) 75%, var(--ink)); }
.pill.tk-closed { background: var(--line); color: var(--ink-3); }
.pill.tk-n { padding: 2px 7px; font-size: 11px; background: var(--brand); color: #fff; }
.pill.tk-who { padding: 1px 8px 1px 2px; font-size: 11px; background: transparent; border: 1px solid var(--line); }
.pill.tk-who .assignee { font-size: 11px; gap: 5px; }
.pill.tk-who .who-av { width: 18px; height: 18px; font-size: 9px; }
.mread-h .tags .pill.tk-who { padding: 2px 10px 2px 3px; font-size: 12px; }
.mread-h .tags .pill.tk-who .assignee { font-size: 12px; }
.mread-h .tags .pill.tk-who .who-av { width: 20px; height: 20px; font-size: 10px; }
.mticket { display: flex; align-items: center; gap: 8px; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.mticket .thread-actions { width: 100%; padding: 0; margin: 0; }
.mticket .thread-actions .input.sm { max-width: 220px; }
.mbx-more { display: flex; justify-content: center; padding: 10px; }

/* ---------- reading pane ---------- */
.mbx-read { display: flex; flex-direction: column; overflow-y: auto !important; overscroll-behavior: contain; }
.mbx-pick { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: auto; }
.mbx-pick svg { width: 40px; height: 40px; opacity: .5; }
.mread-h { display: flex; gap: 10px; align-items: flex-start; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; flex-wrap: wrap; }
.mread-h .ttl { flex: 1 1 260px; min-width: 0; }
.mread-h h2 { margin: 2px 0 6px; font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.mread-h .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.mread-h .acts { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.mread-h .acts .btn { padding: 0 10px; }
.mread-h .acts svg { width: 16px; height: 16px; }
.mbx-back { display: none !important; }
.mlinkbox { padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.mlres { display: flex; flex-direction: column; gap: 2px; }
.mlr { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: none; padding: 8px 10px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--ink); }
.mlr:hover { background: var(--line); }
.mmsgs { padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.mmsg { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.mmsg.out { background: color-mix(in srgb, var(--brand) 3%, var(--surface)); }
.mmsg-h { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; cursor: pointer; }
.mmsg-h .meta { flex: 1; min-width: 0; }
.mmsg-h .who { overflow-wrap: anywhere; font-size: 14px; }
.mmsg-h .rcp { overflow-wrap: anywhere; }
.mmsg-h .dt { flex: none; white-space: nowrap; }
.mmsg .snip { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mmsg.collapsed .snip { display: block; }
.mmsg.collapsed .rcp, .mmsg.collapsed .mmsg-b, .mmsg.collapsed .matt { display: none; }
.mmsg-b { padding: 0 14px 14px; }
.mtext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.55; }
.mframe { width: 100%; border: 0; border-radius: 12px; height: 160px; display: block; background: #fff; }
.mimgs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; margin-bottom: 8px; background: var(--surface-alt); border-radius: 10px; }
.matt { padding: 0 14px 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.matt > .faint { flex-basis: 100%; }
.pill.att { text-decoration: none; padding: 6px 12px; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill.att.off { opacity: .6; }
.mread-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 18px 16px; }
.mread-f .btn { min-height: 42px; }
#mcompose-in { padding: 0 18px 18px; }

/* ---------- composer ---------- */
.mcomp { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-lg); }
.mbx-read > .mcomp { margin: 16px; }
.mcomp-h { display: flex; align-items: center; gap: 10px; }
.mcomp-h b { flex: 1; }
.mcf { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; }
.mcf > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.mcf .input { min-height: 42px; padding: 8px 12px; }
.mc-addcc { align-self: flex-start; min-height: 30px !important; padding: 0 6px !important; margin-left: 80px; }
.mc-body { min-height: 260px; font-family: inherit; line-height: 1.55; }
.mcomp .note { padding: 8px 12px; border-radius: 10px; background: var(--line); color: var(--ink-2); }

/* ---------- narrower: sidebar becomes a drawer ---------- */
@media (max-width: 1100px) {
  .mbx { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); }
  .mbx-foldbtn { display: grid !important; }
  .mbx-side { display: none; }
  .mbx.show-side .mbx-side {
    display: flex; position: fixed; left: 16px; top: 72px; bottom: 24px; width: min(280px, calc(100vw - 32px)); z-index: 45; box-shadow: var(--shadow-lg);
  }
}
/* ---------- phone: one column, list ↔ thread ---------- */
@media (max-width: 760px) {
  main.mail-main { padding: 8px 0 0; }
  .mbx { grid-template-columns: 1fr; gap: 0; height: calc(100dvh - 57px - 8px - 66px - env(safe-area-inset-bottom)); }
  .mbx > .card { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .mbx.pane-list .mbx-read { display: none; }
  .mbx.pane-read .mbx-list { display: none; }
  .mbx-back { display: grid !important; }
  .mbx.show-side .mbx-side { top: 64px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; }
  .mread-h { padding: 10px 12px; }
  .mread-h h2 { font-size: 17px; }
  .mread-h .acts { flex-basis: 100%; justify-content: flex-start; }
  .mmsgs { padding: 10px 10px; }
  .mmsg-h { padding: 10px 12px; }
  .mmsg-h .dt { display: none; }
  .mmsg-b { padding: 0 8px 10px; }
  .mread-f { padding: 4px 10px 14px; }
  .mread-f .btn { flex: 1; padding: 0 10px; }
  .mread-f .btn span { font-size: 14px; }
  #mcompose-in { padding: 0 8px 14px; }
  .mbx-read > .mcomp { margin: 8px; }
  .mcf { grid-template-columns: 1fr; gap: 4px; }
  .mc-addcc { margin-left: 0; }
  .mcf-hint { margin-left: 0; }
  .mbx-chips { padding: 6px 8px; }
  .mset-sec { padding: 12px 10px; }
}

/* ---------- personal address onboarding (alias-onboard.js) ---------- */
.aob { display: flex; justify-content: center; padding: 8px 0 24px; }
.aob-card { width: 100%; max-width: 640px; padding: 24px 26px; display: flex; flex-direction: column; gap: 16px; }
.aob-h { display: flex; gap: 14px; align-items: flex-start; }
.aob-h h1 { margin: 0 0 4px; font-size: 22px; line-height: 1.25; }
.aob-h p { margin: 0; color: var(--ink-2); }
.aob-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); }
.aob-ic svg { width: 24px; height: 24px; }
.aob-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.aob-steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.aob-steps .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink-2); }
.aob-steps .dot svg { width: 16px; height: 16px; }
.aob-steps li.on { color: var(--ink); }
.aob-steps li.on .dot { border-color: var(--brand); background: var(--brand); color: #fff; }
.aob-steps li.done { color: var(--ink-2); }
.aob-steps li.done .dot { border-color: transparent; background: var(--brand-soft); color: var(--brand-text); }
.aob-bar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin: -4px 12% 0; }
.aob-bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .25s ease; }
.aob-body { display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.aob-body p { margin: 0; }
.aob-l { font-weight: 700; font-size: 15px; }
.aob-l-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aob-h2 { margin: 0; font-size: 18px; }
.aob-addr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aob-addr .input { flex: 1 1 200px; min-width: 0; font-size: 16px; font-weight: 600; }
.aob-at { font-weight: 700; font-size: 18px; color: var(--ink-2); }
.aob-doms { display: flex; gap: 6px; flex-wrap: wrap; }
.aob-dom-w { display: inline-flex; align-items: center; gap: 2px; }
.aob-dom small { font-weight: 600; opacity: .9; }
.chip.aob-dom:disabled { cursor: not-allowed; color: var(--ink-3); background: var(--surface-alt); border-style: dashed; }
.aob-i { width: 36px; height: 36px; color: var(--ink-2); }
.aob-i svg { width: 18px; height: 18px; }
.aob-st { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); min-height: 24px; }
.aob-st svg { width: 18px; height: 18px; flex: none; }
.aob-st.ok { color: #1B7A35; }
.aob-st.bad { color: #C0281E; }
:root[data-theme="dark"] .aob-st.ok { color: #6EE08E; }
:root[data-theme="dark"] .aob-st.bad { color: #FF8A80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aob-st.ok { color: #6EE08E; } :root:not([data-theme="light"]) .aob-st.bad { color: #FF8A80; } }
.aob-st .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand); animation: aobspin .8s linear infinite; }
@keyframes aobspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .aob-st .spin { animation: none; } .aob-bar span { transition: none; } }
.aob-sugg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aob-pill { border: 1px solid var(--line-2); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; background: var(--surface-alt); color: var(--ink); min-height: 32px; }
.aob-pill:hover { border-color: var(--brand); }
.aob-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-alt); color: var(--ink-2); font-size: 14px; }
.aob-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--brand-text); }
.aob-note.warn svg { color: var(--warning); }
.aob-sig { font-family: inherit; min-height: 110px; }
.aob-mail { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 14px 16px; background: #fff; color: #1A1A2E; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.aob-mail .faint { color: rgba(26, 26, 46, .7); }
.aob-mail-h { padding-bottom: 8px; border-bottom: 1px solid #ecebe6; overflow-wrap: anywhere; }
.aob-sigprev { border-top: 1px solid #e8e8e4; padding-top: 10px; color: #4a4a5a; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.aob-sigprev a { color: #005BC7; }
.aob-sum { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.aob-sum > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.aob-sum dt { color: var(--ink-2); font-weight: 600; font-size: 14px; }
.aob-sum dd { margin: 0; overflow-wrap: anywhere; }
.aob-sum .aob-sigprev { border: 1px solid #ecebe6; border-radius: 12px; padding: 10px 12px; background: #fff; }
.aob-f { display: flex; align-items: center; gap: 10px; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.aob-f .btn { min-width: 110px; }
.aob-f .aob-count { flex: 1; text-align: center; color: var(--ink-3); }
.aob-final { align-items: center; text-align: center; padding: 36px 26px; }
.aob-final h1 { margin: 0; font-size: 22px; }
.aob-final p { margin: 0; color: var(--ink-2); max-width: 440px; }
.aob-big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; }
.aob-big svg { width: 32px; height: 32px; }
.aob-big.ok { background: color-mix(in srgb, var(--s-won) 16%, transparent); color: var(--s-won); }
.aob-big.wait { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.aob-reqs .aob-req { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.aob-req-m { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.aob-req .aob-sigprev { background: #fff; border: 1px solid #ecebe6; border-radius: 10px; padding: 8px 10px; }
.aob-recent { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mail-noaddr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
@media (max-width: 760px) {
  .aob { padding: 0 0 12px; }
  .aob-card { padding: 18px 16px; border-radius: var(--r-lg); gap: 14px; }
  .aob-h h1 { font-size: 19px; }
  .aob-ic { width: 38px; height: 38px; }
  .aob-steps .lbl { font-size: 12px; }
  .aob-addr .input { flex-basis: 100%; }
  .aob-at { display: none; }
  .aob-sum > div { grid-template-columns: 1fr; gap: 4px; }
  .aob-f { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); background: var(--surface); margin: 0 -16px -18px; padding: 12px 16px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .aob-f .btn { min-width: 0; flex: 1; }
  .aob-f .aob-count { display: none; }
}
.aob-card > .aob-sigprev { border: 1px solid #ecebe6; border-radius: 12px; padding: 10px 12px; background: #fff; }
.aob-doms-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 14px; }
.aob-doms-line b { color: var(--ink); }
.aob-big.lock { background: var(--brand-soft); color: var(--brand-text); }
.aob-lockbar { width: min(280px, 100%); height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
.aob-lockbar span { display: block; height: 100%; background: var(--brand); border-radius: 8px; }
.aob-band { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; background: var(--brand-soft); color: var(--ink); font-size: 13px; line-height: 1.4; border-bottom: 1px solid var(--line); }
.aob-band svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--brand-text); }
.mcomp .aob-band { border-radius: 10px; border: 0; }

/* ---------- sending limits strip (top of the Mail tab) ---------- */
.mbx.has-lim { grid-template-rows: auto minmax(0, 1fr); }
.mbx-lim { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px 20px; flex-wrap: wrap; padding: 8px 14px; overflow: visible !important; }
.mbx-lim[hidden] { display: none; }
.mlim-bars { display: flex; gap: 18px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.mlim-i { flex: 0 1 200px; min-width: 130px; display: flex; flex-direction: column; gap: 5px; --lim: var(--brand); }
.mlim-i.warn { --lim: var(--warning); }
.mlim-i.full { --lim: var(--danger); }
.mlim-t { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.mlim-t .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mlim-t b { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; flex: none; }
.mlim-i.warn .mlim-t b { color: color-mix(in srgb, var(--warning) 70%, var(--ink)); }
.mlim-i.full .mlim-t b { color: var(--danger); }
.mlim-bar { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.mlim-bar span { display: block; height: 100%; border-radius: inherit; background: var(--lim); transition: width .3s ease; }
.mlim-note { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--ink-2); flex: 0 1 auto; }
.mlim-note .full { color: var(--danger); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .mlim-bar span { transition: none; } }
@media (max-width: 760px) {
  .mbx.has-lim.pane-read { grid-template-rows: minmax(0, 1fr); }
  .mbx.pane-read .mbx-lim { display: none; }
  .mbx-lim { padding: 8px 12px 10px; gap: 6px; border-bottom: 1px solid var(--line) !important; }
  .mlim-bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; width: 100%; }
  .mlim-i { min-width: 0; gap: 4px; }
  .mlim-t { flex-direction: column-reverse; align-items: flex-start; gap: 0; font-size: 11.5px; }
  .mlim-t .nm { white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }
  .mlim-t b { font-size: 14px; }
  .mlim-note { font-size: 12px; }
}

/* ---------- conversation (chat view of a mail thread: static/chat.js) ----------
   The café on the left, us on the right; quoted history behind "•••"; the
   composer pinned at the bottom. Mail tab: the thread pane is a column with
   the bubbles scrolling and the composer fixed. Cafe card: capped height. */
.mbx-read.chat { overflow: hidden !important; max-height: 100%; }
.mbx-read.chat .mread-h { position: static; }
.mconv { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mconv[hidden] { display: none; }
.mbx-read.chat #mcompose-in { overflow-y: auto; flex: 1 1 auto; min-height: 0; padding-top: 12px; }
.cv { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; --cv-out: #0066D6; --cv-out-ink: #fff; --cv-in: rgba(var(--ink-rgb), .075); }
.cv-msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px 12px; display: flex; flex-direction: column; gap: 10px; }
.cv-empty { margin: auto; padding: 24px; text-align: center; }
.cv-day { display: flex; justify-content: center; margin: 6px 0 2px; }
.cv-day span { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--line); padding: 3px 10px; border-radius: 999px; }
/* Cafe conversation: where the subject changes (another thread of the same cafe). */
.cv-subj-div { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; color: var(--ink-3); font-size: 12px; }
.cv-subj-div::before, .cv-subj-div::after { content: ""; flex: 1 1 0; border-top: 1px dashed var(--line-2); }
.cv-subj-div span { max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cv-row { display: flex; gap: 8px; align-items: flex-end; max-width: min(78%, 640px); }
.cv-row.in { align-self: flex-start; }
.cv-row.out { align-self: flex-end; flex-direction: row-reverse; }
.cv-av { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--line-2); color: var(--ink-2); margin-bottom: 2px; }
.cv-col { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cv-row.out .cv-col { align-items: flex-end; }
.cv-meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 5px; align-items: baseline; padding: 0 6px; }
.cv-who { font-weight: 600; color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-meta .cv-mav { width: 18px; height: 18px; font-size: 9px; cursor: default; overflow: hidden; align-self: center; }
.cv-ok { display: inline-flex; align-self: center; color: var(--brand-text); }
.cv-ok svg { width: 13px; height: 13px; }
.cv-subj { font-size: 13px; margin-bottom: 4px; opacity: .92; }
.cv-bubble { position: relative; padding: 9px 13px 10px; border-radius: 18px; background: var(--cv-in); color: var(--ink); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; max-width: 100%; }
.cv-row.in .cv-bubble { border-bottom-left-radius: 6px; }
.cv-row.out .cv-bubble { background: var(--cv-out); color: var(--cv-out-ink); border-bottom-right-radius: 6px; }
.cv-text { white-space: pre-wrap; }
.cv-text ul { margin: 2px 0; padding-left: 20px; white-space: normal; }
.cv-text li { margin: 1px 0; white-space: pre-wrap; }
.cv-text b { font-weight: 700; }
.cv-row.out .cv-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cv-more { display: inline-block; margin-top: 4px; border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; line-height: 1; letter-spacing: 1px; padding: 3px 9px 5px; border-radius: 999px; background: rgba(var(--ink-rgb), .08); color: var(--ink-2); }
.cv-row.out .cv-more { background: rgba(255, 255, 255, .22); color: #fff; }
.cv-more:hover { filter: brightness(.96); }
.cv-quote { margin-top: 8px; padding: 8px 0 0 10px; border-left: 2px solid rgba(var(--ink-rgb), .18); font-size: 13.5px; color: var(--ink-2); max-height: 320px; overflow: auto; }
.cv-row.out .cv-quote { border-left-color: rgba(255, 255, 255, .45); color: rgba(255, 255, 255, .88); }
.cv-quote > div { white-space: pre-wrap; }
.cv-sig { margin-bottom: 8px; }
.cv-att { display: flex; gap: 6px; flex-wrap: wrap; }
.cv-orig { border: 0; background: none; color: var(--brand-text); font: inherit; font-size: 12px; font-weight: 600; padding: 2px 6px; cursor: pointer; }
/* Inside the "•••" area: the HTML original, as a small secondary link. */
.cv-fmt { display: inline-block; margin-top: 6px; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--brand-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; white-space: normal; }
.cv-row.out .cv-fmt { color: #fff; }
.cv-quote > .cv-fmt { display: block; }
.cv-frame { width: min(640px, 72vw); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cv-row.pending .cv-bubble { opacity: .72; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .5); }
.cv-row.pending.failed .cv-bubble { background: color-mix(in srgb, var(--danger) 70%, var(--surface)); }
.cv-status { font-size: 12px; color: var(--ink-3); padding: 0 6px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cv-status .cv-cd { font-variant-numeric: tabular-nums; }
.cv-undo { border: 0; background: var(--brand-soft); color: var(--brand-text); font: inherit; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.cv-undo:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.cv-err { color: var(--danger); font-weight: 600; }

.cv-foot { flex: none; border-top: 1px solid var(--line); background: var(--surface); }
.cv-noreply { padding: 14px 18px; }
.cv-comp { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.cv-to { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-to b { font-weight: 600; color: var(--ink-2); }
.cv-ta { width: 100%; resize: none; min-height: 48px; max-height: 200px; border: 1px solid var(--line-2); border-radius: 16px; padding: 11px 14px; font: inherit; font-size: 15px; line-height: 1.5; background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.cv-ta:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cv-tools { display: flex; align-items: center; gap: 8px; }
.cv-tools-l { display: flex; gap: 2px; }
.cv-tools-l .iconbtn { width: 34px; height: 34px; background: transparent; color: var(--ink-2); }
.cv-tools-l .iconbtn:hover { background: var(--line); color: var(--ink); }
.cv-tools-l .iconbtn svg { width: 17px; height: 17px; }
.cv-tools-r { flex: none; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.cv-tools-r .btn { min-height: 38px; }
.cv-tools-r .btn svg { width: 16px; height: 16px; }
.cv-send { padding: 0 16px; }
.cv-hint { flex: 1 1 120px; min-width: 0; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-warnbox:empty { display: none; }
.cv-warn { border-radius: 14px; padding: 10px 12px; background: color-mix(in srgb, var(--warning) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); font-size: 13.5px; color: var(--ink); }
.cv-warn.ok { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.cv-warn.ok span { flex: 1; }
.cv-warn svg { width: 16px; height: 16px; flex: none; }
.cv-warn-h { display: flex; align-items: center; gap: 8px; }
.cv-warn-h b { flex: 1; }
.cv-warn .iconbtn { width: 28px; height: 28px; background: transparent; }
.cv-warn .iconbtn svg { width: 14px; height: 14px; }
.cv-warn ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.cv-wk { font-weight: 700; }
.cv-warn q { font-style: italic; }

/* Cafe card: the conversation sits in the Mail section with a capped height. */
.card-conv { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; margin: 8px 0 14px; background: var(--surface); }
.card-conv .cv.compact .cv-msgs { max-height: 420px; padding: 12px; }
.card-conv .cv-row { max-width: 88%; }
.conv-tg { margin: 4px 0 10px; }
/* Café card: our mails no conversation holds yet (approval / limit queue) as pending bubbles. */
.card-jobs { margin: 8px 0 14px; }
.card-jobs .cv-msgs { padding: 0; overflow: visible; }
.card-jobs .cv-row { max-width: 88%; }

@media (max-width: 760px) {
  .cv-msgs { padding: 12px 10px 10px; }
  .cv-row { max-width: 90%; }
  .cv-av { display: none; }
  .cv-comp { padding: 8px 10px 10px; }
  .cv-tools-r .btn span { display: none; }
  .cv-tools-r .cv-send span { display: inline; }
  .cv-tools-r .btn { padding: 0 10px; }
  .cv-hint { display: none; }
  .cv-tools-r { margin-left: auto; }
  .cv-frame { width: 82vw; }
  /* Thread header stays compact so the conversation gets the room. */
  .mbx-read.chat .mread-h { padding: 8px 10px; gap: 6px; }
  .mbx-read.chat .mread-h .acts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mbx-read.chat .mread-h .acts::-webkit-scrollbar { display: none; }
  .mbx-read.chat .mread-h .acts .btn { flex: none; min-height: 34px; }
  .mbx-read.chat .mticket { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) { .cv-ta { transition: none; } }
