/* ---------------------------------------------------------------------
   Page-specific styling: auth pages, landing, project inbox + reader,
   sending-domain cards, plans, deliverability, message rows.
   --------------------------------------------------------------------- */

/* ===== Auth pages (Login, Signup, ChangePassword, 2FA setup, AcceptInvite, VerifyEmail) ===== */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
    min-height: 100vh;
    background: var(--mw-bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    border-radius: 14px;
    background: var(--mw-surface);
    border: 1px solid var(--mw-border);
    box-shadow: var(--mw-shadow), 0 20px 40px -24px rgba(16, 24, 40, .18);
}

.auth-card.wide {
    max-width: 520px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--mw-primary-text);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -.02em;
}

.auth-brand:hover {
    text-decoration: none;
}

.auth-card h1 {
    margin: 8px 0 20px;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-switch {
    margin: 20px 0 0;
    font-size: 13.5px;
    color: var(--mw-muted);
    text-align: center;
}

.auth-switch a {
    font-weight: 500;
}

.account-type-fieldset {
    margin: 16px 0 0;
    padding: 0;
    border: none;
}

.account-type-fieldset legend {
    font-size: 13px;
    font-weight: 500;
    color: var(--mw-text-2);
    padding: 0;
}

.account-type-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
}

.account-type-option input {
    accent-color: var(--mw-primary);
}

.org-name-row {
    display: none;
}

/* :has() rather than a sibling combinator — DOM order of the fieldset shouldn't matter. The
   "_model.AccountType" name matches [SupplyParameterFromForm]'s binding convention (see
   Signup.razor) — don't shorten it back to "AccountType" without also fixing the binding. */
.auth-form:has(input[name="_model.AccountType"][value="Organisation"]:checked) .org-name-row {
    display: block;
}

/* ===== Landing page (Home.razor) ===== */
.pub-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--mw-glass);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--mw-border);
}

.pub-header .in {
    max-width: 1160px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
}

.pub-header .brand {
    padding: 0;
}

.pub-header nav {
    display: flex;
    gap: 24px;
    flex: 1;
    margin-left: 12px;
}

.pub-header nav a {
    color: var(--mw-text-2);
    font-weight: 500;
    font-size: 14px;
}

.pub-header nav .soon {
    color: var(--mw-disabled);
    font-weight: 500;
    font-size: 14px;
}

.pub-header nav .soon em {
    font-style: normal;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    border: 1px solid var(--mw-border);
    border-radius: 999px;
    padding: 1px 6px;
    margin-left: 6px;
}

.hero {
    background: linear-gradient(180deg, var(--mw-surface) 0%, var(--mw-bg) 100%);
    border-bottom: 1px solid var(--mw-border);
}

.hero .in {
    max-width: 1160px;
    margin: 0 auto;
    padding: 72px 24px 80px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 56px;
    align-items: center;
}

.hero h1 {
    font-size: 46px;
    line-height: 1.08;
    letter-spacing: -.03em;
    font-weight: 700;
    margin: 14px 0 16px;
}

.hero p.lede {
    font-size: 17px;
    color: var(--mw-text-2);
    max-width: 46ch;
    margin-bottom: 26px;
}

.hero .cta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.showcase {
    background: var(--mw-surface);
    border: 1px solid var(--mw-border);
    border-radius: 14px;
    box-shadow: 0 30px 60px -32px rgba(16, 24, 40, .35);
    overflow: hidden;
}

.showcase .bar {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--mw-border);
    background: var(--mw-surface-2);
}

.showcase .bar i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--mw-border-strong);
}

.showcase .bar span {
    margin-left: 8px;
    font: 12px var(--mw-mono);
    color: var(--mw-muted);
}

.showcase .row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--mw-border);
}

.showcase .row:last-child {
    border-bottom: none;
}

.showcase .row .top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    color: var(--mw-muted);
}

.showcase .row .top b {
    color: var(--mw-text);
    font-weight: 600;
    font-size: 13px;
}

.showcase .row .subj {
    font-weight: 500;
    margin: 2px 0;
}

.showcase .row .snip {
    color: var(--mw-muted);
    font-size: 12.5px;
}

.feat {
    max-width: 1160px;
    margin: 0 auto;
    padding: 64px 24px;
}

.feat h2 {
    font-size: 30px;
    letter-spacing: -.02em;
    font-weight: 700;
    max-width: 26ch;
    margin-bottom: 28px;
}

.feat .card {
    padding: 22px;
}

