/* ===== Portal Inbox (ported from the email dashboard webmail) — colours follow the Portal light / dark theme ===== */
:root {
  --wmc-bg: #f4f6f9; --wmc-side: #ffffff; --wmc-card: #ffffff; --wmc-input: #f8fafc;
  --wmc-border: #e2e8f0; --wmc-border2: #cbd5e1; --wmc-row: #eef1f6;
  --wmc-text: #1e293b; --wmc-muted: #64748b; --wmc-nav: #334155; --wmc-heading: #0f172a;
  --wmc-accent: #2563eb; --wmc-accent-soft: #dbeafe; --wmc-link: #1d4ed8;
  --wmc-chip-bg: #eef2f8; --wmc-chip-fg: #334155;
  --wmc-bad: #dc2626; --wmc-bad-bg: #fee2e2; --wmc-bad-fg: #991b1b; --wmc-warn-bg: #fef3c7; --wmc-warn-fg: #92400e;
  --wmc-gm-bar: #eaf1fb; --wmc-gm-hover: #e3ebf8; --wmc-gm-send: #1d4ed8;
  --wmc-overlay: rgba(15, 23, 42, .45); --wmc-shadow: 0 10px 28px rgba(15, 23, 42, .18);
}
:root[data-theme="dark"] {
  --wmc-bg: #0b1120; --wmc-side: #111a2e; --wmc-card: #1e293b; --wmc-input: #0f172a;
  --wmc-border: #334155; --wmc-border2: #475569; --wmc-row: #27354a;
  --wmc-text: #f1f5f9; --wmc-muted: #94a3b8; --wmc-nav: #cbd5e1; --wmc-heading: #ffffff;
  --wmc-accent: #3b82f6; --wmc-accent-soft: #1e3a5f; --wmc-link: #93c5fd;
  --wmc-chip-bg: #27354a; --wmc-chip-fg: #cbd5e1;
  --wmc-bad: #ef4444; --wmc-bad-bg: #7f1d1d; --wmc-bad-fg: #fecaca; --wmc-warn-bg: #78350f; --wmc-warn-fg: #fde68a;
  --wmc-gm-bar: #1e2d47; --wmc-gm-hover: #2a3d5f; --wmc-gm-send: #2563eb;
  --wmc-overlay: rgba(2, 6, 23, .7); --wmc-shadow: 0 12px 32px rgba(0, 0, 0, .55);
}
/* Inbox page fills the whole content area */
.content.mail-full { padding: 0; overflow: hidden; }
.content.mail-full #page-inbox { height: 100%; }
#page-inbox #wm { width: 100%; }
.wm-empty-page { grid-column: 1 / -1; padding: 60px 24px; text-align: center; color: var(--wmc-muted); }
.wm-empty-page h3 { color: var(--wmc-heading); margin-bottom: 8px; font-size: 1.1rem; }
.wm-empty-page p { margin-bottom: 14px; max-width: 520px; margin-left: auto; margin-right: auto; }
.wm-toast, .wm-notif, .wm-menu-pop, .wm-cmp.float { font-family: 'Inter', system-ui, sans-serif; }
.wm-toast { z-index: 600; }
.wm-notif { z-index: 590; }
/* Email Accounts page */
.ma-who { display: flex; align-items: center; gap: 12px; }
.ma-av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 38px; background: var(--primary-light); }
.ma-av-l { display: grid; place-items: center; font-weight: 700; color: var(--primary); }
.ma-name { font-weight: 600; }
.ma-sub { color: var(--text-muted); font-size: .8rem; }
.ma-table td { vertical-align: middle; }
.ma-empty { padding: 28px; text-align: center; color: var(--text-muted); }
.ma-warn { background: var(--warning-bg); color: var(--warning); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: .85rem; }
.ma-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.ma-box b { color: var(--text); }
.ma-adv { margin-bottom: 14px; }
.ma-adv summary { cursor: pointer; color: var(--text-muted); font-size: .85rem; margin-bottom: 8px; }
.ma-adv .form-group { margin-top: 10px; }

