/* AI Mail webmail (myaimail.net, src/webmail): the list, the reading view, the composers, the
   drawer and the scope chips, on top of the console's shell and tokens (/site.css, /console.css).
   Scoped to body.wm. Mobile first: the base rules are the phone's (edge to edge list, 72px rows,
   44px targets, fixed action bar, floating Compose); @media (min-width: 901px) is the desktop.
   No inline style anywhere (CSP style-src 'self'); the message body is its own document in a
   sandboxed iframe with its own stylesheet (src/webmail/frame.js). */
body.wm { overflow-x: hidden; }
.wm kbd { font: 600 .74rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--panel); color: var(--ink); }
body.wm input, body.wm select, body.wm textarea { font-size: 16px; }
body.wm main.console.page { max-width: 1400px; padding: 0 0 calc(96px + env(safe-area-inset-bottom)); animation: none; }
body.wm .mtop-acct { display: none; }

/* Top bar on phones: menu, where you are, refresh, search */
.wm-mtop-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; }
.wm-mtop-title strong { font-weight: 650; }
body.wm .mtop { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
.wm-reading .mtop { display: none; }

/* Search and compose */
.wm-top { display: flex; align-items: center; gap: 10px; margin: 10px max(12px, env(safe-area-inset-left)) 6px; }
.wm-search { flex: 1; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--field-bg); min-height: 46px; min-width: 0; }
.wm-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.wm-search .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.console .wm-search input[type=search] { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 44px; padding: 6px 4px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.wm-search .btn { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; min-height: 0; border: 0; }
.console .btn.wm-compose-btn, .wm-help-btn { display: none; }
.wm-help-btn:not([hidden]) { display: none; }

/* Title row: where you are, Updated just now, refresh */
.wm-title { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 12px; margin: 8px max(16px, env(safe-area-inset-left)) 6px; }
.wm-title h1 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; overflow-wrap: anywhere; flex: 1; min-width: 0; font-weight: 650; }
.wm-title p { margin: 0; flex-basis: 100%; }
.wm-refresh { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.wm-refresh .icon-btn { display: none; }
.wm-refresh.is-busy .ico { animation: wm-spin .8s linear infinite; }
@keyframes wm-spin { to { transform: rotate(360deg); } }
[data-wm-refresh].is-busy .ico { animation: wm-spin .8s linear infinite; }
.wm-window { display: flex; gap: 6px; flex-basis: 100%; }

/* Chips: scope, window, labels (a row that scrolls sideways inside itself on phones) */
.wm-scope { display: flex; gap: 6px; margin: 0 0 10px; padding: 0 max(16px, env(safe-area-inset-left)); overflow-x: auto; scrollbar-width: none; }
.wm-scope::-webkit-scrollbar { display: none; }
.wm-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: .84rem; text-decoration: none; cursor: pointer; white-space: nowrap; max-width: 100%; flex: none; }
.wm-chip a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.wm-chip:hover, .wm-chip a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.wm-chip.is-on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--brand-strong); }
.wm-chip .ico { width: 14px; height: 14px; }
.wm-chip-x { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-right: -8px; border-radius: 999px; font-weight: 700; color: var(--muted) !important; }
.wm-chip-x:hover { background: var(--hover); }
.wm-toggle strong { color: var(--brand-strong); }
.wm-n { font-size: .68rem; padding: 1px 5px; margin-right: 2px; }