.feat .card h3 {
    font-size: 15px;
    margin: 12px 0 6px;
    font-weight: 600;
}

.feat .card p {
    color: var(--mw-text-2);
    font-size: 13.5px;
    margin: 0;
}

.ficon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--mw-primary-soft);
    color: var(--mw-primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pricing-band {
    border-top: 1px solid var(--mw-border);
    background: var(--mw-surface);
    text-align: center;
    padding: 56px 24px;
}

.pricing-band h2 {
    font-size: 26px;
    letter-spacing: -.02em;
    margin-bottom: 10px;
}

.pricing-band p {
    color: var(--mw-text-2);
    max-width: 52ch;
    margin: 0 auto 22px;
}

.cta-band {
    background: #0F1B33;
    color: #fff;
    text-align: center;
    padding: 64px 24px;
}

.cta-band h2 {
    color: #fff;
    font-size: 30px;
    letter-spacing: -.02em;
    margin-bottom: 10px;
}

.cta-band p {
    color: #A9B6D0;
    margin: 0 auto 24px;
    max-width: 55ch;
}

.pub-foot {
    background: var(--mw-surface);
    border-top: 1px solid var(--mw-border);
}

.pub-foot .in {
    max-width: 1160px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.pub-foot .brand-blurb p {
    color: var(--mw-muted);
    font-size: 13.5px;
    margin: 8px 0 0;
}

.pub-foot .cols {
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
}

.pub-foot .cols h4 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--mw-disabled);
    margin-bottom: 10px;
}

.pub-foot .cols a,
.pub-foot .cols .soon {
    display: block;
    color: var(--mw-text-2);
    font-size: 13.5px;
    margin-bottom: 6px;
}

.pub-foot .cols .soon {
    color: var(--mw-disabled);
}

.pub-foot .copy {
    border-top: 1px solid var(--mw-border);
    padding: 16px 24px;
    text-align: center;
    color: var(--mw-muted);
    font-size: 13px;
}

/* ===== Legal pages (Components/Shared/LegalPage.razor) ===== */
.legal { background: var(--mw-bg); }
.legal-in { max-width: 820px; margin: 0 auto; padding: 32px 24px 64px; color: var(--mw-text-2); line-height: 1.65; font-size: 15px; }
.legal-in h1 { font-size: 32px; line-height: 1.2; margin: 8px 0 4px; color: var(--mw-text); }
.legal-in h2 { font-size: 18px; margin: 32px 0 8px; color: var(--mw-text); }
.legal-in p, .legal-in ul { margin: 0 0 12px; }
.legal-in ul { padding-left: 22px; }
.legal-in li { margin-bottom: 6px; }
.legal-in a { color: var(--mw-primary-text); text-decoration: underline; }
.legal-in code { font-family: 'JetBrains Mono', monospace; font-size: 13px; background: var(--mw-surface-2); padding: 1px 5px; border-radius: 4px; }
.legal-meta { color: var(--mw-muted); font-size: 13.5px; margin-bottom: 24px; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-bottom: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--mw-border); font-size: 13.5px; }
.legal-nav a { color: var(--mw-muted); text-decoration: none; }
.legal-nav a:hover { color: var(--mw-text); }
.legal-nav a.on { color: var(--mw-text); font-weight: 600; }
.legal-draft { background: var(--mw-warning-soft); border: 1px solid var(--mw-warn-border); color: var(--mw-warn-ink); border-radius: var(--mw-radius); padding: 10px 14px; font-size: 13.5px; }
.legal-table { width: 100%; border-collapse: collapse; margin: 4px 0 16px; font-size: 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--mw-border); }
.legal-table thead th { background: var(--mw-surface-2); color: var(--mw-text); }
.legal-table tbody th { background: var(--mw-surface); color: var(--mw-text); width: 30%; }
/* Public documentation pages (PublicDocPage.razor) reuse the legal typography and add code blocks and a contents strip. */
.doc-in { max-width: 920px; }
.doc-lede { font-size: 17px; color: var(--mw-text-2); margin-bottom: 20px; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; margin-bottom: 8px; background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: var(--mw-radius); font-size: 13.5px; }
.doc-toc a { text-decoration: none; }
.legal-in h3 { font-size: 15px; margin: 22px 0 6px; color: var(--mw-text); }
.legal-in ol { padding-left: 22px; margin: 0 0 12px; }
.legal-in pre { background: var(--mw-surface-2); border: 1px solid var(--mw-border); border-radius: var(--mw-radius); padding: 12px 14px; overflow-x: auto; margin: 8px 0 16px; line-height: 1.5; }
.legal-in pre code { background: none; padding: 0; font-size: 12.5px; white-space: pre; }
@media (max-width: 640px) {
    .legal-in { padding: 24px 16px 48px; }
    .legal-in h1 { font-size: 26px; }
    .legal-table { display: block; overflow-x: auto; }
}