/* Webmail (Gmail-style inbox) — uses the same theme variables as the dashboard */
#wm { --wm-side: 270px; display: grid; grid-template-columns: var(--wm-side) 1fr; height: calc(100vh - var(--topbar-h, 56px)); height: calc(100dvh - var(--topbar-h, 56px)); background: var(--wmc-bg); color: var(--wmc-text); position: relative; overflow: hidden; }
#wm button, .wm-cmp button, .wm-menu-pop button { margin: 0; }
.wm-cmp svg.i, #wm svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 18px; }
#wm .ibtn, .wm-cmp .ibtn { background: transparent; color: var(--wmc-muted); border: 0; border-radius: 50%; width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
#wm .ibtn:hover, .wm-cmp .ibtn:hover { background: var(--wmc-gm-hover); color: var(--wmc-heading); }
#wm .ibtn:disabled, .wm-cmp .ibtn:disabled { opacity: .35; cursor: default; }
#wm .ibtn.on, .wm-cmp .ibtn.on { color: var(--wmc-accent); }
.wm-loading { padding: 40px; color: var(--wmc-muted); }

/* ---- left column ---- */
.wm-side { background: var(--wmc-side); border-right: 1px solid var(--wmc-border); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.wm-compose { margin: 14px !important; padding: 14px 20px !important; border-radius: 16px !important; background: var(--wmc-gm-bar) !important; color: var(--wmc-heading) !important; border: 0; font-weight: 600; display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); font-size: 15px; }
.wm-compose:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .3); background: var(--wmc-gm-hover) !important; }
.wm-accts { overflow-y: auto; flex: 1; padding: 0 8px 12px; }
.wm-acct > .head { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--wmc-heading); font-weight: 600; font-size: 13.5px; user-select: none; }
.wm-acct > .head:hover { background: var(--wmc-gm-hover); }
.wm-acct > .head .av { width: 26px; height: 26px; border-radius: 50%; background: var(--wmc-accent); color: #fff; display: grid; place-items: center; font-size: 12px; flex: 0 0 26px; }
.wm-acct > .head .em { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-acct > .head .tag { font-size: 10px; font-weight: 600; color: var(--wmc-muted); border: 1px solid var(--wmc-border2); border-radius: 99px; padding: 0 6px; }
.wm-acct > .head .chev { transition: transform .15s; width: 16px; height: 16px; }
.wm-acct.open > .head .chev { transform: rotate(90deg); }
#wm .cnt { background: var(--wmc-accent); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; min-width: 20px; text-align: center; line-height: 18px; }
#wm .cnt.quiet { background: transparent; color: var(--wmc-muted); font-weight: 600; }
.wm-folders { display: none; padding: 2px 0 8px; }
.wm-acct.open .wm-folders { display: block; }
.wm-f { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px calc(14px + var(--d, 0) * 16px); border-radius: 0 20px 20px 0; margin-right: 8px; cursor: pointer; color: var(--wmc-nav); font-size: 14px; }
.wm-f:hover { background: var(--wmc-gm-hover); }
.wm-f.on { background: var(--wmc-accent-soft); color: var(--wmc-heading); font-weight: 700; }
.wm-f .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-f .x { opacity: 0; width: 22px; height: 22px; line-height: 1; border-radius: 50%; border: 0; background: transparent; color: var(--wmc-muted); cursor: pointer; padding: 0; }
.wm-f:hover .x { opacity: 1; }
.wm-newf { display: block; margin: 4px 0 0 14px; background: transparent; border: 0; color: var(--wmc-link); cursor: pointer; font-size: 13px; padding: 4px 0; }

/* ---- main column ---- */
.wm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wmc-card); margin: 8px 8px 8px 0; border-radius: 16px; border: 1px solid var(--wmc-border); overflow: hidden; position: relative; }
.wm-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--wmc-row); flex-wrap: wrap; }
.wm-menu { display: none !important; }
.wm-search { flex: 1; min-width: 160px; position: relative; max-width: 640px; }
.wm-search input { width: 100%; border-radius: 24px; padding: 9px 16px 9px 40px; background: var(--wmc-gm-bar); border: 1px solid transparent; }
.wm-search input:focus { background: var(--wmc-input); outline: 0; border-color: var(--wmc-accent); }
.wm-search svg { position: absolute; left: 13px; top: 9px; color: var(--wmc-muted); }
.wm-tools { display: flex; align-items: center; gap: 2px; padding: 4px 10px; border-bottom: 1px solid var(--wmc-row); flex-wrap: wrap; min-height: 46px; }
.wm-tools .sp { flex: 1; }
.wm-tools .pg { color: var(--wmc-muted); font-size: 12.5px; margin: 0 6px; white-space: nowrap; }
.wm-tools input[type=checkbox], .wm-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--wmc-accent); margin: 0 10px; cursor: pointer; }
.wm-chips { display: flex; gap: 6px; padding: 8px 14px 0; }
.wm-chips button { background: transparent; color: var(--wmc-nav); border: 1px solid var(--wmc-border2); border-radius: 99px; padding: 3px 13px; font-size: 13px; cursor: pointer; }
.wm-chips button.on { background: var(--wmc-accent-soft); border-color: var(--wmc-accent); color: var(--wmc-heading); font-weight: 600; }
.wm-banner { margin: 8px 14px 0; padding: 8px 12px; border-radius: 8px; background: var(--wmc-warn-bg); color: var(--wmc-warn-fg); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.wm-banner button { background: transparent; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.wm-banner.err { background: var(--wmc-bad-bg); color: var(--wmc-bad-fg); }

.wm-list { flex: 1; overflow-y: auto; min-height: 0; }
.wm-row { display: flex; align-items: center; gap: 4px; padding: 0 14px 0 4px; min-height: 44px; border-bottom: 1px solid var(--wmc-row); cursor: pointer; font-size: 14px; position: relative; }
.wm-row:hover { box-shadow: inset 1px 0 0 var(--wmc-accent), 0 1px 4px rgba(0, 0, 0, .18); z-index: 1; }
.wm-row.unread { background: var(--wmc-card); font-weight: 700; color: var(--wmc-heading); }
.wm-row:not(.unread) { background: var(--wmc-bg); color: var(--wmc-muted); }
.wm-row.sel { background: var(--wmc-accent-soft) !important; }
.wm-row .star { width: 28px; height: 28px; border: 0; background: transparent; color: var(--wmc-border2); cursor: pointer; padding: 0; font-size: 18px; line-height: 1; }
.wm-row .star.on { color: #f5b301; }
.wm-row .fr { width: 190px; flex: 0 0 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 4px; }
.wm-row .su { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-row .su b { color: var(--wmc-heading); }
.wm-row .su span { color: var(--wmc-muted); font-weight: 400; }
.wm-row .att { color: var(--wmc-muted); display: inline-flex; margin-left: 6px; }
.wm-row .dt { margin-left: 10px; font-size: 12.5px; white-space: nowrap; min-width: 56px; text-align: right; }
.wm-row .acts { display: none; gap: 0; position: absolute; right: 10px; background: inherit; }
.wm-row:hover .acts { display: flex; }
.wm-row:hover .dt { visibility: hidden; }
.wm-row.unread .dt { color: var(--wmc-heading); }
.wm-empty { padding: 60px 20px; text-align: center; color: var(--wmc-muted); }
.wm-skel { height: 44px; border-bottom: 1px solid var(--wmc-row); background: linear-gradient(90deg, transparent, var(--wmc-gm-bar), transparent); background-size: 200% 100%; animation: wmsk 1.2s infinite; opacity: .5; }
@keyframes wmsk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- message view ---- */
.wm-msg { flex: 1; overflow-y: auto; min-height: 0; padding: 0 0 24px; }
.wm-msg .sub { display: flex; gap: 12px; align-items: flex-start; padding: 16px 24px 4px; }
.wm-msg h2 { font-size: 21px; font-weight: 500; margin: 0; flex: 1; color: var(--wmc-heading); word-break: break-word; }
.wm-msg .lbl { font-size: 11px; background: var(--wmc-chip-bg); color: var(--wmc-chip-fg); border-radius: 4px; padding: 2px 7px; align-self: center; white-space: nowrap; }
.wm-head { display: flex; gap: 12px; padding: 12px 24px 6px; align-items: flex-start; }
.wm-head .av { width: 40px; height: 40px; border-radius: 50%; background: var(--wmc-accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex: 0 0 40px; }
.wm-head .who { flex: 1; min-width: 0; }
.wm-head .nm { font-weight: 700; color: var(--wmc-heading); }
.wm-head .nm small { font-weight: 400; color: var(--wmc-muted); }
.wm-head .tome { color: var(--wmc-muted); font-size: 13px; cursor: pointer; }
.wm-head .tome:hover { color: var(--wmc-heading); }
.wm-head .when { color: var(--wmc-muted); font-size: 12.5px; white-space: nowrap; }
.wm-det { margin: 2px 24px 8px 76px; padding: 10px 14px; border: 1px solid var(--wmc-border); border-radius: 10px; background: var(--wmc-input); font-size: 13px; display: none; }
.wm-det.on { display: block; }
.wm-det table { background: transparent; width: auto; }
.wm-det td { border: 0; padding: 2px 10px 2px 0; vertical-align: top; }
.wm-det td:first-child { color: var(--wmc-muted); text-align: right; white-space: nowrap; }
.wm-det pre { max-height: 220px; overflow: auto; font-size: 11.5px; white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; padding: 8px; background: var(--wmc-bg); border-radius: 6px; }
.wm-det button.lnk { background: none; border: 0; color: var(--wmc-link); cursor: pointer; padding: 0; text-decoration: underline; }
.wm-frame { margin: 0 24px 0 76px; }
.wm-frame iframe { width: 100%; border: 0; background: #fff; border-radius: 8px; min-height: 120px; display: block; }
.wm-files { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 24px 0 76px; }
.wm-file { width: 200px; border: 1px solid var(--wmc-border2); border-radius: 10px; overflow: hidden; background: var(--wmc-input); font-size: 12.5px; }
.wm-file .th { height: 84px; background: var(--wmc-gm-bar); display: grid; place-items: center; color: var(--wmc-muted); font-weight: 700; font-size: 18px; background-size: cover; background-position: center; }
.wm-file .in { padding: 7px 10px; }
.wm-file .in b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--wmc-heading); }
.wm-file .in span { color: var(--wmc-muted); }
.wm-file .ac { display: flex; border-top: 1px solid var(--wmc-row); }
.wm-file .ac a { flex: 1; text-align: center; padding: 6px; text-decoration: none; font-size: 12.5px; }
.wm-file .ac a:hover { background: var(--wmc-gm-hover); }
.wm-reply-bar { display: flex; gap: 10px; margin: 20px 24px 0 76px; flex-wrap: wrap; }
.wm-reply-bar button { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--wmc-nav); border: 1px solid var(--wmc-border2); border-radius: 20px; padding: 9px 20px; cursor: pointer; font-size: 14px; }
.wm-reply-bar button:hover { background: var(--wmc-gm-hover); }
.wm-inline { margin: 16px 24px 0 76px; }

/* ---- composer (floating window + inline reply) ---- */
.wm-cmp { display: flex; flex-direction: column; background: var(--wmc-card); border: 1px solid var(--wmc-border2); border-radius: 12px; overflow: hidden; box-shadow: var(--wmc-shadow); }
.wm-cmp.float { position: fixed; right: 24px; bottom: 0; width: min(560px, calc(100vw - 16px)); max-height: 82vh; border-radius: 12px 12px 0 0; z-index: 60; }
.wm-cmp.float.max { right: 5vw; left: 5vw; width: auto; bottom: 4vh; top: 4vh; max-height: none; border-radius: 12px; z-index: 200; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35), var(--wmc-shadow); }
.wm-cmp.float.min .wm-cb, .wm-cmp.float.min .wm-cf { display: none; }
.wm-cmp.inline { box-shadow: none; }
.wm-ch { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; background: var(--wmc-gm-bar); font-weight: 600; font-size: 14px; color: var(--wmc-heading); cursor: default; }
.wm-ch .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-cmp.inline .wm-ch { background: transparent; }
.wm-cb { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; flex: 1; }
.wm-fld { display: flex; align-items: center; gap: 8px; padding: 2px 16px; border-bottom: 1px solid var(--wmc-row); min-height: 38px; }
.wm-fld > span { color: var(--wmc-muted); font-size: 13.5px; min-width: 52px; }
.wm-fld input, .wm-fld select { border: 0 !important; background: transparent !important; padding: 7px 0; flex: 1; min-width: 0; outline: 0 !important; color: var(--wmc-text); }
.wm-fld select option { background: var(--wmc-card); }
.wm-fld .cc { color: var(--wmc-muted); font-size: 13px; cursor: pointer; background: none; border: 0; padding: 0 3px; }
.wm-fld .cc:hover { color: var(--wmc-heading); text-decoration: underline; }
.wm-ed { min-height: 220px; padding: 14px 16px; outline: 0; font: 14.5px/1.6 Arial, Helvetica, sans-serif; background: #fff; color: #222; overflow: auto; flex: 1; word-wrap: break-word; }
.wm-cmp.float .wm-ed { max-height: 42vh; }
.wm-cmp.float.max .wm-ed { max-height: none; }
.wm-ed:empty::before { content: attr(data-ph); color: #8a94a6; }
.wm-ed blockquote { margin: 0 0 0 .8ex; padding-left: 1ex; border-left: 2px solid #ccc; color: #555; }
.wm-ed a { color: #1a0dab; }
.wm-ed img { max-width: 100%; height: auto; }
#wm .av.img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; padding: 0; border: 0; display: inline-block; vertical-align: middle; background: #e8eaed; }
.wm-side .av.img { width: 28px; height: 28px; }
.wm-th-h .av.img { width: 36px; height: 36px; }
/* Preserve email-template design (tables, fixed layouts) the same way as Templates page */
.wm-ed table { border-collapse: collapse; max-width: 100% !important; }
.wm-ed td, .wm-ed th { word-break: break-word; }
.wm-ed [style*="width"] { max-width: 100%; }
.wm-ed center { display: block; }
.wm-ed > table { margin: 0 auto; }
.wm-atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
.wm-atts:empty { display: none; }
.wm-att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--wmc-border2); border-radius: 18px; padding: 4px 6px 4px 12px; font-size: 12.5px; background: var(--wmc-input); max-width: 260px; position: relative; overflow: hidden; }
.wm-att b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--wmc-heading); }
.wm-att span { color: var(--wmc-muted); }
.wm-att button { border: 0; background: transparent; color: var(--wmc-muted); cursor: pointer; padding: 0 4px; font-size: 16px; line-height: 1; }
.wm-att i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--wmc-accent); width: 0; transition: width .15s; }
.wm-att.err { border-color: var(--wmc-bad); color: var(--wmc-bad-fg); }
.wm-fmt { display: none; gap: 2px; padding: 4px 12px; border-top: 1px solid var(--wmc-row); flex-wrap: wrap; align-items: center; background: var(--wmc-input); }
.wm-fmt.on { display: flex; }
.wm-fmt button { background: transparent; border: 0; color: var(--wmc-text); border-radius: 6px; min-width: 30px; height: 30px; cursor: pointer; font-size: 14px; padding: 0 6px; }
.wm-fmt button:hover { background: var(--wmc-gm-hover); }
.wm-fmt select { width: auto; padding: 3px 6px; border-radius: 6px; font-size: 13px; }
.wm-fmt input[type=color] { width: 30px; height: 28px; padding: 0; border: 0; background: none; }
.wm-cf { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-top: 1px solid var(--wmc-row); }
.wm-send { background: var(--wmc-gm-send) !important; color: #fff !important; border: 0; border-radius: 20px !important; padding: 9px 26px !important; font-weight: 600; cursor: pointer; font-size: 14.5px; margin-right: 8px !important; }
.wm-send:disabled { opacity: .6; cursor: wait; }
.wm-cmp .drop { position: absolute; inset: 0; background: var(--wmc-overlay); color: #fff; display: none; place-items: center; font-size: 18px; z-index: 5; border: 2px dashed #fff; border-radius: 12px; }
.wm-cmp.dragging .drop { display: grid; }
.wm-cmp { position: relative; }
.wm-cmp.float { position: fixed; }

/* ---- menus / toast ---- */
.wm-menu-pop { position: fixed; z-index: 80; background: var(--wmc-card); border: 1px solid var(--wmc-border2); border-radius: 10px; box-shadow: var(--wmc-shadow); padding: 6px 0; min-width: 190px; max-height: 60vh; overflow: auto; }
.wm-menu-pop div { padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--wmc-text); white-space: nowrap; }
.wm-menu-pop div:hover { background: var(--wmc-gm-hover); }
.wm-menu-pop hr { border: 0; border-top: 1px solid var(--wmc-row); margin: 4px 0; }
.wm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #202124; color: #fff; padding: 11px 20px; border-radius: 8px; z-index: 90; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); max-width: 90vw; }
.wm-toast.err { background: #8c1d18; }
.wm-notif { position: fixed; top: 16px; right: 16px; z-index: 90; width: 320px; max-width: calc(100vw - 32px); background: var(--wmc-card); color: var(--wmc-text); border: 1px solid var(--wmc-border2); border-left: 4px solid var(--wmc-accent); border-radius: 10px; box-shadow: var(--wmc-shadow); padding: 12px 14px; cursor: pointer; font-size: 13.5px; }
.wm-notif b { color: var(--wmc-heading); display: block; }
.wm-notif div { color: var(--wmc-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- phone ---- */
@media (max-width: 860px) {
  #wm { grid-template-columns: 1fr; height: calc(100vh - 52px - env(safe-area-inset-top, 0px)); height: calc(100dvh - 52px - env(safe-area-inset-top, 0px)); }
  .wm-side { position: absolute; inset: 0 auto 0 0; width: 300px; max-width: 86%; z-index: 40; transform: translateX(-102%); transition: transform .2s; box-shadow: 8px 0 30px rgba(0, 0, 0, .35); }
  #wm.drawer .wm-side { transform: none; }
  .wm-main { margin: 0; border-radius: 0; border: 0; }
  .wm-menu { display: inline-flex !important; }
  .wm-row { flex-wrap: wrap; padding: 8px 10px 8px 4px; }
  .wm-row .fr { width: auto; flex: 1; flex-basis: 50%; }
  .wm-row .dt { visibility: visible !important; }
  .wm-row .su { flex-basis: 100%; padding-left: 72px; order: 5; }
  .wm-row .acts { display: none !important; }
  .wm-msg .sub, .wm-head { padding-left: 14px; padding-right: 14px; }
  .wm-det, .wm-frame, .wm-files, .wm-reply-bar, .wm-inline { margin-left: 14px; margin-right: 14px; }
  .wm-cmp.float { right: 0; left: 0; width: auto; top: 0; bottom: 0; max-height: none; border-radius: 0; }
  .wm-cmp.float .wm-ed { max-height: none; }
  .wm-tools { padding: 4px; }
}

/* ---- composer: Gmail-style formatting bar + template / emoji pickers ---- */
.wm-cmp .ibtn { box-shadow: none; filter: none; }
.wm-cmp .wm-fmt { border-radius: 24px; margin: 4px 12px 0; padding: 3px 8px; gap: 1px; background: var(--wmc-gm-bar); border: 0; }
.wm-cmp .wm-fmt .ibtn.fb { width: 30px; height: 30px; border-radius: 6px; font-size: 14px; color: var(--wmc-text); }
.wm-cmp .wm-fmt .ibtn.fb:hover { background: var(--wmc-gm-hover); }
.wm-cmp .wm-fmt svg.i { width: 16px; height: 16px; flex-basis: 16px; }
.wm-cmp .wm-fmt .sep { width: 1px; height: 18px; background: var(--wmc-border2); margin: 0 4px; }
.wm-cmp .wm-fmt select { background: transparent; border: 0; color: var(--wmc-text); height: 30px; padding: 0 4px; cursor: pointer; }
.wm-cmp .wm-fmt .colr { position: relative; overflow: hidden; }
.wm-cmp .wm-fmt .colr span { font-weight: 700; border-bottom: 3px solid currentColor; line-height: 1; padding: 0 1px; }
.wm-cmp .wm-fmt .colr input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.wm-menu-pop.emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; min-width: 0; width: 300px; }
.wm-menu-pop.emoji .em { padding: 4px; text-align: center; font-size: 20px; cursor: pointer; border-radius: 6px; }
.wm-menu-pop.emoji .em:hover { background: var(--wmc-gm-hover); }
.wm-menu-pop.tpl { width: 340px; }
.wm-menu-pop.tpl .ti { display: flex; flex-direction: column; gap: 2px; }
.wm-menu-pop.tpl .ti:hover { background: var(--wmc-gm-hover); }
.wm-menu-pop.tpl .ti small { color: var(--wmc-muted); overflow: hidden; text-overflow: ellipsis; }
.wm-menu-pop .muted { color: var(--wmc-muted); cursor: default; white-space: normal; }

/* ---- conversation under an opened message ---- */
.wm-thread { margin: 18px 24px 0 76px; }
.wm-th-title { font-size: 12.5px; color: var(--wmc-muted); margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.wm-th { border: 1px solid var(--wmc-border2); border-radius: 12px; margin-bottom: 8px; background: var(--wmc-card); cursor: pointer; overflow: hidden; }
.wm-th:hover { background: var(--wmc-gm-hover); }
.wm-th-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.wm-th .av { width: 30px; height: 30px; border-radius: 50%; background: #64748b; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 30px; }
.wm-th .av.me { background: var(--wmc-accent); }
.wm-th .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--wmc-heading); }
.wm-th .who small { color: var(--wmc-muted); font-size: 12.5px; }
.wm-th .lbl { font-size: 11px; background: var(--wmc-chip-bg); color: var(--wmc-chip-fg); border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.wm-th .when { color: var(--wmc-muted); font-size: 12.5px; white-space: nowrap; }
.wm-th-b { padding: 0 12px 12px 52px; cursor: default; }
.wm-th-b iframe { width: 100%; border: 0; background: #fff; border-radius: 8px; min-height: 80px; display: block; }
@media (max-width: 800px) { .wm-thread { margin-left: 14px; margin-right: 14px; } .wm-th-b { padding-left: 12px; } .wm-th .when { display: none; } }

.wm-menu-pop.img { width: 330px; }
.wm-menu-pop .ti-h { padding: 8px 16px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--wmc-muted); cursor: default; }
.wm-menu-pop .imgs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 12px 10px; max-height: 190px; overflow: auto; }
.wm-menu-pop .imgs .th { aspect-ratio: 1; border-radius: 8px; background-size: cover; background-position: center; border: 1px solid var(--wmc-border2); cursor: pointer; }
.wm-menu-pop .imgs .th:hover { outline: 2px solid var(--wmc-accent); }
.wm-menu-pop .imgs .muted { grid-column: 1 / -1; padding: 6px 4px; }
.wm-menu-pop .ti { display: flex; flex-direction: column; gap: 2px; white-space: normal; }
.wm-menu-pop .ti:hover { background: var(--wmc-gm-hover); }
.wm-menu-pop .ti small { color: var(--wmc-muted); }

/* ---- Gmail-style conversation cards + trimmed quote button ---- */
.wm-row .fr .ct { color: var(--wmc-muted); font-size: 12px; font-weight: 400; margin-left: 4px; }
.wm-thread { margin: 6px 24px 0 24px; }
.wm-th { cursor: pointer; }
.wm-th.open { cursor: default; }
.wm-th-h { cursor: pointer; align-items: flex-start; }
.wm-th.open > .wm-th-h { cursor: pointer; }
.wm-th .av { width: 40px; height: 40px; flex-basis: 40px; font-size: 16px; }
.wm-th .who .tome { color: var(--wmc-muted); font-size: 13px; font-weight: 400; white-space: normal; }
.wm-th .who { white-space: normal; }
.wm-th-b { padding: 0 16px 14px 66px; }
.wm-th-b .wm-frame { margin: 0; }
.wm-th-b .wm-det { margin: 0 0 8px; }
.wm-th-b .wm-files { margin: 8px 0 0; }
@media (max-width: 800px) { .wm-thread { margin-left: 14px; margin-right: 14px; } .wm-th-b { padding-left: 14px; } }
.wm-qwrap { padding: 2px 16px 10px; }
.wm-qwrap .wm-qt, .wm-cmp .wm-qt { display: inline-block; margin: 0; padding: 0 9px; height: 16px; line-height: 10px; background: var(--wmc-gm-bar); color: var(--wmc-muted); border: 0; border-radius: 8px; font-size: 13px; letter-spacing: 1px; cursor: pointer; }
.wm-qwrap .wm-qt:hover { background: var(--wmc-gm-hover); color: var(--wmc-heading); }

/* ---- pictures inside the compose editor ---- */
.wm-ed img { cursor: pointer; border-radius: 4px; }
.wm-ed img.wm-img-sel { outline: 3px solid var(--wmc-accent); outline-offset: 2px; }
.wm-imgbar { position: fixed; z-index: 95; display: flex; align-items: center; gap: 2px; background: #1f2937; color: #fff; border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.wm-imgbar button { margin: 0; background: transparent; color: #fff; border: 0; border-radius: 7px; padding: 6px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.wm-imgbar button:hover { background: rgba(255,255,255,.16); filter: none; }
.wm-imgbar button.del { color: #fca5a5; }
.wm-imgbar .sep { width: 1px; height: 18px; background: rgba(255,255,255,.25); margin: 0 3px; }
.wm-lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.82); display: grid; place-items: center; cursor: zoom-out; }
.wm-lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 6px; background: #fff; }
.wm-lightbox .x { position: absolute; top: 14px; right: 18px; margin: 0; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }

/* signature editor (Email Accounts page) */
.ma-sig-tb{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.ma-sig-ed{min-height:170px;max-height:340px;overflow:auto;border:1px solid var(--border,#d0d7de);border-radius:8px;padding:12px 14px;background:var(--bg-card,#fff);color:var(--text,#222);font:14px/1.55 Arial,Helvetica,sans-serif;outline:none}
.ma-sig-ed:focus{border-color:var(--primary,#2563eb)}
.ma-sig-ed:empty:before{content:attr(data-ph);color:#8a94a3}
.ma-sig-ed a,.wm-sig a{color:#1a56db;text-decoration:underline}
.ma-sig-ed img,.wm-sig img{max-width:100%;height:auto}