/* The list: edge to edge on phones, 72px rows, the avatar circle is the checkbox */
.wm-list { list-style: none; margin: 0; padding: 0; background: var(--panel); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wm-row { position: relative; border-top: 1px solid var(--line); background: var(--panel); overflow: hidden; touch-action: pan-y; }
.wm-row:first-child { border-top: 0; }
.wm-row-in { position: relative; display: flex; align-items: stretch; min-height: 72px; background: var(--panel); will-change: transform; }
.wm-row.is-settling .wm-row-in { transition: transform .2s var(--ease); }
.wm-row.is-leaving { transition: max-height .22s var(--ease), opacity .22s var(--ease); max-height: 0 !important; opacity: 0; border-top-width: 0; }
.wm-pick { position: relative; flex: none; display: flex; align-items: flex-start; justify-content: center; width: 60px; padding: 15px 0 0 8px; cursor: pointer; }
.wm-row > .wm-row-in > .wm-pick { align-self: stretch; }
.wm-pick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.wm-pick-all { width: 44px; padding: 0; align-items: center; min-height: 44px; }
.wm-pick-all input { position: static; opacity: 1; width: 22px; height: 22px; }
.wm-pick[hidden], .wm-bulk-count[hidden], .wm-bulk[hidden] { display: none; }
.wm-pick:has(input:focus-visible) .wm-av { outline: 2px solid var(--focus); outline-offset: 2px; }
.wm-av { --h: 232; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; font-weight: 650; font-size: 1.05rem; color: #fff; background: hsl(var(--h) 52% 42%); user-select: none; }
.wm-av-0 { --h: 232; } .wm-av-1 { --h: 172; } .wm-av-2 { --h: 22; } .wm-av-3 { --h: 340; }
.wm-av-4 { --h: 270; } .wm-av-5 { --h: 200; } .wm-av-6 { --h: 142; } .wm-av-7 { --h: 38; }
.wm-pick:has(input:checked) .wm-av { background: var(--brand); font-size: 0; }
.wm-pick:has(input:checked) .wm-av::after { content: "\2713"; font-size: 1.3rem; color: var(--brand-ink); }
.wm-row-link { flex: 1; min-width: 0; display: grid; align-content: center; gap: 1px; padding: 7px 2px 7px 0; color: var(--ink); text-decoration: none; line-height: 1.3; }
body.wm main.console a.wm-row-link, .console .wm-tmsg summary { color: var(--ink); }
body.wm main.console a.icon-btn { color: var(--muted); }
body.wm main.console a.icon-btn:hover { color: var(--ink); }
body.wm main.console a.wm-chip { color: var(--ink); }
body.wm main.console a.wm-chip.is-on { color: var(--brand-strong); }
.wm-row-link:hover { text-decoration: none; }
.wm-row:hover .wm-row-in { background: color-mix(in srgb, var(--brand) 4%, var(--panel)); }
.wm-row.is-selected .wm-row-in, .wm-row.is-current .wm-row-in { background: color-mix(in srgb, var(--brand) 9%, var(--panel)); box-shadow: inset 3px 0 0 var(--brand); }
.wm-row.is-picked .wm-row-in { background: color-mix(in srgb, var(--brand) 12%, var(--panel)); }
.wm-r1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wm-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.wm-row.is-unread .wm-dot { background: var(--brand); }
.wm-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .96rem; font-weight: 500; }
.wm-row.is-unread .wm-from, .wm-row.is-unread .wm-subj { font-weight: 700; }
.wm-row:not(.is-unread) .wm-subj { color: var(--muted); }
.wm-subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.wm-r3 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wm-prev { flex: 1 1 0; min-width: 0; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-when { flex: none; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.wm-row.is-unread .wm-when { color: var(--ink); font-weight: 650; }
.wm-meta { flex: none; display: flex; align-items: center; gap: 4px; max-width: 60%; min-width: 0; }
.wm-meta .chip { padding: 0 7px; font-size: .68rem; line-height: 1.6; }
.wm-labels-in { display: none; }
.wm-mb { background: var(--bg2); border-radius: 999px; padding: 0 8px; color: var(--muted); font-size: .7rem; line-height: 1.6; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-clip .ico { width: 15px; height: 15px; color: var(--muted); display: block; }
.wm-row-act { flex: none; display: flex; align-items: center; padding-right: 2px; margin: 0; }
.wm-row-act .icon-btn { width: 44px; height: 44px; }
.wm-swipe-bg { position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--ok-c); color: #fff; font-weight: 650; gap: 8px; }
.wm-swipe-bg .ico { width: 22px; height: 22px; }
.wm-row.is-swiping .wm-swipe-bg { display: flex; }
.wm-pager { display: flex; justify-content: center; margin: 14px 12px; }
.wm-pager .btn { width: 100%; max-width: 360px; }
.wm-pager.is-loading .btn { opacity: .6; pointer-events: none; }
.wm-list-empty { margin: 12px 16px; padding: 18px 10px; }
.wm-list-empty .empty-state { border: 0; background: transparent; }

/* Archive selected, Mark read, Mark unread */
.wm-bulk { display: flex; align-items: center; gap: 6px 10px; margin: 0; padding: 4px max(8px, env(safe-area-inset-left)) 4px 8px; border-top: 1px solid var(--line); background: var(--panel); }
.wm-bulk .wm-pick-all { width: 44px; }
.wm-bulk-count { min-width: 6em; flex: 1; }
.wm-bulk:not(:has(~ .wm-list .wm-pick input:checked)) .wm-bulk-btns { display: none; }
.wm-bulk-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.console .wm-bulk .btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

/* Toasts: what happened, with Undo, for about six seconds */
.wm-toast { position: fixed; z-index: 70; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(92vw, 520px); padding: 10px 8px 10px 16px; border-radius: 12px; background: #1f2230; color: #f3f4f8; box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .12); font-size: .92rem; animation: wm-toast-in .22s var(--ease) both, wm-toast-out .25s ease 6s forwards; }
.wm-toast[hidden] { display: none; }
.wm-toast.is-sticky { animation: wm-toast-in .22s var(--ease) both; }
.wm-toast.err { border-left: 4px solid #ff8a8a; }
.wm-toast.warn { border-left: 4px solid #f6c453; }
.wm-toast .ico { width: 18px; height: 18px; flex: none; color: #86efac; }
.wm-toast.err .ico { color: #ff8a8a; } .wm-toast.warn .ico { color: #f6c453; }
.wm-toast-msg { flex: 1; min-width: 0; }
.wm-toast form { display: contents; }
.wm-toast-undo { min-height: 44px; min-width: 56px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: #a5b4fc; font: inherit; font-weight: 700; cursor: pointer; }
.wm-toast-undo:hover { background: rgba(255, 255, 255, .1); }
@keyframes wm-toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes wm-toast-out { to { opacity: 0; visibility: hidden; } }

/* Floating Compose (phones) */
.wm-fab { position: fixed; z-index: 25; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px; border-radius: 18px; background: var(--brand); color: var(--brand-ink); font-weight: 650; text-decoration: none; box-shadow: 0 10px 26px -6px color-mix(in srgb, var(--brand) 60%, #000); }
.wm-fab:hover { text-decoration: none; filter: brightness(1.06); }
.wm-fab .ico { width: 22px; height: 22px; }
body.wm main.console a.wm-fab { color: var(--brand-ink); }

/* Pull to refresh */
.wm-ptr { position: fixed; z-index: 45; left: 50%; top: 0; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); color: var(--brand); box-shadow: var(--shadow-pop); border: 1px solid var(--line); opacity: 0; transform: translateY(-48px); pointer-events: none; }
.wm-ptr .ico { width: 20px; height: 20px; }
.wm-ptr.is-busy .ico { animation: wm-spin .8s linear infinite; }

/* The drawer: filter, Compose, views, pinned, mailboxes by domain */
.wm-mbfilter { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field-bg); min-height: 44px; }
.wm-mbfilter:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.wm-mbfilter .ico { width: 17px; height: 17px; color: var(--muted); flex: none; }
.side .wm-mbfilter input[type=search] { flex: 1; min-width: 0; border: 0; background: transparent; min-height: 42px; padding: 4px 2px; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.side .wm-drawer-compose { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 9px 16px; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font-weight: 650; text-decoration: none; flex: none; }
.side .wm-drawer-compose .ico { width: 18px; height: 18px; }
.side .wm-drawer-compose:hover { filter: brightness(1.06); }
.wm-more > summary { cursor: pointer; padding: 8px 12px; min-height: 40px; display: flex; align-items: center; margin: 0; list-style: none; }
.wm-more > summary::-webkit-details-marker, .wm-dom > summary::-webkit-details-marker { display: none; }
.wm-more[open] > summary { margin-bottom: 4px; }
.wm-mailboxes .nav-group-label { margin-top: 2px; }
.wm-dom > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 6px 12px; border-radius: 10px; cursor: pointer; list-style: none; font-size: .86rem; font-weight: 700; color: var(--ink); }
.wm-dom > summary:hover { background: var(--hover); }
.wm-dom > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease); flex: none; margin-right: 2px; }
.wm-dom[open] > summary::before { transform: rotate(45deg); }
.wm-dom-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-dom-ct { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: .78rem; }
.wm-dom ul, .wm-pinned ul { list-style: none; margin: 0 0 4px; padding: 0; }
.wm-mbrow { display: flex; align-items: center; }
.wm-mbrow[hidden] { display: none; }
.wm-mbrow .nav-link { flex: 1; min-width: 0; min-height: 44px; }
.wm-mbn { overflow: hidden; text-overflow: ellipsis; }
.wm-pin { width: 40px; height: 40px; }
.wm-pin[aria-pressed="true"] { color: var(--warn-c); }
.wm-pin[aria-pressed="true"] .ico { fill: currentColor; }
.wm-pin:not([hidden]) { display: inline-grid; }
.wm-mbnone { padding: 6px 12px; }
.wm-dom[hidden], .wm-pinned[hidden] { display: none; }

/* Message: the reading view */
.wm-msg { max-width: 860px; margin: 0 auto; }
.wm-read { background: var(--panel); min-width: 0; padding: 0 max(16px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)); }
.wm-read-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 2px; margin: 0 -16px 4px; padding: max(6px, env(safe-area-inset-top)) 8px 6px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.wm-read-top .icon-btn { width: 44px; height: 44px; }
.wm-read-spacer { flex: 1; }
.wm-prevnext { display: flex; }
.wm-flip { transform: scaleX(-1); }
.wm-subject { font-size: 1.4rem; line-height: 1.25; margin: 14px 0 8px; overflow-wrap: anywhere; letter-spacing: -.015em; font-weight: 600; }
.wm-read .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.wm-warn { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 8px; padding: 7px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); font-size: .84rem; line-height: 1.4; border: 1px solid color-mix(in srgb, var(--warn-c) 30%, transparent); }
.wm-warn .ico { width: 16px; height: 16px; color: var(--warn-c); flex: none; margin-top: 2px; }
.wm-inline { display: inline; margin: 0; }
.wm-thread { display: grid; gap: 0; }
.wm-card { border-top: 1px solid var(--line); padding: 14px 0; min-width: 0; }
.wm-card-open { padding-bottom: 6px; }
.wm-sender { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.wm-sender-main { flex: 1; min-width: 0; }
.wm-sender-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.wm-sender-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wm-sender-top time { flex: none; color: var(--muted); font-size: .8rem; }
.wm-sender-addr { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-to { margin-top: 2px; }
.wm-to > summary { display: inline-flex; align-items: center; gap: 2px; min-height: 28px; font-size: .84rem; color: var(--muted); cursor: pointer; list-style: none; }
.wm-to > summary::-webkit-details-marker { display: none; }
.wm-to > summary .ico { width: 16px; height: 16px; }
.wm-to[open] > summary .ico { transform: rotate(180deg); }
.wm-headers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 6px 0 4px; padding: 8px 12px; font-size: .86rem; background: var(--bg2); border-radius: 10px; }
.wm-headers dt { color: var(--muted); font-size: .76rem; margin-top: 6px; }
.wm-headers dt:first-child { margin-top: 0; }
.wm-headers dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.wm-body { margin: 6px 0 12px; min-width: 0; }
.wm-frame { display: block; width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .wm-fh-0 { height: 272px; }
  .wm-fh-1 { height: 385px; }
  .wm-fh-2 { height: 610px; }
  .wm-fh-3 { height: 1060px; }
  .wm-fh-4 { height: 1960px; }
  .wm-fh-5 { height: 2600px; }
  .wm-fh-6 { height: 2600px; }
  .wm-fh-7 { height: 2600px; }
  .wm-fh-8 { height: 2600px; }
  .wm-fh-9 { height: 2600px; }
.wm-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.55; padding: 2px 0; }
.wm-imgbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .84rem; padding: 6px 12px; border-radius: 10px; background: var(--bg2); margin: 0 0 8px; }
.wm-imgbar .ico { width: 16px; height: 16px; color: var(--muted); }
.wm-textlink { margin: 6px 0 0; }
.wm-atts ul { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.wm-atts p { margin: 4px 0 0; }
body.wm main.console a.wm-attchip, .wm-attchip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 6px 14px 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); color: var(--ink); text-decoration: none; font-size: .88rem; }
.wm-attchip:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); text-decoration: none; }
.wm-attchip .ico { width: 17px; height: 17px; color: var(--muted); flex: none; }
.wm-att-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.wm-att-s { color: var(--muted); font-size: .78rem; flex: none; }
.wm-tmsg > summary { display: flex; gap: 12px; align-items: center; cursor: pointer; list-style: none; min-height: 52px; }
.wm-tmsg > summary::-webkit-details-marker { display: none; }
.wm-tmsg-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.wm-tmsg-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.wm-tmsg-top time { color: var(--muted); font-size: .78rem; flex: none; }
.wm-tmsg-body { padding-top: 8px; }
.wm-tmsg[open] > summary { margin-bottom: 4px; }
.wm-labels-wrap { margin: 4px 0 8px; }
.wm-labels-wrap > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.wm-labels { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0 4px; }
.console .wm-labels input { min-height: 44px; padding: 4px 10px; width: 10em; }

/* Action bar: Reply, Reply all, Forward (fixed on phones, sticky on desktop) */
.wm-bar { position: fixed; z-index: 28; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.wm-bar .btn { flex: 1; min-width: 0; padding-left: 8px; padding-right: 8px; }

/* While a composer is open the bar would cover its Send button */
.wm-read:has(.wm-composer.is-open) .wm-bar, .wm-read:has(.wm-composer:target) .wm-bar { display: none; }

/* Inline composers (reply, forward): closed until asked for (script) or linked to (#reply) */
.wm-composer { display: none; margin: 6px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); scroll-margin-top: 70px; scroll-margin-bottom: 140px; }
.wm-composer.is-open, .wm-composer:target { display: block; }
.wm-comp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wm-comp-title { display: flex; align-items: center; gap: 8px; font-size: .98rem; margin: 0; min-width: 0; }
.wm-comp-title .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.wm-comp-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-comp-from { margin: 4px 0 8px; overflow-wrap: anywhere; }
.console .wm-composer textarea, .console .wm-composer input[type=text] { width: 100%; }
.console .wm-composer textarea { min-height: 7.5rem; max-height: 60vh; resize: none; overflow-y: auto; }
.wm-composer label { display: grid; gap: 4px; font-size: .84rem; color: var(--muted); margin-bottom: 8px; }
.wm-composer .wm-check { display: inline-flex; margin: 0; flex-direction: row; color: var(--ink); min-height: 44px; align-items: center; }
.wm-composer .wm-check input { width: 20px; height: 20px; }
.wm-comp-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.wm-sendstate.is-err { color: var(--bad-c); }
.wm-quote { margin: 6px 0 0; }
.wm-quote > summary { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 28px; padding: 0 12px; border-radius: 999px; background: var(--bg2); color: var(--muted); cursor: pointer; list-style: none; font-weight: 700; letter-spacing: .1em; }
.wm-quote > summary::-webkit-details-marker { display: none; }
.wm-quote blockquote { margin: 6px 0 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--line); color: var(--muted); font-size: .88rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14rem; overflow-y: auto; }
.wm-quote-read { margin-top: 4px; }
.wm-quote-read .wm-text { color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin-top: 6px; font-size: .94rem; }
.console textarea { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field-bg); color: var(--ink); max-width: 100%; resize: vertical; }
.console textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.wm-compose { margin: 12px 16px; }
.console .wm-compose form.stack { max-width: none; }
.console .wm-compose textarea, .console .wm-compose input[type=text] { width: 100%; }
.wm-check { display: inline-flex; align-items: center; gap: 8px; }
.wm-addr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wm-withheld .empty-state { margin: 0; }

/* Shortcuts */
.wm-help { position: fixed; z-index: 60; right: 24px; bottom: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-pop); }
.wm-help[hidden] { display: none; }
#wm-help-page { position: static; width: auto; box-shadow: var(--shadow); }
.wm-help h2 { margin: 0 0 10px; font-size: 1.05rem; }
.wm-keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wm-keys li { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 10px; align-items: center; font-size: .9rem; }