/* ===== Project page: mailbox rail + inbox/reader ===== */
.split {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.rail {
    padding: 8px;
}

.rail-title {
    padding: 8px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--mw-disabled);
}

.rail .mb {
    all: unset;
    box-sizing: border-box;
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: var(--mw-radius-sm);
    cursor: pointer;
}

.rail .mb:hover {
    background: var(--mw-hover-soft);
}

.rail .mb[aria-current="true"] {
    background: var(--mw-primary-soft);
}

.rail .mb[aria-current="true"] b {
    color: var(--mw-primary-text);
}

.rail .mb b {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
}

.rail .mb small {
    color: var(--mw-muted);
    font-size: 12px;
}

.rail .mb .n {
    font-size: 12px;
    font-weight: 600;
    color: var(--mw-text-2);
    background: var(--mw-track);
    border-radius: 999px;
    padding: 1px 8px;
}

.rail-add {
    padding: 8px 10px 4px;
}

.card.clip {
    overflow: hidden;
}

.mail {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    min-height: 560px;
}

.mail-list {
    border-right: 1px solid var(--mw-border);
    max-height: 680px;
    overflow: auto;
}

.mail-item {
    all: unset;
    box-sizing: border-box;
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-bottom: 1px solid var(--mw-border);
    cursor: pointer;
}

.mail-item:hover {
    background: var(--mw-hover-soft);
}

.mail-item[aria-current="true"] {
    background: var(--mw-primary-soft);
    box-shadow: inset 3px 0 0 var(--mw-primary);
}

.mail-item .top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    color: var(--mw-muted);
}

.mail-item .top b {
    color: var(--mw-text);
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-item .subj {
    font-weight: 500;
    margin: 2px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-item .snip {
    color: var(--mw-muted);
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.reader-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    color: var(--mw-muted);
    padding: 24px;
    text-align: center;
}

.reader-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--mw-border);
}

.reader-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.reader-head h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.reader-title .btn {
    flex-shrink: 0;
}

/* Count on the left, bulk action on the right, between the retention notice and the message list. */
.mail-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 20px;
    border-bottom: 1px solid var(--mw-border);
    color: var(--mw-muted);
    font-size: 13px;
}

.sender {
    display: flex;
    gap: 12px;
    align-items: center;
}

.avatar,
.message-sender-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.sender .who {
    flex: 1;
    min-width: 0;
}

.sender .who b {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sender .who span {
    color: var(--mw-muted);
    font-size: 12.5px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sender time {
    color: var(--mw-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.reader-body {
    padding: 16px 20px 20px;
    background: var(--mw-surface-2);
    flex: 1;
}

.message-images-blocked-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--mw-surface);
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    padding: 8px 12px;
    font-size: 12.5px;
    color: var(--mw-muted);
    margin-bottom: 12px;
}

.message-images-blocked-bar span {
    flex: 1;
}

.message-html-frame {
    width: 100%;
    min-height: 320px;
    /* JS (mailWarrenObserveIframeResize) sets an inline height once the real content is
       measured — this min-height only ever shows before that first measurement lands. */
    transition: height .15s ease;
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    background: #fff;
}

.message-text-body,
.message-raw {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font: 12.5px/1.6 var(--mw-mono);
    background: var(--mw-surface);
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    padding: 14px;
    color: var(--mw-text-2);
    max-height: 420px;
    overflow: auto;
}

.message-attachments-heading {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mw-text-2);
}

.message-attachments-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.message-attachments-list a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--mw-border);
    background: var(--mw-surface);
    border-radius: var(--mw-radius-sm);
    padding: 6px 10px;
    font-size: 13px;
}

/* ===== Sending domains ===== */
details.domain > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 16px 20px;
}

details.domain > summary::-webkit-details-marker {
    display: none;
}

details.domain > summary .name {
    font-weight: 600;
    font-size: 15px;
    overflow-wrap: anywhere;
}

details.domain > summary .spacer {
    flex: 1;
}

details.domain > summary .caret {
    width: 8px;
    height: 8px;
    border-right: 1.6px solid var(--mw-muted);
    border-bottom: 1.6px solid var(--mw-muted);
    transform: rotate(-45deg);
    transition: transform .15s;
}

details.domain[open] > summary .caret {
    transform: rotate(45deg);
}

details.domain[open] > summary {
    border-bottom: 1px solid var(--mw-border);
}

.domain-body {
    padding: 4px 20px 20px;
}

.domain-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--mw-border);
    margin: 0 -20px 4px;
}

.domain-stats > div {
    padding: 14px 20px;
    border-right: 1px solid var(--mw-border);
}

.domain-stats > div:last-child {
    border-right: none;
}

.domain-stats .v {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.domain-stats .l {
    font-size: 12.5px;
    color: var(--mw-muted);
}

.section-title {
    padding: 16px 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mw-text-2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* ===== Plans (Account) ===== */
.plans-grid,
.plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.plan-card {
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--mw-surface);
}

.plan-card-current {
    border-color: var(--mw-primary);
    box-shadow: 0 0 0 1px var(--mw-primary) inset;
    background: linear-gradient(var(--mw-surface), var(--mw-primary-soft));
}

.plan-name {
    font-weight: 600;
    font-size: 15px;
}

.plan-price {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.plan-price-period {
    font-size: 13px;
    font-weight: 400;
    color: var(--mw-muted);
}

.plan-features {
    list-style: none;
    margin: 4px 0 8px;
    padding: 0;
    flex: 1;
    font-size: 13px;
    color: var(--mw-text-2);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-features li {
    padding-left: 20px;
    position: relative;
}

.plan-features li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 5px;
    width: 5px;
    height: 9px;
    border-right: 2px solid var(--mw-success);
    border-bottom: 2px solid var(--mw-success);
    transform: rotate(40deg);
}

.plan-cta-chip {
    align-self: flex-start;
}

/* ===== Dashboard ===== */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 1180px) {
    .mail {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    /* mailbox rail collapses to a horizontal strip so the inbox keeps its width */
    .split {
        grid-template-columns: 1fr;
    }

    .rail {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding: 8px;
    }

    .rail-title,
    .rail-add {
        display: none;
    }

    .rail .mb {
        width: auto;
        flex-shrink: 0;
        border: 1px solid var(--mw-border);
    }
}

@media (max-width: 1000px) {
    .mail {
        grid-template-columns: 1fr;
    }

    .mail-list {
        border-right: none;
        border-bottom: 1px solid var(--mw-border);
        max-height: 260px;
    }
}

@media (max-width: 900px) {
    .hero .in {
        grid-template-columns: 1fr;
        padding-top: 48px;
        gap: 36px;
    }

    .hero h1 {
        font-size: 34px;
    }

    .pub-header nav {
        display: none;
    }

    .domain-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .domain-stats > div:nth-child(2) {
        border-right: none;
    }

    .domain-stats > div:nth-child(-n+2) {
        border-bottom: 1px solid var(--mw-border);
    }
}

/* ===== Sending domains: expandable domain card (state-driven, see SendingDomains.razor) ===== */
.domain-card {
    background: var(--mw-surface);
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius);
    box-shadow: var(--mw-shadow);
    padding: 12px 16px;
    margin-bottom: 12px;
}

.domain-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    cursor: pointer;
}

.domain-head strong {
    font-size: 15px;
    overflow-wrap: anywhere;
}

/* ===== Retention notice above the project inbox ===== */
.retention {
    padding: 10px 16px;
    font-size: 13px;
    color: var(--mw-muted);
    background: var(--mw-surface-2);
    border-bottom: 1px solid var(--mw-border);
}

.retention.warn {
    color: var(--mw-warn-ink);
    background: var(--mw-warning-soft);
    border-bottom-color: var(--mw-warn-border);
}

.retention a {
    text-decoration: underline;
}

.mail-item .snip .pill {
    margin-right: 6px;
    height: 18px;
    font-size: 11px;
    vertical-align: 1px;
}

.mail-item .top span {
    white-space: nowrap;
}

/* ===== Landing page pricing ===== */
.pricing-band .pricing-plans {
    max-width: 1160px;
    margin: 32px auto 0;
    text-align: left;
    gap: 16px;
}

.pricing-band .plan-card.featured {
    border-color: var(--mw-primary);
    box-shadow: 0 0 0 1px var(--mw-primary) inset;
}