/* Signed out */
.wm-points { text-align: left; margin: 14px 0 18px; padding-left: 1.2em; color: var(--muted); line-height: 1.6; }
body.auth .cx-btn { text-decoration: none; display: flex; }
body.auth .cx-btn.cx-btn-2 { background: transparent; color: var(--ink); border: 1px solid var(--line); }

/* Held sends */
.wm-held-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.wm-held { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; padding: 12px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.wm-held:first-child { border-top: 0; }
.wm-held-main { display: grid; gap: 2px; min-width: 0; }
.wm-held-side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.wm main.console.page > .notice, body.wm main.console.page > .page-title, body.wm main.console.page > section.card, body.wm main.console.page > .empty-state, body.wm main.console.page > .wm-held-list, body.wm main.console.page > .wm-withheld { margin-left: 16px; margin-right: 16px; }
body.wm main.console.page > .page-title { padding-top: 12px; }

/* Phones only */
@media (max-width: 900px) {
  .wm-title h1 { display: none; }
  .wm-title { margin-top: 0; justify-content: flex-end; }
  .wm-bulk:not(:has(~ .wm-list .wm-pick input:checked)) { display: none; }
  .wm-bulk { position: sticky; top: calc(61px + env(safe-area-inset-top)); z-index: 20; }
  .wm-read { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .wm-row-link .wm-meta .wm-mb { max-width: 7em; }
}
@media (max-width: 600px) {
  .wm-headers dd { min-width: 0; }
  .wm-help { bottom: max(16px, env(safe-area-inset-bottom)); }
  .wm-bulk-btns .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wm-bulk-btns .btn { padding: 6px 10px; }
}
@media (pointer: coarse) { .wm-chip { min-height: 44px; } .wm-chip-x { width: 32px; height: 32px; } }
@media (pointer: coarse) { .wm-pick { width: 60px; min-height: 44px; } }

/* Desktop: persistent sidebar, a bordered list, Compose in the top bar, the bar under the message */
@media (min-width: 901px) {
  body.wm main.console.page { padding: 20px 24px 48px; }
  .wm-top { margin: 0 0 14px; }
  .wm-search { flex: 1 1 320px; max-width: 640px; border-radius: 12px; }
  .console .btn.wm-compose-btn { display: inline-flex; }
  .wm-help-btn:not([hidden]) { display: inline-grid; }
  .wm-fab { display: none; }
  .wm-title { margin: 4px 0 10px; }
  .wm-title h1 { font-size: 1.45rem; flex: 0 1 auto; }
  .wm-refresh .icon-btn { display: inline-grid; }
  .wm-scope { padding: 0; flex-wrap: wrap; overflow: visible; margin-bottom: 14px; }
  .wm-chip { min-height: 34px; }
  .wm-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .wm-bulk { border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; border-bottom: 0; margin-top: 0; }
  .wm-bulk + .wm-list { border-radius: 0 0 var(--radius) var(--radius); border-top: 1px solid var(--line); }
  .wm-row-in { min-height: 56px; }
  .wm-pick { padding-top: 8px; }
  .wm-row-link { grid-template-columns: 10px 190px minmax(0, auto) minmax(0, 1fr) auto auto; align-items: center; column-gap: 12px; padding: 4px 4px 4px 0; }
  .wm-r1, .wm-r3 { display: contents; }
  .wm-dot { grid-column: 1; grid-row: 1; } .wm-from { grid-column: 2; grid-row: 1; } .wm-subj { grid-column: 3; grid-row: 1; max-width: 32em; }
  .wm-prev { grid-column: 4; grid-row: 1; } .wm-meta { grid-column: 5; grid-row: 1; max-width: none; } .wm-when { grid-column: 6; grid-row: 1; min-width: 4.5em; text-align: right; }
  .wm-labels-in { display: inline-flex; gap: 4px; }
  .wm-toast { bottom: 28px; }
  .wm-reading .mtop { display: none; }
  .wm-read { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 24px 18px; }
  .wm-read-top { margin: 0 -24px 6px; border-radius: var(--radius) var(--radius) 0 0; top: 0; }
  .wm-subject { font-size: 1.6rem; }
  .wm-bar { position: sticky; left: auto; right: auto; bottom: 0; margin: 8px -24px 0; padding: 10px 24px; border-radius: 0 0 var(--radius) var(--radius); }
  .wm-bar .btn { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
  .wm-headers { grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; }
  .wm-headers dt { margin-top: 0; font-size: .86rem; }
.wm-fh-0 { height: 242px; }
  .wm-fh-1 { height: 284px; }
  .wm-fh-2 { height: 368px; }
  .wm-fh-3 { height: 536px; }
  .wm-fh-4 { height: 872px; }
  .wm-fh-5 { height: 1544px; }
  .wm-fh-6 { height: 2400px; }
  .wm-fh-7 { height: 2400px; }
  .wm-fh-8 { height: 2400px; }
  .wm-fh-9 { height: 2400px; }
  .console .wm-composer textarea { min-height: 9rem; }
}
/* Wider sidebars keep the mailbox list scrolling inside itself */
.side { overscroll-behavior: contain; }
.app.is-collapsed .wm-mbfilter, .app.is-collapsed .wm-more, .app.is-collapsed .wm-mailboxes, .app.is-collapsed .wm-pinned, .app.is-collapsed .wm-drawer-compose span { display: none; }
@media (prefers-reduced-motion: reduce) {
  .wm-toast { animation: wm-toast-out .01s ease 6s forwards; }
  .wm-toast.is-sticky { animation: none; }
  .wm-row.is-settling .wm-row-in, .wm-row.is-leaving { transition: none; }
}