.pricing-band .plan-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pricing-band .pricing-note {
    max-width: 62ch;
    margin: 28px auto 22px;
    font-size: 13.5px;
    color: var(--mw-muted);
}

/* ===== Admin > Email templates (AdminEmailTemplates.razor) ===== */
.et-muted { color: var(--mw-muted); font-size: 13px; font-weight: 400; }

/* The list of emails: one full-width button per email, description under the name, status pills on the right. */
.et-list { display: flex; flex-direction: column; }
.et-item {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--mw-border);
    cursor: pointer;
    font: 400 14px var(--mw-font);
    color: var(--mw-text);
}
.et-item:first-child { border-top: 0; }
.et-item:hover { background: var(--mw-hover-soft); }
.et-item.on { background: var(--mw-primary-soft); }
.et-item:focus-visible { box-shadow: inset 0 0 0 2px var(--mw-primary-ring); }
.et-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.et-item-main b { font-weight: 600; }
.et-item-main span { color: var(--mw-muted); font-size: 13px; line-height: 1.4; }
.et-item-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* Editor on the left, live preview on the right; stacked when the page is not wide. */
.et-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; margin: 16px 0; }
@media (max-width: 1180px) { .et-grid { grid-template-columns: minmax(0, 1fr); } }

.et-facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; margin: 0 0 16px; font-size: 13px; line-height: 1.45; }
.et-facts dt { color: var(--mw-muted); }
.et-facts dd { margin: 0; color: var(--mw-text-2); }

.et-vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0 16px; }
.et-vars-label { font-size: 12.5px; color: var(--mw-muted); margin-right: 4px; }
.et-chip {
    all: unset;
    box-sizing: border-box;
    cursor: pointer;
    padding: 2px 9px;
    border: 1px solid var(--mw-border-strong);
    border-radius: 999px;
    background: var(--mw-surface);
    font: 500 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--mw-text-2);
}
.et-chip:hover { background: var(--mw-primary-soft); border-color: var(--mw-primary); }
.et-chip:focus-visible { box-shadow: 0 0 0 3px var(--mw-primary-ring); }
.et-chip.req::after { content: " *"; color: var(--mw-danger); }

/* The HTML editor: monospace, no soft wrapping (long tags scroll sideways instead of reflowing into something unreadable). */
.et-code {
    all: unset;
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 420px;
    padding: 12px;
    border: 1px solid var(--mw-border-strong);
    border-radius: var(--mw-radius-sm);
    background: var(--mw-input-bg);
    color: var(--mw-text);
    font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre;
    overflow: auto;
    tab-size: 2;
    resize: vertical;
}
.et-code:focus { border-color: var(--mw-primary); box-shadow: 0 0 0 3px var(--mw-primary-ring); }

.et-errors { margin: 6px 0 0; padding-left: 18px; }
.et-errors li { margin: 3px 0; }
.et-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 0; }
.et-test { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--mw-border); }
.et-test > label { font-size: 13px; font-weight: 500; color: var(--mw-text-2); }

.et-subject-line { margin-bottom: 10px; font-size: 14px; }
.et-frame {
    display: block;
    width: 100%;
    height: 640px;
    border: 1px solid var(--mw-border);
    border-radius: 8px;
    background: #fff; /* an email is designed for a light page whatever the app's theme is */
}
.et-plain { margin-top: 12px; font-size: 13px; }
.et-plain summary { cursor: pointer; color: var(--mw-text-2); }
.et-plain pre { margin: 8px 0 0; padding: 12px; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--mw-border); border-radius: 8px; background: var(--mw-input-bg); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Image library. */
.et-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; padding: 16px 20px; }
.et-img { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--mw-border); border-radius: 10px; background: var(--mw-surface); }
.et-thumb { display: flex; align-items: center; justify-content: center; height: 96px; border-radius: 6px; background: var(--mw-hover-soft); overflow: hidden; }
.et-thumb img { max-width: 100%; max-height: 100%; }
.et-img-name { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.et-img-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.et-upload { padding: 16px 20px 20px; border-top: 1px solid var(--mw-border); }
.et-upload p { margin: 4px 0 10px; }
.et-grid .alert { margin-top: 14px; }

/* ===== Message reader: preview options + the Checks tab (Build 1.33) ===== */
.preview-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.preview-toolbar .seg { display: inline-flex; border: 1px solid var(--mw-border); border-radius: var(--mw-radius-sm); overflow: hidden; }
.preview-toolbar .seg button { all: unset; box-sizing: border-box; cursor: pointer; padding: 5px 12px; font-size: 12.5px; font-weight: 500; color: var(--mw-muted); background: var(--mw-surface); }
.preview-toolbar .seg button + button { border-left: 1px solid var(--mw-border); }
.preview-toolbar .seg button.on { background: var(--mw-primary-soft); color: var(--mw-primary-text); }
.preview-toolbar .seg button:focus-visible { outline: 2px solid var(--mw-primary); outline-offset: -2px; }
.preview-dark { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mw-text-2); cursor: pointer; }
.preview-note { font-size: 12.5px; color: var(--mw-text-2); background: var(--mw-surface-2); border: 1px solid var(--mw-border); border-radius: var(--mw-radius-sm); padding: 8px 12px; margin-bottom: 10px; }
.preview-frame { transition: max-width .15s ease; }
.preview-frame.mobile { max-width: 375px; margin: 0 auto; }
.preview-frame.dark .message-html-frame { background: #121212; }

.tab-badge { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.tab-badge.bad { background: var(--mw-danger-soft); color: var(--mw-bad-ink); }
.tab-badge.warn { background: var(--mw-warning-soft); color: var(--mw-warn-ink); }

.checks { display: flex; flex-direction: column; gap: 22px; }
.checks h4 { font-size: 14px; margin: 0 0 8px; color: var(--mw-text); }
.checks h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mw-muted); margin: 0 0 6px; }
.checks-state { display: flex; align-items: center; gap: 12px; padding: 24px 4px; color: var(--mw-text-2); font-size: 13.5px; }
.checks-note { font-size: 12.5px; color: var(--mw-muted); margin: 8px 0 0; line-height: 1.5; }
.checks-ok { font-size: 13.5px; color: var(--mw-success); margin: 0; }
.checks-summary { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.spam-meter { flex: 1 1 320px; }
.spam-meter-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.spam-score { margin-left: auto; font-weight: 600; font-size: 14px; }
.spam-score .muted { font-weight: 400; font-size: 12px; color: var(--mw-muted); }
.spam-bar { position: relative; height: 10px; border-radius: 5px; background: var(--mw-track); overflow: hidden; }
.spam-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.spam-bar .fill.ok { background: var(--mw-success); }
.spam-bar .fill.warn { background: var(--mw-warning); }
.spam-bar .fill.bad { background: var(--mw-danger); }
.spam-bar .mark { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--mw-text); opacity: .55; }
.spam-rules { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; color: var(--mw-text-2); }
.spam-rules li { display: flex; gap: 8px; padding: 2px 0; }
.spam-rules .pts { font-family: var(--mw-mono); color: var(--mw-warn-ink); min-width: 34px; }
.checks-counts { display: flex; gap: 10px; }
.checks-counts .count { min-width: 74px; text-align: center; padding: 8px 10px; border-radius: var(--mw-radius); border: 1px solid var(--mw-border); background: var(--mw-surface); }
.checks-counts .count b { display: block; font-size: 22px; line-height: 1.1; }
.checks-counts .count span { font-size: 11.5px; color: var(--mw-muted); }
.checks-counts .count.bad b { color: var(--mw-danger); }
.checks-counts .count.warn b { color: var(--mw-warning); }
.checks-counts .count.info b { color: var(--mw-primary-text); }
.client-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.client { border: 1px solid var(--mw-border); border-radius: var(--mw-radius); padding: 10px 12px; background: var(--mw-surface); }
.client-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.client-head b { font-size: 13px; }
.client ul { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--mw-text-2); line-height: 1.45; }
.issue-group + .issue-group { margin-top: 14px; }
.issues { list-style: none; margin: 0; padding: 0; }
.issues li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--mw-border); font-size: 13px; line-height: 1.5; color: var(--mw-text-2); }
.issues li:first-child { border-top: 0; }
.issues li .pill { flex: none; margin-top: 1px; }
.client-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; }
.client-tags em { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--mw-hover); color: var(--mw-muted); }
.links-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 10px; }
.links-table th, .links-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--mw-border); }
.links-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mw-muted); font-weight: 600; }
.link-url { font-family: var(--mw-mono); font-size: 12px; word-break: break-all; color: var(--mw-text); }
.link-text, .link-note { font-size: 12px; color: var(--mw-muted); margin-top: 2px; word-break: break-word; }
.checks-error-inline { margin: 8px 0 0; font-size: 12.5px; color: var(--mw-bad-ink); }
