/* YouMail design system.
 *
 * Concept: the inside of a security envelope. The fine lattice printed on confidential envelopes so
 * nothing can be read through the paper is the one recurring motif; everything else stays quiet.
 * Ink and paper carry the interface, a single highlighter in the logo's gold marks what needs attention
 * (unread mail, where you are, keyboard focus) and stamp red is reserved for destructive actions.
 * Archivo's width axis is the typographic device: expanded for titles, normal for reading,
 * condensed for dates and counts.
 *
 * CSP: style-src 'self', so no inline styles anywhere; images are self-hosted SVG files.
 */

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    font-stretch: 62% 125%;
    src: url("../fonts/archivo-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    font-stretch: 62% 125%;
    src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ---------- tokens ---------- */

:root {
    /* fixed brand colours, the same in both themes */
    --ink-fixed: #13202a;
    --hl: #ffc21a;
    --on-hl: #13202a;

    /* light theme */
    --paper: #e9edf0;
    --sheet: #fafbfb;
    --sheet-2: #f0f3f5;
    --rule: #d8dfe4;
    --rule-strong: #bcc7d0;
    --ink: #13202a;
    --ink-2: #33444f;
    --muted: #5c6e7c;
    --faint: #8696a3;
    --slate: #4b6b86;
    --hover: rgba(19, 32, 42, .045);
    --hl-soft: rgba(255, 194, 26, .34);
    --hl-wash: rgba(255, 194, 26, .16);
    --stamp: #c2362b;
    --stamp-soft: #f8e4e1;
    --ok: #2b6f4c;
    --ok-soft: #e1efe6;
    --warn: #8f5a00;
    --warn-soft: #f6ecd4;
    --primary: #13202a;
    --primary-hover: #26394a;
    --on-primary: #fafbfb;
    --side: #13202a;
    --side-2: #1c2c38;
    --side-text: #c6d1da;
    --side-muted: #7f93a3;
    --side-rule: rgba(198, 209, 218, .12);
    --tint: url("../img/tint-light.svg");
    --tint-ink: url("../img/tint-ink.svg");
    --shadow-sheet: 0 1px 0 rgba(19, 32, 42, .04), 0 1px 3px rgba(19, 32, 42, .06), 0 22px 44px -28px rgba(19, 32, 42, .38);
    --shadow-float: 0 2px 6px rgba(10, 17, 23, .10), 0 28px 64px -22px rgba(10, 17, 23, .48);
    --scrim: rgba(13, 22, 29, .46);

    --r-label: 3px;
    --r-control: 5px;
    --r-sheet: 6px;
    --r-float: 8px;

    --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --wide: 125%;
    --semi-wide: 112.5%;
    --narrow: 87.5%;

    --ease: cubic-bezier(.2, .8, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --ease-in: cubic-bezier(.55, 0, .75, .2);
    --ease-marker: cubic-bezier(.6, .04, .2, 1);
    --row-pad: 13px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0d151c; --sheet: #141f28; --sheet-2: #1a2733; --rule: #223240; --rule-strong: #30424f;
        --ink: #e2e9ee; --ink-2: #c1ccd4; --muted: #8b9daa; --faint: #5f7383; --slate: #8da6bc;
        --hover: rgba(226, 233, 238, .05); --hl-soft: rgba(255, 194, 26, .26); --hl-wash: rgba(255, 194, 26, .09);
        --stamp: #ef6a5e; --stamp-soft: #3a1714; --ok: #6cc59a; --ok-soft: #12291e; --warn: #e3ab4a; --warn-soft: #2f230d;
        --primary: #e2e9ee; --primary-hover: #ffffff; --on-primary: #0d151c;
        --side: #091016; --side-2: #121c25; --side-text: #b9c6d0; --side-muted: #6b8090; --side-rule: rgba(185, 198, 208, .10);
        --tint: url("../img/tint-dark.svg");
        --shadow-sheet: 0 1px 0 rgba(0, 0, 0, .3), 0 24px 48px -26px rgba(0, 0, 0, .7);
        --shadow-float: 0 2px 6px rgba(0, 0, 0, .4), 0 30px 70px -20px rgba(0, 0, 0, .75);
        --scrim: rgba(3, 7, 10, .62);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper: #0d151c; --sheet: #141f28; --sheet-2: #1a2733; --rule: #223240; --rule-strong: #30424f;
    --ink: #e2e9ee; --ink-2: #c1ccd4; --muted: #8b9daa; --faint: #5f7383; --slate: #8da6bc;
    --hover: rgba(226, 233, 238, .05); --hl-soft: rgba(255, 194, 26, .26); --hl-wash: rgba(255, 194, 26, .09);
    --stamp: #ef6a5e; --stamp-soft: #3a1714; --ok: #6cc59a; --ok-soft: #12291e; --warn: #e3ab4a; --warn-soft: #2f230d;
    --primary: #e2e9ee; --primary-hover: #ffffff; --on-primary: #0d151c;
    --side: #091016; --side-2: #121c25; --side-text: #b9c6d0; --side-muted: #6b8090; --side-rule: rgba(185, 198, 208, .10);
    --tint: url("../img/tint-dark.svg");
    --shadow-sheet: 0 1px 0 rgba(0, 0, 0, .3), 0 24px 48px -26px rgba(0, 0, 0, .7);
    --shadow-float: 0 2px 6px rgba(0, 0, 0, .4), 0 30px 70px -20px rgba(0, 0, 0, .75);
    --scrim: rgba(3, 7, 10, .62);
    color-scheme: dark;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: var(--font); font-size: 14px; line-height: 1.45; background: var(--paper); color: var(--ink);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-kerning: normal;
}
#app { height: 100%; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { font-weight: 720; line-height: 1.2; }
h1 { font-size: 26px; font-stretch: var(--wide); font-weight: 780; letter-spacing: -.012em; margin: 0 0 10px; }
h1:focus { outline: none; }
h2 { font-size: 16px; font-stretch: var(--semi-wide); margin: 0 0 8px; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
strong { font-weight: 650; }
::selection { background: var(--hl); color: var(--on-hl); }
:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; box-shadow: 0 0 0 2px var(--ink-fixed); border-radius: var(--r-control); }
input:not([type=checkbox]):not([type=radio]):focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
[tabindex="-1"]:focus-visible { outline: none; box-shadow: none; }
.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }

/* ---------- forms ---------- */

input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%; padding: 8px 11px; border: 1px solid var(--rule-strong); border-radius: var(--r-control);
    background: var(--sheet); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--hl-soft); }
input[readonly] { background: var(--sheet-2); color: var(--muted); }
textarea { resize: vertical; line-height: 1.55; }
label { display: block; font-weight: 560; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
label > input, label > select, label > textarea, label > .input-suffix { margin-top: 6px; font-weight: 400; font-size: 14px; color: var(--ink); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); font-size: 14px; }
label.check input { margin-top: 2px; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 16px; height: 16px; }
meter { width: 100%; height: 4px; }
meter::-webkit-meter-bar { background: var(--side-2); border: 0; border-radius: 0; height: 4px; }
meter::-webkit-meter-optimum-value { background: var(--hl); }
meter::-webkit-meter-suboptimum-value { background: #e3ab4a; }
meter::-webkit-meter-even-less-good-value { background: #ef6a5e; }
meter::-moz-meter-bar { background: var(--hl); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
    border-radius: var(--r-control); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink);
    cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn:hover { background: var(--sheet-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 40%, transparent); }
.btn.danger:hover { background: var(--stamp-soft); border-color: var(--stamp); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; height: 42px; font-size: 14px; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--ink); padding: 0; height: auto; font-weight: 560; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.btn.link:hover { background: none; text-decoration-color: currentColor; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; background: none;
    border-radius: var(--r-control); color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.danger:hover { background: var(--stamp-soft); color: var(--stamp); }
.icon-btn.on { color: var(--ink); }
.icon-btn.on .icon { fill: var(--hl); }
.kbd {
    font-family: var(--font); font-stretch: var(--narrow); font-size: 11px; font-weight: 640; color: var(--muted);
    border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: var(--r-label); padding: 0 5px;
    min-width: 18px; text-align: center; display: inline-block; line-height: 16px; background: var(--sheet);
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: .86em; letter-spacing: .01em; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.pad-x { padding: 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.form-error {
    display: flex; gap: 8px; align-items: flex-start; color: var(--stamp); background: var(--stamp-soft);
    padding: 9px 12px; border-left: 3px solid var(--stamp); border-radius: 0 var(--r-control) var(--r-control) 0; font-size: 13.5px;
    animation: nudge .32s var(--ease);
}
@keyframes nudge { 20% { transform: translateX(-4px); } 45% { transform: translateX(3px); } 70% { transform: translateX(-1px); } }
.callout {
    display: flex; gap: 10px; align-items: flex-start; background: var(--sheet-2); color: var(--ink);
    border-left: 3px solid var(--slate); border-radius: 0 var(--r-control) var(--r-control) 0; padding: 10px 12px; margin: 10px 0; font-size: 13.5px; line-height: 1.5;
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.danger { border-left-color: var(--stamp); background: var(--stamp-soft); }
.callout .icon { margin-top: 2px; color: var(--slate); }
.callout.warn .icon { color: var(--warn); }
.callout.danger .icon { color: var(--stamp); }
.callout.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.callout.ok .icon { color: var(--ok); }
.btn.link.inline { font-weight: inherit; font-size: inherit; vertical-align: baseline; }
.tag {
    display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 0 6px; line-height: 18px;
    border-radius: var(--r-label); background: var(--sheet-2); color: var(--ink-2); border: 1px solid var(--rule);
}
.tag.accent { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge { margin-left: auto; font-stretch: var(--narrow); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hl); }

/* ---------- avatars: ink-stamped monograms ---------- */

.avatar {
    --av: #3a4a57; --av-bg: #e3e7ea;
    width: 36px; height: 36px; border-radius: var(--r-control); display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-stretch: var(--semi-wide); font-size: 13px; flex-shrink: 0; user-select: none;
    background: var(--av-bg); color: var(--av); transition: opacity .12s;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.av-0 { --av: #2c4a66; --av-bg: #dbe4ed; } .av-1 { --av: #5a3f6b; --av-bg: #e7dfeb; } .av-2 { --av: #2f5b3b; --av-bg: #dce9de; }
.av-3 { --av: #6b4f1d; --av-bg: #eee5d2; } .av-4 { --av: #22585f; --av-bg: #d8e7e9; } .av-5 { --av: #7a3a33; --av-bg: #ecdbd8; }
.av-6 { --av: #3f4170; --av-bg: #e2e2ee; } .av-7 { --av: #5b5141; --av-bg: #e8e4da; } .av-8 { --av: #355248; --av-bg: #dbe5e1; }
.av-9 { --av: #3a4a57; --av-bg: #e2e6e9; }
.avatar.av-system { background: var(--hl); color: var(--on-hl); }
:root[data-theme="dark"] .avatar:not(.av-system) { background: color-mix(in srgb, var(--av) 55%, var(--sheet)); color: var(--av-bg); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .avatar:not(.av-system) { background: color-mix(in srgb, var(--av) 55%, var(--sheet)); color: var(--av-bg); }
}

/* ---------- brand ---------- */

/* The logo: the gold envelope behind its speed bars, and a black wordmark, "YouMail" in the text colour and ".eMail" in gold. */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-stretch: 100%; font-size: 21px; letter-spacing: -.02em; line-height: 1; color: inherit; text-decoration: none; }
.brand-mark { display: inline-flex; flex-shrink: 0; color: var(--hl); }
.brand-mark svg { display: block; }
.brand-mail { color: var(--hl); }

/* ---------- boot ---------- */

.boot {
    height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    background: var(--ink-fixed) var(--tint-ink); color: #c6d1da;
}
.boot-logo { display: flex; align-items: center; gap: 12px; font-weight: 900; font-stretch: 100%; letter-spacing: -.02em; font-size: 30px; line-height: 1; color: #fafbfb; }
.boot-text { color: #7f93a3; font-size: 13px; }
.boot-bar { width: 132px; height: 3px; background: rgba(198, 209, 218, .14); overflow: hidden; }
.boot-bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--hl); animation: scan 1.1s var(--ease-marker) infinite alternate; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--rule); border-top-color: var(--ink); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon.spin { animation: spin .8s linear infinite; }

/* ---------- unveil: the one orchestrated moment ----------
 * After sign-in or unlock the lattice "envelope" is lifted off the mailbox. A highlighter stroke
 * draws under the wordmark, then the whole sheet slides up and away. */

.unveil {
    position: fixed; inset: 0; z-index: 200; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--ink-fixed) var(--tint-ink); border-bottom: 5px solid var(--hl);
    animation: unveil .78s var(--ease-marker) .38s both;
}
.unveil-mark { position: relative; display: flex; align-items: center; gap: 12px; color: #fafbfb; font-weight: 900; font-stretch: 100%; letter-spacing: -.02em; font-size: 30px; line-height: 1; padding-bottom: 12px; animation: unveil-mark .5s var(--ease-in) .4s both; }
.unveil-mark::after { content: ""; position: absolute; left: 73px; right: -4px; bottom: 0; height: 4px; background: var(--hl); transform-origin: left; animation: draw .34s var(--ease-marker) both; }
@keyframes unveil { to { transform: translateY(-101%); } }
@keyframes unveil-mark { to { opacity: 0; transform: translateY(-14px); } }
@keyframes draw { from { transform: scaleX(0); } }

/* ---------- public pages: sign in, register, recover ---------- */

.auth-shell { min-height: 100%; display: grid; grid-template-columns: minmax(400px, 1fr) minmax(440px, 600px); }
.auth-hero {
    position: relative; padding: 40px 56px 48px; display: flex; flex-direction: column; gap: 28px;
    background: var(--ink-fixed) var(--tint-ink); color: #c6d1da;
}
.auth-hero .brand { color: #fafbfb; font-size: 34px; gap: 12px; }
.auth-hero .brand-mark svg { width: 65px; height: 32px; }
/* An envelope's address window, cut into the security tint. */
.auth-hero-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 26px; }
.envelope-window {
    max-width: min(100%, 560px); padding: 22px 28px 24px;
    background: #fafbfb; color: var(--ink-fixed); border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(19, 32, 42, .08), 0 0 0 6px rgba(250, 251, 251, .06);
}
.envelope-window span { display: block; font-size: 14px; color: #5c6e7c; margin-bottom: 4px; }
.envelope-window strong { display: block; font-size: clamp(28px, 3.3vw, 46px); line-height: 1.04; font-weight: 820; font-stretch: var(--wide); letter-spacing: -.02em; word-break: break-word; }
.auth-note { max-width: 460px; color: #9fb0bd; font-size: 14.5px; line-height: 1.55; margin: 0; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 80px); background: var(--sheet); }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-card.wide { max-width: 640px; }
.auth-card > h1 { font-size: 28px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; font-size: 14.5px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 8px; font-size: 13.5px; }
.auth-foot { margin-top: 28px; display: flex; gap: 8px; align-items: center; color: var(--side-muted); font-size: 12.5px; }
.public-shell {
    min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
    background: var(--ink-fixed) var(--tint-ink);
}
.public-shell > .brand { color: #fafbfb; margin-bottom: 22px; }
.public-shell .auth-card {
    width: min(100%, 460px); background: var(--sheet); border-radius: var(--r-sheet); padding: 32px 32px 28px;
    box-shadow: var(--shadow-float); border-top: 5px solid var(--hl); animation: rise .42s var(--ease-out) both;
}
.public-shell .auth-card.wide { width: min(100%, 760px); }
.divider { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--faint); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.auth-card .btn.block + .divider { margin-top: 16px; }
.auth-card .btn.block .icon { margin-left: -4px; }
.two-step .option-note { margin: 6px 2px 16px; }
.two-step .btn.ghost.block { margin-top: 4px; }
.lock-icon { width: 46px; height: 46px; border-radius: var(--r-control); background: var(--sheet-2); border: 1px solid var(--rule); color: var(--ink); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
.input-suffix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--rule-strong); border-left: 0; border-radius: 0 var(--r-control) var(--r-control) 0; background: var(--sheet-2); color: var(--muted); white-space: nowrap; font-size: 13.5px; }
.recovery-key {
    font-family: var(--mono); font-size: 15px; line-height: 1.9; padding: 16px 18px; margin: 14px 0;
    border: 1px dashed var(--slate); border-radius: var(--r-sheet); background: var(--sheet-2); color: var(--ink);
    overflow-wrap: anywhere; word-break: normal; user-select: all; letter-spacing: .03em;
}
.strength { display: flex; gap: 3px; margin: -6px 0 14px; }
.strength span { flex: 1; height: 3px; background: var(--rule); transition: background .25s; }
.strength.s1 span:nth-child(-n+1) { background: var(--stamp); }
.strength.s2 span:nth-child(-n+2) { background: var(--warn); }
.strength.s3 span:nth-child(-n+3) { background: var(--ok); }
.strength.s4 span:nth-child(-n+4) { background: var(--ok); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ---------- app shell ---------- */

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); height: 100%; transition: grid-template-columns .22s var(--ease); }
.app-shell.rail { grid-template-columns: 64px minmax(0, 1fr); }
.app-main { min-width: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.scrim { display: none; }

.topbar { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 14px 0 16px; border-bottom: 1px solid var(--rule); background: var(--sheet); flex-shrink: 0; }
.topbar .mobile-only { display: none; }
.searchbox { flex: 1; max-width: 620px; position: relative; }
.searchbox > .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.searchbox input { padding-left: 36px !important; padding-right: 72px !important; background: var(--sheet-2) !important; border-color: transparent !important; height: 36px; }
.searchbox input:focus { background: var(--sheet) !important; border-color: var(--ink) !important; }
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.searchbox > .kbd-hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.user-chip { display: flex; align-items: center; margin-left: 6px; border-radius: var(--r-control); text-decoration: none; }

/* sidebar: ink, with the security tint rising from the bottom */
.sidebar {
    background: linear-gradient(to bottom, var(--side) 30%, transparent 100%), var(--side) var(--tint-ink);
    color: var(--side-text); display: flex; flex-direction: column; padding: 14px 10px 12px; overflow-y: auto; overflow-x: hidden;
    scrollbar-color: var(--side-2) transparent;
}
.sidebar .brand { color: #fafbfb; font-size: 17px; }
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, .07); color: #fafbfb; }
.sidebar-head { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; height: 34px; padding: 0 4px 0 6px; margin-bottom: 16px; }
.compose-btn { width: 100%; height: 40px; flex-shrink: 0; margin-bottom: 16px; font-size: 14px; background: #fafbfb !important; border-color: #fafbfb !important; color: var(--ink-fixed) !important; }
.compose-btn:hover { background: #ffffff !important; }
.folder-list { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 1px; }
/* The active folder is marked with a highlighter swash that draws in from the left. */
.folder {
    position: relative; display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px;
    border-radius: var(--r-control); color: var(--side-text); text-decoration: none; font-weight: 500; transition: color .2s, background .15s;
}
.folder:hover { background: rgba(255, 255, 255, .06); color: #fafbfb; }
.folder.active { color: #fafbfb; font-weight: 650; }
.folder.active .icon { color: var(--hl); opacity: 1; }
.folder.active .folder-name { color: var(--on-hl); background-size: 100% 78%; }
.folder .icon { color: inherit; opacity: .9; transition: color .2s; }
.folder.drop-target { background: rgba(255, 194, 26, .14); box-shadow: inset 0 0 0 1.5px var(--hl); }
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* folder tree: nesting, collapse toggles, actions menu */
.tree-row { position: relative; }
.depth-1 > .folder, .depth-1 > .folder-editor { padding-left: 26px; }
.depth-2 > .folder, .depth-2 > .folder-editor { padding-left: 42px; }
.depth-3 > .folder, .depth-3 > .folder-editor { padding-left: 58px; }
.depth-4 > .folder, .depth-4 > .folder-editor { padding-left: 74px; }
.folder-toggle {
    position: absolute; z-index: 1; top: 50%; left: -8px; width: 16px; height: 20px; margin-top: -10px; padding: 0; border: 0;
    border-radius: var(--r-label); background: none; color: var(--side-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.depth-1 > .folder-toggle { left: 8px; } .depth-2 > .folder-toggle { left: 24px; } .depth-3 > .folder-toggle { left: 40px; } .depth-4 > .folder-toggle { left: 56px; }
.folder-toggle:hover { color: #fafbfb; background: rgba(255, 255, 255, .08); }
.folder-toggle .icon { transition: transform .2s var(--ease); }
.folder-toggle .icon.open { transform: rotate(90deg); }
.folder-more { position: absolute; right: 2px; top: 50%; margin-top: -14px; width: 28px; height: 28px; opacity: 0; transition: opacity .12s; }
.tree-row:hover .folder-more, .tree-row.menu-open .folder-more, .folder-more:focus-visible { opacity: 1; }
.tree-row:has(.folder-more):hover .badge, .tree-row.menu-open .badge { visibility: hidden; }
@media (hover: none) {
    .folder-more { opacity: .7; }
    .tree-row .folder:has(.badge) { padding-right: 34px; }
}
.folder-menu {
    position: absolute; right: 4px; top: calc(100% - 2px); z-index: 70; min-width: 196px; padding: 4px; display: grid;
    background: var(--side-2); border: 1px solid var(--side-rule); border-radius: var(--r-float); box-shadow: var(--shadow-float);
    transform-origin: top right; animation: menu-in .16s var(--ease-out);
}
@keyframes menu-in { from { opacity: 0; transform: scale(.95) translateY(-4px); } }
.folder-menu button {
    display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-control);
    background: none; color: var(--side-text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.folder-menu button:hover, .folder-menu button:focus-visible { background: rgba(255, 255, 255, .07); color: #fafbfb; }
.folder-menu button.danger { color: #ef8f86; }
.folder-menu button.danger:hover { background: rgba(239, 106, 94, .14); color: #ff9d94; }
.menu-scrim { position: fixed; inset: 0; z-index: 65; }
.folder-editor { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 6px 0 10px; color: var(--side-muted); }
.folder-editor input { height: 28px; padding: 4px 8px !important; background: var(--side-2) !important; border-color: var(--hl) !important; color: #fafbfb; box-shadow: none !important; }
/* Highlighter: a chisel-ended stroke that sweeps across the label when it becomes active. */
.folder-name, .nav-label {
    padding: 1px 6px; margin: 0 -6px; border-radius: 2px;
    background-image: linear-gradient(100deg, transparent 0 3px, var(--hl) 3px calc(100% - 2px), transparent calc(100% - 2px));
    background-repeat: no-repeat; background-position: 0 55%; background-size: 0 78%;
    transition: background-size .36s var(--ease-marker), color .2s;
}
.sidebar-section { display: flex; align-items: center; justify-content: space-between; padding: 16px 6px 4px 10px; color: var(--side-muted); font-size: 12.5px; font-weight: 560; }
.sidebar-section .icon-btn { width: 24px; height: 24px; }
.sidebar-rule { height: 1px; background: var(--side-rule); margin: 12px 8px; border: 0; }
.new-folder { padding: 2px 4px 6px; }
.new-folder input { height: 32px; background: var(--side-2) !important; border-color: var(--side-rule) !important; color: #fafbfb; }
.sidebar-footer { margin-top: auto; padding-top: 14px; display: grid; gap: 8px; }
.storage { display: grid; gap: 6px; padding: 0 10px; }
.storage .small { display: flex; justify-content: space-between; color: var(--side-muted); font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
.sidebar-footer button.folder { border: 0; background: none; width: 100%; cursor: pointer; font: inherit; height: 34px; justify-content: flex-start; color: var(--side-text); }
.sidebar-footer button.folder:hover { background: rgba(255, 255, 255, .06); color: #fafbfb; }
/* The drawer on phones has no collapsed state. */
@media (max-width: 760px) {
    .rail-toggle { display: none; }
}
@media (min-width: 761px) {
    .rail .compose-btn span, .rail .folder-name, .rail .badge, .rail .sidebar-section, .rail .brand-text, .rail .sidebar-footer .account, .rail .new-folder { display: none; }
    .rail .compose-btn { padding: 0; }
    .rail .folder, .rail .sidebar-footer button.folder { justify-content: center; }
    .rail .sidebar-head { flex-direction: column; justify-content: center; gap: 10px; height: auto; padding: 0; }
    .rail .brand-mark svg { width: 40px; height: auto; }
    .rail .tree-row:not(.depth-0), .rail .folder-toggle, .rail .folder-more, .rail .folder-menu { display: none; }
    .rail .folder.active { background: rgba(255, 194, 26, .12); }
}

/* ---------- mailbox: a ledger, not a stack of cards ---------- */

.mail-layout { display: grid; grid-template-columns: minmax(340px, 430px) minmax(0, 1fr); height: 100%; min-height: 0; }
.mail-list-pane { border-right: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; background: var(--sheet); }
.list-header { display: flex; align-items: baseline; gap: 10px; height: 58px; padding: 16px 10px 0 18px; border-bottom: 1px solid var(--rule); flex-shrink: 0; }
.list-header .icon-btn, .list-header .btn { align-self: center; margin-top: -10px; }
.folder-title { font-size: 21px; font-weight: 800; font-stretch: var(--wide); letter-spacing: -.015em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-header .count { color: var(--faint); font-size: 13px; font-weight: 600; font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
.bulkbar {
    display: flex; align-items: center; gap: 2px; height: 58px; padding: 0 8px 0 18px; border-bottom: 1px solid var(--side);
    background: var(--side); color: var(--side-text); flex-shrink: 0; animation: bar-in .2s var(--ease-out);
}
.bulkbar input[type=checkbox] { accent-color: var(--hl); }
.bulkbar .sel { font-weight: 700; color: var(--hl); margin: 0 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bulkbar .icon-btn { color: var(--side-text); }
.bulkbar .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fafbfb; }
.bulkbar .icon-btn.danger:hover { background: rgba(239, 106, 94, .16); color: #ef6a5e; }
@keyframes bar-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.mail-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overflow-x: hidden; flex: 1; overscroll-behavior: contain; }
.mail-row {
    position: relative; display: flex; align-items: flex-start; gap: 12px; padding: var(--row-pad) 16px var(--row-pad) 18px;
    border-bottom: 1px solid var(--rule); cursor: pointer; transition: background .12s; touch-action: pan-y; background: var(--sheet);
}
/* Unread mail carries a highlighter edge; reading it retracts the mark. */
.mail-row::before {
    content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; background: var(--hl);
    border-radius: 0 2px 2px 0; transform: scaleY(0); transition: transform .25s var(--ease-marker);
}
.mail-row.unread::before { transform: scaleY(1); }
.mail-row:hover { background: var(--sheet-2); }
.mail-row.active { background: var(--hl-wash); box-shadow: inset 3px 0 0 var(--ink); }
.mail-row.active::before { transform: scaleY(0); }
.mail-row.selected { background: var(--hl-wash); }
.mail-row.dragging { opacity: .45; }
.mail-row .lead { position: relative; width: 36px; height: 36px; flex-shrink: 0; }
.mail-row .lead input { position: absolute; inset: 0; margin: auto; opacity: 0; transition: opacity .1s; z-index: 1; width: 18px; height: 18px; cursor: pointer; }
.mail-row:hover .lead input, .mail-row.selected .lead input, .mail-list.selecting .lead input { opacity: 1; }
.mail-row:hover .lead .avatar, .mail-row.selected .lead .avatar, .mail-list.selecting .lead .avatar { opacity: 0; }
.mail-row-main { flex: 1; min-width: 0; }
.mail-row-top { display: flex; align-items: baseline; gap: 8px; }
.mail-row .from { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; color: var(--ink-2); font-weight: 500; }
.mail-row .date { color: var(--faint); font-size: 12px; font-weight: 560; font-stretch: var(--narrow); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-row .subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.mail-row .subject .s { overflow: hidden; text-overflow: ellipsis; }
.mail-row .snippet { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mail-row.unread .from { font-weight: 720; color: var(--ink); }
.mail-row.unread .subject { font-weight: 650; color: var(--ink); }
.mail-row.unread .date { color: var(--ink-2); }
.mail-row .meta-icons { display: inline-flex; gap: 4px; color: var(--faint); align-self: center; }
.mail-row .meta-icons .lock { color: var(--ok); }
.mail-row .star.on { color: var(--ink); display: inline-flex; }
.mail-row .star.on .icon, .mail-row .icon.on { fill: var(--hl); color: var(--ink); }
.row-actions {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: none; gap: 1px; padding: 2px;
    border-radius: var(--r-control); background: var(--sheet); border: 1px solid var(--rule); box-shadow: 0 6px 16px -8px rgba(19, 32, 42, .35);
}
.mail-row:hover .row-actions { display: flex; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.mail-row.swiping { transition: none; z-index: 1; }

/* Moving mail away: slide out in the direction it went, then close the gap. */
.mail-row.leaving-right, .mail-row.leaving-left { overflow: hidden; pointer-events: none; }
.mail-row.leaving-right { animation: leave-right .3s var(--ease-in) forwards; }
.mail-row.leaving-left { animation: leave-left .3s var(--ease-in) forwards; }
@keyframes leave-right {
    0% { transform: none; opacity: 1; max-height: 100px; }
    55% { transform: translateX(56px); opacity: 0; max-height: 100px; padding-top: var(--row-pad); padding-bottom: var(--row-pad); }
    100% { transform: translateX(56px); opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0; }
}
@keyframes leave-left {
    0% { transform: none; opacity: 1; max-height: 100px; }
    55% { transform: translateX(-56px); opacity: 0; max-height: 100px; padding-top: var(--row-pad); padding-bottom: var(--row-pad); }
    100% { transform: translateX(-56px); opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-bottom-width: 0; }
}

.density-compact { --row-pad: 8px; }
.density-compact .mail-row .snippet { display: none; }
.density-compact .mail-row .lead, .density-compact .mail-row .avatar { width: 28px; height: 28px; font-size: 11.5px; }

.load-more { margin: 10px 14px 16px; width: calc(100% - 28px); }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .empty-icon {
    width: 64px; height: 64px; border-radius: var(--r-sheet); display: flex; align-items: center; justify-content: center;
    color: var(--slate); margin-bottom: 10px; background: var(--paper) var(--tint); border: 1px solid var(--rule);
}
.empty .empty-icon .icon { background: var(--sheet); border-radius: 50%; padding: 6px; box-sizing: content-box; }
.empty h3 { color: var(--ink); margin: 0; font-size: 16px; font-stretch: var(--semi-wide); }
.empty p { max-width: 320px; margin: 0; }

.skeleton-row { display: flex; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--rule); }
.sk { background: linear-gradient(90deg, var(--sheet-2) 0%, var(--rule) 40%, var(--sheet-2) 80%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-label); }
.sk.circle { width: 36px; height: 36px; border-radius: var(--r-control); flex-shrink: 0; }
.sk.line { height: 10px; margin: 4px 0 10px; }
.sk.w40 { width: 40%; } .sk.w70 { width: 70%; } .sk.w90 { width: 90%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* ---------- reader: a sheet laid on the security tint ---------- */

.reader-pane { overflow-y: auto; min-height: 0; background: var(--paper) var(--tint); }
.reader-empty { margin-top: 16vh; }
.reader-empty .empty { background: var(--sheet); max-width: 380px; margin: 0 auto; border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); padding: 36px 28px 30px; }
.reader { max-width: 860px; margin: 0 auto; padding: 0 28px 56px; }
.reader-toolbar {
    position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 2px; height: 52px; margin: 0 -28px 22px; padding: 0 22px;
    background: color-mix(in srgb, var(--sheet) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule);
}
.reader-toolbar .sep { width: 1px; height: 18px; background: var(--rule); margin: 0 6px; }
.reader-toolbar .back { display: none; }
.reader-toolbar select.move { width: auto; height: 30px; padding: 0 10px; font-size: 13px; }
.message-card {
    background: var(--sheet); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); overflow: hidden;
    animation: sheet-rise .42s var(--ease-out) both;
}
@keyframes sheet-rise { from { opacity: 0; transform: translateY(22px); } }
.sheet-head { padding: 26px 30px 0; }
.reader-subject { font-size: 25px; line-height: 1.18; letter-spacing: -.015em; font-weight: 760; font-stretch: var(--semi-wide); margin: 0 0 14px; word-break: break-word; }
.security-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.badge-sec {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 580; padding: 3px 9px 3px 7px;
    border-radius: var(--r-label); background: var(--sheet-2); color: var(--ink-2); border: 1px solid var(--rule);
}
.badge-sec.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge-sec.bad { background: var(--stamp-soft); color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 35%, transparent); font-weight: 650; }
.badge-sec.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.reader-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; padding: 16px 30px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--sheet-2); }
.meta-lines { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; word-break: break-word; }
.meta-lines .who { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.meta-lines .who strong { font-weight: 680; }
.reader-meta .when { font-stretch: var(--narrow); font-variant-numeric: tabular-nums; }
.message-body { padding: 26px 30px 30px; }
.mail-text { white-space: pre-wrap; word-break: break-word; line-height: 1.68; font-size: 15px; color: var(--ink); max-width: 72ch; }
.mail-html { background: #fff; border-radius: var(--r-control); overflow: hidden; }
.mail-frame { width: 100%; height: 300px; border: 0; display: block; background: #fff; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 30px 26px; }
.attachments h3 { width: 100%; font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 2px; }
.attachment {
    display: inline-flex; align-items: center; gap: 10px; padding: 7px 12px 7px 8px; border: 1px solid var(--rule-strong);
    border-radius: var(--r-control); background: var(--sheet); cursor: pointer; max-width: 100%; text-align: left; transition: border-color .15s, background .15s;
}
.attachment:hover { border-color: var(--ink); background: var(--sheet-2); }
.attachment .file-icon { width: 32px; height: 32px; border-radius: var(--r-label); background: var(--paper) var(--tint); color: var(--slate); display: flex; align-items: center; justify-content: center; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; font-weight: 600; display: block; }
.attachments.compact { padding: 8px 0; }
.reply-bar { display: flex; gap: 8px; margin-top: 18px; animation: rise .42s var(--ease-out) .08s both; }
.reply-bar .btn { background: var(--sheet); }

/* the plain sheet used by secure-link messages */
.public-shell .reader { max-width: none; padding: 32px; }

/* ---------- compose ---------- */

.compose-dock { position: fixed; right: 24px; bottom: 0; z-index: 50; width: min(600px, calc(100vw - 32px)); }
.compose-dock.maximized { inset: 0; width: auto; display: flex; align-items: center; justify-content: center; background: var(--scrim); animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.compose {
    background: var(--sheet); border-radius: var(--r-float) var(--r-float) 0 0; box-shadow: var(--shadow-float); display: flex; flex-direction: column;
    max-height: min(720px, calc(100vh - 72px)); overflow: hidden; animation: compose-rise .36s var(--ease-out);
}
@keyframes compose-rise { from { transform: translateY(70px); opacity: 0; } }
/* Sent: the sheet is posted up and out. */
.compose.posted { animation: posted .34s var(--ease-in) forwards; pointer-events: none; }
@keyframes posted { to { transform: translateY(-90px) scale(.94); opacity: 0; } }
.maximized .compose { width: min(980px, calc(100vw - 48px)); height: min(860px, calc(100vh - 48px)); max-height: none; border-radius: var(--r-float); }
.compose.minimized .compose-body, .compose.minimized .compose-footer { display: none; }
.compose-header {
    display: flex; justify-content: space-between; align-items: center; height: 42px; padding: 0 6px 0 16px;
    background: var(--ink-fixed); color: #fafbfb; font-weight: 650; cursor: default; border-bottom: 3px solid var(--hl);
}
.compose-header > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-header .icon-btn { width: 28px; height: 28px; color: #9fb0bd; }
.compose-header .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fafbfb; }
.compose-body { padding: 2px 18px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
.field-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--rule); min-height: 42px; transition: border-color .15s; }
.field-row:focus-within { border-bottom-color: var(--ink); }
.field-row label { margin: 0; width: 56px; color: var(--muted); font-weight: 520; font-size: 13.5px; }
.field-row input { border: none !important; box-shadow: none !important; padding: 8px 0 !important; background: transparent !important; }
.recipient-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 2px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-label); background: var(--sheet-2); border: 1px solid var(--rule); animation: chip-in .2s var(--ease-out); }
@keyframes chip-in { from { opacity: 0; transform: scale(.9); } }
.chip.e2e { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.ext { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.pgp { background: var(--ok-soft); color: var(--ok); border-color: transparent; border-style: dashed; }
.chip.invalid { background: var(--stamp-soft); color: var(--stamp); text-decoration: line-through; border-color: transparent; }
.compose-text { border: none !important; box-shadow: none !important; padding: 14px 0 !important; min-height: 260px; flex: 1; line-height: 1.62; background: transparent !important; font-size: 15px; resize: none; }
/* Formatting: a quiet strip above the text; the active format wears the highlighter. */
.format-bar {
    position: relative; display: flex; align-items: center; gap: 1px; flex-wrap: wrap; padding: 6px 0 5px;
    border-bottom: 1px solid var(--rule); margin-top: 4px;
}
.format-bar .icon-btn { width: 30px; height: 30px; border-radius: var(--r-control); }
.format-bar .icon-btn[aria-pressed="true"] { background: var(--hl-soft); color: var(--ink); }
.format-bar .sep { width: 1px; height: 18px; background: var(--rule); margin: 0 5px; }
.format-bar .spacer { flex: 1; }
.link-pop {
    position: absolute; z-index: 5; top: 40px; left: 0; display: flex; gap: 6px; align-items: center; width: min(420px, 100%);
    background: var(--sheet); padding: 8px; border-radius: var(--r-float); box-shadow: var(--shadow-float); border-top: 3px solid var(--hl);
    animation: rise .16s var(--ease-out);
}
.link-pop input { flex: 1; min-width: 0; }
.compose-rich {
    flex: 1; min-height: 260px; padding: 14px 0; outline: none; font-size: 15px; line-height: 1.62; overflow-wrap: anywhere; cursor: text;
}
.compose-rich:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.compose-rich p, .compose-rich div { margin: 0 0 .6em; }
.compose-rich h2 { font-size: 19px; margin: .5em 0 .4em; font-stretch: var(--wide); }
.compose-rich h3 { font-size: 16px; margin: .5em 0 .3em; }
.compose-rich ul, .compose-rich ol { margin: 0 0 .6em; padding-left: 1.4em; }
.compose-rich blockquote { margin: 0 0 .6em; padding: 2px 0 2px 12px; border-left: 3px solid var(--rule-strong); color: var(--ink-2); }
.compose-rich pre { font-family: var(--mono); font-size: 13px; background: var(--sheet-2); padding: 8px 10px; border-radius: var(--r-control); white-space: pre-wrap; }
.compose-rich code { font-family: var(--mono); font-size: .92em; background: var(--sheet-2); padding: 0 3px; border-radius: 3px; }
.compose-rich a { color: var(--link, var(--ink)); text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 2px; }
.plain-switch { display: flex; justify-content: flex-end; margin-top: -4px; }
.external-options { border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: 12px 14px; margin-top: 10px; background: var(--sheet-2); }
.external-options legend { font-weight: 650; padding: 0 6px; font-size: 13px; }
.external-options input:not([type=radio]) { flex: 1; min-width: 200px; }
.external-options .check.unavailable { opacity: .6; }
.compose-footer { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.compose-footer select { width: auto; height: 30px; padding: 0 10px; font-size: 13px; }
.file-btn { position: relative; overflow: hidden; margin: 0; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- pages ---------- */

.page { padding: 34px 36px 64px; overflow-y: auto; height: 100%; }
.page-inner { max-width: 960px; margin: 0 auto; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.page-header h1 { margin: 0; flex: 1; }
.page-header input { max-width: 240px; }
.page-sub { color: var(--muted); margin-bottom: 26px; max-width: 68ch; }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: 22px 24px; margin-bottom: 16px; }
.card h2 { display: flex; align-items: center; gap: 9px; }
.card h2 .icon { color: var(--slate); }
.card .card-sub { color: var(--muted); font-size: 13.5px; margin: -2px 0 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: span 2; }
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: start; }
.settings-nav { position: sticky; top: 0; display: grid; gap: 2px; }
.settings-nav button {
    display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 0;
    background: none; border-radius: var(--r-control); color: var(--ink-2); font-weight: 520; cursor: pointer; text-align: left;
}
.settings-nav button:hover { background: var(--hover); }
.settings-nav button.active { color: var(--ink); font-weight: 650; }
.settings-nav button.active .nav-label { color: var(--on-hl); background-size: 100% 78%; }
.contact-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--rule); border-radius: var(--r-sheet); background: var(--sheet); overflow: hidden; }
.contact-list:empty { border: 0; }
.card.contact { display: flex; align-items: center; gap: 14px; padding: 13px 16px; margin: 0; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; }
.card.contact:last-child { border-bottom: 0; }
.card.contact:hover { background: var(--sheet-2); }
.passkey-list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-sheet); }
.passkey-list li { display: flex; align-items: center; gap: 12px; padding: 11px 10px 11px 14px; border-bottom: 1px solid var(--rule); }
.passkey-list li:last-child { border-bottom: 0; }
.passkey-list li > .icon { color: var(--slate); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.kv:last-child { border-bottom: 0; }
.codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 28px; padding: 14px 16px; background: var(--sheet-2); border: 1px dashed var(--rule-strong); border-radius: var(--r-sheet); margin-bottom: 12px; user-select: all; font-family: var(--mono); }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: var(--r-sheet); display: block; margin: 10px 0; border: 1px solid var(--rule); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; border-bottom-color: var(--rule-strong); }
.table tr:hover td { background: var(--sheet-2); }
.table .ua { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.warn-row td { color: var(--stamp); }
.danger-zone { border-color: color-mix(in srgb, var(--stamp) 45%, var(--rule)); }
.danger-zone h2 .icon { color: var(--stamp); }
.segmented { display: inline-flex; background: var(--sheet-2); padding: 3px; border-radius: var(--r-control); gap: 2px; border: 1px solid var(--rule); margin-top: 6px; }
.segmented button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: var(--r-label); font-weight: 560; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: background .15s, color .15s; }
.segmented button.active { background: var(--primary); color: var(--on-primary); }

/* ---------- address tags ---------- */

.addr-tag { flex-shrink: 0; gap: 3px; font-weight: 600; color: var(--slate); background: transparent; border-color: color-mix(in srgb, var(--slate) 35%, transparent); }
.mail-row.unread .addr-tag { color: var(--ink-2); }
a.badge-sec.tag-link { text-decoration: none; }
a.badge-sec.tag-link:hover { border-color: var(--ink); color: var(--ink); }
.blocked-note { color: var(--stamp); font-weight: 650; }
.from-select { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 8px 0 !important; font-weight: 560; }
/* The address preview sits in a window cut into the security tint, like the sign-in screen. */
.address-window {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; margin: 2px 0 10px;
    border-radius: var(--r-sheet); background: var(--paper) var(--tint); border: 1px solid var(--rule);
}
.address-text {
    flex: 1; min-width: 0; padding: 10px 14px; background: var(--sheet); border-radius: var(--r-control); box-shadow: inset 0 0 0 1px var(--rule);
    font-weight: 760; font-stretch: var(--semi-wide); font-size: 17px; overflow-wrap: anywhere;
}
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 10px; }
.section-head h2 { margin: 0; }
.tag-ledger { list-style: none; margin: 0 0 12px; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.tag-ledger li { position: relative; display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--rule); }
.tag-ledger li:last-child { border-bottom: 0; }
.tag-ledger li.leak::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; background: var(--stamp); border-radius: 0 2px 2px 0; }
.tag-ledger li.blocked .tag-name strong { text-decoration: line-through; text-decoration-color: var(--stamp); color: var(--muted); }
.tag-name { display: flex; align-items: center; gap: 8px; }
.tag-name strong { font-size: 15px; font-stretch: var(--semi-wide); font-weight: 720; }
.maker { align-items: end; }
.maker .segmented { margin-bottom: 14px; }
.tag-label { margin-left: 4px; padding-left: 8px; border-left: 1px solid currentColor; font-weight: 650; }
.leak-note { display: flex; gap: 6px; align-items: center; color: var(--stamp); font-weight: 600; font-size: 13px; margin: 4px 0 2px; }

/* ---------- private relay ---------- */

.relay-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0 0 8px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.relay-stats > div { background: var(--sheet); padding: 14px 18px; display: grid; gap: 2px; }
.relay-stats strong { font-size: 24px; font-weight: 780; font-stretch: var(--wide); font-variant-numeric: tabular-nums; line-height: 1.1; }
.relay-stats span { color: var(--muted); font-size: 12.5px; }
.small-seg button { height: 26px; font-size: 12.5px; }
.relay-filter { max-width: 220px; margin-left: auto; height: 32px; }
.section-head .segmented { margin-top: 0; }
.relay-ledger { list-style: none; margin: 0 0 18px; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.relay-row { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--rule); transition: background .15s; }
.relay-row:last-child { border-bottom: 0; }
.relay-row.open { background: var(--sheet-2); border-bottom-color: transparent; }
.relay-row.off .relay-name strong, .relay-row.off .relay-address { color: var(--faint); }
.relay-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.relay-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.relay-name strong { font-size: 15px; font-weight: 700; font-stretch: var(--semi-wide); }
.relay-address { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.tag.warn-tag { background: var(--stamp-soft); color: var(--stamp); border-color: transparent; }
.relay-detail { padding: 6px 18px 16px 66px; background: var(--sheet-2); border-bottom: 1px solid var(--rule); animation: rise .24s var(--ease-out); }
.relay-detail .form-grid { margin-top: 6px; }
.detail-head { font-size: 13px; color: var(--muted); font-weight: 650; margin: 18px 0 6px; }
.relay-detail form.row { margin-top: 8px; max-width: 520px; }
.danger-row { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.chip-x { border: 0; background: none; padding: 0 0 0 2px; color: inherit; cursor: pointer; display: inline-flex; opacity: .7; }
.chip-x:hover { opacity: 1; }
.address-window.created { margin-top: 14px; animation: rise .3s var(--ease-out); }
.relay-chip { color: var(--ink-2); }
.relay-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.from-note { display: flex; gap: 7px; align-items: center; margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.from-preview { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.invite-link .address-text { overflow-wrap: anywhere; font-family: var(--mono); font-size: 13px; }
.invite-actions { margin: 10px 0 6px; }
.invite-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.invite-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--rule); }
.invite-list li:first-child { border-top: 0; }

/* A switch is a highlighter mark that slides on. */
.switch {
    position: relative; flex-shrink: 0; width: 38px; height: 22px; border-radius: 99px; border: 1px solid var(--rule-strong);
    background: var(--sheet-2); cursor: pointer; padding: 0; transition: background .2s, border-color .2s;
}
.switch span {
    position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet);
    box-shadow: 0 1px 2px rgba(19, 32, 42, .3), inset 0 0 0 1px var(--rule-strong); transition: transform .22s var(--ease-marker), background .2s;
}
.switch[aria-checked="true"] { background: var(--hl); border-color: var(--hl); }
.switch[aria-checked="true"] span { transform: translateX(16px); background: var(--ink-fixed); box-shadow: none; }

/* ---------- search ---------- */

/* Matches are marked with the highlighter, like everything else that needs attention. */
mark { background: linear-gradient(transparent 12%, var(--hl-soft) 12%, var(--hl-soft) 88%, transparent 88%); color: inherit; padding: 0 1px; border-radius: 2px; }
.mail-row mark, .search-pop mark { font-weight: inherit; }
.searchbox.open input { border-color: var(--ink) !important; background: var(--sheet) !important; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.search-pop {
    position: absolute; left: 0; right: 0; top: calc(100% - 1px); z-index: 80; max-height: min(70vh, 560px); overflow-y: auto;
    background: var(--sheet); border: 1px solid var(--ink); border-top-color: var(--rule); border-radius: 0 0 var(--r-float) var(--r-float);
    box-shadow: var(--shadow-float); animation: pop-down .16s var(--ease-out); transform-origin: top;
}
@keyframes pop-down { from { opacity: 0; transform: scaleY(.96); } }
.pop-head { padding: 12px 14px 4px; color: var(--muted); font-size: 12.5px; }
.op-help { list-style: none; margin: 0; padding: 4px 6px 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 8px; }
.op-help li { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: var(--r-control); cursor: pointer; min-width: 0; }
.op-help li:hover { background: var(--sheet-2); }
.op-help code { font-family: var(--mono); font-size: 12px; color: var(--ink); background: var(--sheet-2); border: 1px solid var(--rule); border-radius: var(--r-label); padding: 0 5px; white-space: nowrap; }
.op-help span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-hit { padding: 9px 14px; border-bottom: 1px solid var(--rule); cursor: pointer; }
.pop-hit.active, .pop-all.active { background: var(--hl-wash); box-shadow: inset 3px 0 0 var(--hl); }
.pop-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.pop-top strong { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-top .date { color: var(--faint); font-size: 12px; font-stretch: var(--narrow); white-space: nowrap; }
.pop-subject { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-snippet { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-all { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.pop-all span:first-of-type { flex: 1; }
.pop-status { padding: 7px 14px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--rule); background: var(--sheet-2); }
.search-bar { padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; background: var(--sheet); }
.search-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.refine { cursor: pointer; border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 560; padding: 3px 10px; animation: none; transition: background .15s, border-color .15s; }
.chip.refine:hover { border-color: var(--ink); }
.chip.refine.on { background: var(--hl); border-color: var(--hl); color: var(--on-hl); }
.index-progress { width: 100%; height: 3px; appearance: none; border: 0; background: var(--rule); }
.index-progress::-webkit-progress-bar { background: var(--rule); }
.index-progress::-webkit-progress-value { background: var(--hl); transition: width .3s; }
.index-progress::-moz-progress-bar { background: var(--hl); }

/* ---------- command palette ---------- */

.palette-backdrop { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; animation: fade .14s; }
.palette {
    width: min(620px, calc(100vw - 32px)); background: var(--sheet); border-radius: var(--r-float); box-shadow: var(--shadow-float);
    overflow: hidden; animation: palette-in .2s var(--ease-out); transform-origin: 50% 0;
}
@keyframes palette-in { from { opacity: 0; transform: translateY(-8px) scale(.97); } }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--rule); }
.palette-input .icon { color: var(--faint); }
.palette-input input { border: 0 !important; box-shadow: none !important; height: 54px; font-size: 16px; background: transparent !important; padding: 0 !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.palette-group { padding: 10px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.palette-item { position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border-radius: var(--r-control); cursor: pointer; color: var(--ink-2); }
.palette-item.active { background: var(--hl-wash); color: var(--ink); box-shadow: inset 3px 0 0 var(--hl); }
.palette-item .icon { color: var(--muted); }
.palette-item .hint { margin-left: auto; display: flex; gap: 3px; }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--rule); color: var(--faint); font-size: 12px; background: var(--sheet-2); }

/* ---------- toasts ---------- */

.toasts { position: fixed; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(440px, calc(100% - 40px)); }
.toast {
    display: flex; align-items: center; gap: 10px; background: var(--ink-fixed); color: #e2e9ee; padding: 9px 8px 9px 14px;
    border-radius: var(--r-sheet); box-shadow: var(--shadow-float); animation: toast-in .3s var(--ease-out); font-size: 13.5px;
    border-left: 4px solid var(--hl);
}
.toast .icon { color: var(--hl); }
.toast.error { border-left-color: #ef6a5e; }
.toast.error .icon { color: #ef6a5e; }
.toast .msg { flex: 1; }
.toast .btn.small { background: transparent; border-color: rgba(255, 194, 26, .5); color: var(--hl); }
.toast .btn.small:hover { background: rgba(255, 194, 26, .12); border-color: var(--hl); }
.toast .icon-btn { color: #8b9daa; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fafbfb; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-24px); } }

/* Undo send: a highlighter line along the bottom runs out as the hold does. */
.toast.countdown { position: relative; overflow: hidden; }
.toast.countdown::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--hl);
    transform-origin: left center; animation: countdown linear forwards;
}
.toast.countdown.s5::after { animation-duration: 5s; }
.toast.countdown.s10::after { animation-duration: 10s; }
.toast.countdown.s15::after { animation-duration: 15s; }
.toast.countdown.s20::after { animation-duration: 20s; }
.toast.countdown.s30::after { animation-duration: 30s; }
@keyframes countdown { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
    .toast.countdown::after { animation: none; }
}
@media (max-width: 640px) {
    /* On a phone only the newest two fit without covering the page. */
    .toast:not(.countdown):nth-last-child(n+3) { display: none; }
}

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 20px; background: var(--warn-soft); color: var(--ink); z-index: 1000; border-top: 3px solid var(--warn); }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 10px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
    .auth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .auth-hero { padding: 18px 24px; gap: 0; }
    .auth-hero-foot { display: none; }
}
@media (max-width: 960px) {
    .mail-layout { grid-template-columns: minmax(0, 1fr); }
    .mail-layout.reading .mail-list-pane { display: none; }
    .mail-layout:not(.reading) .reader-pane { display: none; }
    .reader-toolbar .back { display: inline-flex; }
    .reader { padding: 0 12px 40px; }
    .reader-toolbar { margin: 0 -12px 14px; padding: 0 8px; }
    .sheet-head, .reader-meta, .message-body { padding-left: 18px; padding-right: 18px; }
    .attachments { padding: 0 18px 20px; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { position: static; display: flex; overflow-x: auto; }
}
@media (max-width: 760px) {
    .app-shell, .app-shell.rail { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-102%); transition: transform .26s var(--ease-out); }
    .nav-open .sidebar { transform: none; box-shadow: var(--shadow-float); }
    .nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; animation: fade .2s; }
    .topbar { padding: 0 8px; }
    .topbar .mobile-only { display: inline-flex; }
    .searchbox .kbd-hint { display: none; }
    .op-help { grid-template-columns: minmax(0, 1fr); }
    .relay-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .relay-detail { padding-left: 16px; }
    .relay-filter { max-width: none; margin-left: 0; }
    .search-pop { position: fixed; left: 8px; right: 8px; top: 56px; border-radius: var(--r-float); }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .compose-dock { right: 0; width: 100%; }
    .compose { max-height: 100vh; height: 100vh; border-radius: 0; }
    .page { padding: 20px 16px 40px; }
    .row-actions { display: none !important; }
    .desktop-only { display: none !important; }
    .reader-subject { font-size: 21px; }
    .reader-toolbar { overflow-x: auto; scrollbar-width: none; }
    .reader-toolbar .sep { display: none; }
    .reader-toolbar select.move { max-width: 112px; flex-shrink: 0; }
    .reader-meta > .row { width: 100%; justify-content: space-between; }
    .security-strip .badge-sec:not(.ok):not(.bad):not(.warn) { font-size: 12px; }
    .public-shell .auth-card { padding: 26px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; }
    .unveil { display: none; }
    .boot-bar::after { animation: none; width: 100%; }
}

/* ---------- recovery ---------- */

/* An emailed code is typed once, by eye, from another app: big, spaced digits. */
.code-field { font-family: var(--mono); font-size: 24px; letter-spacing: .28em; text-align: center; padding: 12px 10px; font-variant-numeric: tabular-nums; }
.code-field.compact { font-size: 16px; letter-spacing: .2em; width: 13ch; padding: 7px 10px; }
.code-field::placeholder { color: var(--faint); }
.auth-card .hint { font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; background: linear-gradient(transparent 58%, var(--hl-soft) 58%); padding: 0 2px; }
.options-list { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.options-list li { display: flex; gap: 10px; align-items: flex-start; }
.options-list .icon { color: var(--slate); margin-top: 2px; flex: none; }
.auth-card .check { margin-bottom: 14px; }

.recovery-address { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-sheet); margin-bottom: 6px; }
.recovery-address > .icon { color: var(--slate); }
.recovery-address strong { overflow-wrap: anywhere; }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.setting-row + .sub-head { margin-top: 18px; }
.sub-head { font-size: 14px; font-weight: 650; margin: 18px 0 4px; }
.sub-head + .muted { margin-bottom: 6px; }
.card .passkey-list { margin-top: 10px; }

.locked-mail { border-left: 3px solid var(--warn); }
.locked-mail .segmented { margin-bottom: 10px; }
.unlock-row input { min-width: 220px; }
.progress-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); padding: 6px 0; }
.progress-line .spinner { width: 16px; height: 16px; border-width: 2px; }
.locked-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px; font-size: 13px; background: var(--warn-soft); border-left: 3px solid var(--warn); border-radius: 0 var(--r-control) var(--r-control) 0; }
.locked-banner .icon { color: var(--warn); flex: none; }
.locked-banner a { margin-left: auto; font-weight: 600; white-space: nowrap; }

/* ---------- sign-in locations ---------- */

#sign-in-countries .here { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; }
#sign-in-countries .here .icon { color: var(--slate); }
.country-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; padding: 0; }
.country-chips li {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 2px 2px 10px; font-size: 13px; font-weight: 560;
    border: 1px solid var(--rule-strong); border-radius: var(--r-control); background: var(--sheet-2);
}
.country-chips .flag { font-size: 15px; line-height: 1; }
.country-chips .icon-btn { width: 24px; height: 24px; }
#sign-in-countries .save-row { margin-top: 12px; }
.muted.tiny { font-size: 11.5px; margin: 14px 0 0; }
.muted.tiny a { color: inherit; }

/* ---------- API keys ---------- */

.new-key { border: 1px solid var(--rule); border-left: 3px solid var(--hl); border-radius: 0 var(--r-sheet) var(--r-sheet) 0; padding: 14px 16px; margin-bottom: 14px; }
.new-key .recovery-key { margin: 10px 0; }
.code-sample {
    font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--ink-fixed); color: #e2e9ee; padding: 12px 14px;
    border-radius: var(--r-control); overflow-x: auto; white-space: pre; margin: 6px 0 0;
}
.scope-list { border: 0; margin: 14px 0 6px; padding: 0; display: grid; gap: 4px; }
.scope-list legend { font-size: 13px; font-weight: 650; margin-bottom: 6px; padding: 0; }
.scope-list .check { align-items: flex-start; margin: 0; }
.scope-list .check input { margin-top: 3px; }
.scope-list .check .muted { font-size: 13px; }
.api-key-list { margin-top: 16px; }
.api-key-list li { align-items: flex-start; }
.api-key-list li > .icon { margin-top: 2px; }
.api-key-list li.expired { opacity: .6; }
.key-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scope-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 5px 0 4px; }
.table.activity { width: 100%; margin: 10px 0 2px; font-size: 12px; }
.table.activity td.mono { font-size: 11.5px; word-break: break-all; }
.table.activity td:first-child, .table.activity td:last-child { white-space: nowrap; word-break: normal; }

/* ---------- filters ---------- */

.card-title-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 8px; }
.card-title-row h2 { margin: 0; }
.rules-empty p { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; }
.rule-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.rule-list { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: rule; }
.rule-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 11px 0; border-top: 1px solid var(--rule); }
.rule-item:last-child { border-bottom: 1px solid var(--rule); }
.rule-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rule-text strong { font-size: 14px; }
.rule-text .muted { overflow-wrap: anywhere; }
.rule-item.off .rule-text { opacity: .5; }
.rule-actions { display: flex; gap: 2px; }
.rule-actions .icon-btn { width: 30px; height: 30px; }
.dimmed { opacity: .55; }
.away-state.on { background: linear-gradient(transparent 12%, var(--hl-soft) 12%, var(--hl-soft) 88%, transparent 88%); color: var(--ink); font-weight: 600; padding: 0 2px; }
.block-form { margin-bottom: 12px; }
.block-form input { flex: 1; min-width: 0; }
.blocked-list { list-style: none; margin: 0; padding: 0; }
.blocked-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--rule); }
.blocked-list li .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }

.rule-part { border: 0; margin: 4px 0 14px; padding: 0; display: grid; gap: 8px; }
.rule-part legend { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 0; margin-bottom: 6px; }
.rule-part .btn { justify-self: start; }
.rule-part p { margin: 0; }
.rule-part label.check { margin-bottom: 0; }
select.inline-select { width: auto; padding: 3px 26px 3px 8px; font-size: 13px; }
.cond-row { display: grid; grid-template-columns: 128px 138px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.cond-row.no-value { grid-template-columns: 128px minmax(0, 1fr) auto; }
.action-row { display: flex; align-items: center; gap: 10px; }
.action-row label.check { margin: 0; white-space: nowrap; }
.action-row select { flex: 1; min-width: 0; }
.rule-try { margin: 2px 0 14px; padding: 12px 14px; background: var(--sheet-2); border-radius: var(--r-control); }
.try-result { margin-top: 10px; font-size: 13.5px; animation: rise .25s var(--ease-out); }
.try-result ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.try-result li { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.try-result .who { color: var(--ink); font-weight: 600; margin-right: 4px; }

@media (max-width: 640px) {
    .rule-item { grid-template-columns: auto minmax(0, 1fr); }
    .rule-actions { grid-column: 2; }
    .cond-row, .cond-row.no-value { grid-template-columns: 1fr 1fr auto; }
    .cond-row input { grid-column: 1 / 3; }
}

/* ---------- conversations ---------- */

.thread-count {
    flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--sheet-2); border: 1px solid var(--rule);
    font-size: 11px; font-weight: 650; line-height: 16px; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.thread-stack { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 0; }
.thread-stack.after { margin: 10px 0 0; }
.thread-item { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); }
.thread-item + .thread-item { margin-top: -1px; }
.thread-stack .thread-item:not(:first-child):not(:last-child) { border-radius: 0; }
.thread-stack .thread-item:first-child:not(:last-child) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.thread-stack .thread-item:last-child:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: 0; }
.thread-head {
    display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 9px 14px;
    background: none; border: 0; cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.thread-head:hover { background: var(--sheet-2); }
.thread-head .who { font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.thread-head .snip { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.thread-head .tag { font-size: 11px; }
.thread-body { padding: 2px 16px 14px 56px; animation: rise .2s var(--ease-out); }
.thread-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; max-height: 420px; overflow-y: auto; margin-bottom: 6px; }
@media (max-width: 640px) {
    .thread-head { grid-template-columns: auto minmax(0, 1fr) auto; }
    .thread-head .snip, .thread-head .tag { display: none; }
    .thread-body { padding-left: 16px; }
}

/* ---------- large files ---------- */

progress { appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--sheet-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--sheet-2); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--hl); border-radius: 3px; transition: width .2s; }
progress::-moz-progress-bar { background: var(--hl); border-radius: 3px; }
.attachment.uploading progress { display: block; width: 150px; margin-top: 5px; }
.attachment.large .file-icon { color: var(--slate); }
.file-card .file-name { overflow-wrap: anywhere; font-size: 22px; }
.file-card progress { margin: 4px 0 2px; }

/* ---------- import & export ---------- */

.folder-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 14px; margin: 4px 0 14px; }
.folder-picks label.check { margin: 0; padding: 4px 0; }
.import-check { display: flex; align-items: flex-end; padding-bottom: 14px; }
#export progress, #import progress { margin: 4px 0 2px; }
.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- offline ---------- */

.offline-banner { display: none; }
/* At the top, under the toolbar: the bottom belongs to the composer's Send button and to toasts. It's a
   notice, so taps go through it. */
html.offline .offline-banner {
    display: flex; justify-content: center; position: fixed; z-index: 200; left: 50%; top: calc(62px + env(safe-area-inset-top)); transform: translateX(-50%);
    pointer-events: none; max-width: calc(100vw - 24px); text-align: center;
    padding: 8px 16px; border-radius: 99px; background: var(--ink-fixed); color: #fff; font-size: 13px; box-shadow: var(--shadow-float);
    animation: rise .25s var(--ease-out);
}

/* ---------- safety numbers ---------- */

.safety { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.safety-number {
    display: grid; grid-template-columns: repeat(3, auto); gap: 6px 16px; font-family: var(--mono); font-size: 19px; letter-spacing: .04em;
    font-variant-numeric: tabular-nums; padding: 14px 18px; background: var(--sheet-2); border-radius: var(--r-sheet); border-left: 3px solid var(--hl);
}
.safety-qr { border-radius: var(--r-control); image-rendering: pixelated; background: #fff; }
.scan-view { display: none; width: 220px; height: 220px; object-fit: cover; border-radius: var(--r-sheet); background: var(--ink-fixed); }
.scan-view.on { display: block; }
.verified-note { display: flex; align-items: center; gap: 7px; color: var(--ok); font-weight: 600; font-size: 13.5px; }
.tag.verified { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.callout.ok { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--sheet)); }
.callout.ok .icon { color: var(--ok); }

details.rotate-keys { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
details.rotate-keys summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
details.rotate-keys[open] summary { margin-bottom: 6px; }

/* OpenPGP */
.openpgp-card .check { margin: 10px 0; }
.pgp-fingerprint { letter-spacing: .02em; word-spacing: .2em; }
details.pgp-import { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
details.pgp-import summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
details.pgp-import textarea, .pgp-contact textarea { width: 100%; font-family: var(--mono); font-size: 12px; margin: 6px 0; }
.pgp-contact { border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: 10px 12px; }
.pgp-contact legend { font-weight: 650; font-size: 13px; padding: 0 6px; }
.pgp-contact .mono { margin-right: 8px; }
.callout.pgp-error { margin-bottom: 12px; }

/* ---------- notifications ---------- */

.push-here .callout { margin-bottom: 14px; }
.push-here .callout strong { display: block; margin-bottom: 2px; }
.steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 3px; }
/* Settings › Mail apps: three numbered steps, each with its own action. */
.bridge-steps { margin: 14px 0 10px; padding-left: 22px; display: grid; gap: 16px; }
.bridge-steps > li > strong { display: block; margin-bottom: 4px; }
.bridge-steps .muted.small { margin: 4px 0 8px; }
.bridge-downloads { margin: 6px 0 4px; }
.bridge-key-form { align-items: flex-end; }
.bridge-key-form label { margin: 0; min-width: 220px; }
.push-on-mark { width: 36px; height: 36px; border-radius: 50%; background: var(--hl); color: var(--ink-fixed); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.push-actions { margin-top: 12px; }
.indent-note { margin: -4px 0 6px; }
.preview-seg { flex-wrap: wrap; margin: 2px 0 8px; }
.quiet-hours { padding: 12px 0 2px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.quiet-hours label:not(.check) { margin-bottom: 10px; }
.quiet-hours input[type=time] { width: 9em; }
.day-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.day-chips .chip { min-width: 46px; justify-content: center; }
#notify-what > .btn.primary { margin-top: 6px; }
.device-list .tag { font-size: 11px; }
.device-error { display: flex; align-items: center; gap: 5px; color: var(--stamp); margin-top: 2px; }
.device-list form input { max-width: 260px; height: 30px; }
html.standalone .install-entry, html.app-installed .install-entry { display: none !important; }

/* ---------- installing the app ---------- */

.install-backdrop { position: fixed; inset: 0; z-index: 140; background: var(--scrim); animation: fade .18s; }
.install-sheet {
    position: fixed; z-index: 141; background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-float); padding: 20px 20px 14px;
    width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; outline: none;
}
.install-sheet.center { left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: var(--r-float); animation: palette-in .2s var(--ease-out); }
/* Phones: a sheet from the bottom, above the safe area (and above the arrow pointing at the browser's toolbar). */
.install-sheet.bottom {
    left: 0; right: 0; bottom: 0; width: auto; margin: 0 auto; max-width: 560px; border-radius: var(--r-float) var(--r-float) 0 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)); animation: sheet-up .28s var(--ease-out);
}
.install-sheet.bottom.has-arrow { bottom: calc(58px + env(safe-area-inset-bottom)); left: 10px; right: 10px; border-radius: var(--r-float); padding-bottom: 14px; }
/* iPad: Share sits at the top right, so the instructions hang from there. */
.install-sheet.popover { top: calc(64px + env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); border-radius: var(--r-float); animation: pop-down .2s var(--ease-out); transform-origin: top right; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.install-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.install-head h2 { margin: 2px 0 4px; font-size: 18px; }
.install-head p { margin: 0; line-height: 1.45; }
.install-head .icon-btn { margin: -6px -8px 0 0; }
.install-icon { border-radius: 12px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(19, 32, 42, .25); }
.install-perks { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.install-perks li { display: flex; gap: 10px; align-items: center; }
.install-perks .icon { color: var(--slate); }
.install-steps { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 2px; counter-reset: none; }
.install-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule); font-size: 14.5px; line-height: 1.4; }
.install-steps li:first-child { border-top: 0; }
.step-n { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--sheet); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.step-key { width: 38px; height: 38px; border-radius: 10px; background: var(--sheet-2); border: 1px solid var(--rule); color: #0a7aff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
:root[data-theme="dark"] .step-key { color: #4da3ff; }
/* A drawing of the "Open as Web App" switch, on. */
.step-key.toggle span { position: relative; width: 26px; height: 16px; border-radius: 8px; background: #34c759; }
.step-key.toggle span::after { content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; }
.step-text strong { font-weight: 680; }
.install-note { color: var(--muted); margin: 6px 0 10px; line-height: 1.45; }
.install-foot { display: flex; align-items: center; gap: 8px; padding-top: 6px; }
.install-sheet .btn.block { margin-bottom: 4px; }

/* The arrow points at the button in the browser's own toolbar, outside the page. */
.install-arrow { position: fixed; z-index: 142; color: var(--hl); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)); pointer-events: none; }
.install-arrow.bottom-center { left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); margin-left: -15px; animation: point-down 1.1s var(--ease) infinite; }
.install-arrow.bottom-right { right: 18px; bottom: calc(10px + env(safe-area-inset-bottom)); animation: point-down 1.1s var(--ease) infinite; }
.install-arrow.top-right { right: 22px; top: calc(14px + env(safe-area-inset-top)); animation: point-up 1.1s var(--ease) infinite; }
@keyframes point-down { 50% { transform: translateY(8px); } }
@keyframes point-up { 50% { transform: translateY(-8px); } }

.install-banner {
    position: fixed; z-index: 120; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); width: min(420px, calc(100vw - 40px));
    display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; background: var(--ink-fixed); color: #fafbfb;
    border-radius: var(--r-float); box-shadow: var(--shadow-float); animation: rise .3s var(--ease-out);
}
.install-banner img { border-radius: 9px; flex-shrink: 0; }
.install-banner .small { color: #9fb0bd; line-height: 1.4; }
.install-banner .icon-btn { color: #9fb0bd; }
.install-banner .icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fafbfb; }

@media (prefers-reduced-motion: reduce) {
    .install-arrow { animation: none !important; }
    .install-sheet, .install-banner, .install-backdrop { animation: none !important; }
}

/* Files dragged over the composer. */
.compose { position: relative; }
.compose.drop-active::after {
    content: attr(data-drop-hint); position: absolute; inset: 6px; z-index: 5; display: flex; align-items: center; justify-content: center;
    border: 2px dashed var(--hl); border-radius: var(--r-float); background: color-mix(in srgb, var(--sheet) 88%, transparent);
    font-weight: 650; font-size: 15px; color: var(--ink); pointer-events: none;
}

/* ---------- the installed app: notches, touch and the page itself ---------- */

/* No rubber-band bounce or pull-to-refresh on the page (it's an app, not a document); lists and panels
   still scroll, and stop at their ends instead of dragging the page with them. */
html, body { overscroll-behavior: none; }
.mail-list, .reader-pane, .page, .sidebar, .compose-body, .palette-list, .search-pop, .thread-text, .day-panel { overscroll-behavior: contain; }

/* Safe areas (viewport-fit=cover): nothing important under the notch, the rounded corners or the home indicator. */
.topbar { height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); padding-right: calc(14px + env(safe-area-inset-right)); }
.sidebar {
    padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-left: calc(10px + env(safe-area-inset-left));
}
.app-main { padding-right: 0; }
.mail-list { padding-bottom: env(safe-area-inset-bottom); }
.reader { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.page { padding-bottom: calc(64px + env(safe-area-inset-bottom)); padding-right: calc(36px + env(safe-area-inset-right)); }
.toasts { bottom: calc(20px + env(safe-area-inset-bottom)); left: calc(20px + env(safe-area-inset-left)); }
.compose-dock { right: calc(24px + env(safe-area-inset-right)); }
.palette-backdrop { padding-top: calc(14vh + env(safe-area-inset-top)); }

/* "A new version is ready" (boot.js): above everything, clear of the home indicator. */
.update-toast {
    position: fixed; z-index: 300; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    width: min(520px, calc(100vw - 24px)); display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px;
    background: var(--ink-fixed); color: #e2e9ee; border-left: 4px solid var(--hl); border-radius: var(--r-sheet);
    box-shadow: var(--shadow-float); font-size: 13.5px; line-height: 1.4; animation: rise .3s var(--ease-out);
}
.update-toast span { flex: 1; }
.update-toast .btn.ghost { color: #9fb0bd; }
.update-toast .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fafbfb; }

/* App chrome isn't text to select, and taps don't flash grey; message text and inputs stay selectable. */
.sidebar, .topbar, .settings-nav, .segmented, .reader-toolbar, .compose-header, .compose-footer, .bulkbar, .list-header,
.mail-row, .toast, .install-banner, .install-sheet .install-foot, .cal-head, .btn, .icon-btn, .folder, .chip.refine, .switch {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
a, button, label, summary, .mail-row, .folder { -webkit-tap-highlight-color: transparent; }
/* No double-tap zoom delay on controls; pinch zoom stays allowed. */
a, button, input, select, textarea, label, summary, .mail-row { touch-action: manipulation; }

/* Phones and tablets zoom into fields with text under 16px: keep them at 16px there. */
@media (pointer: coarse) {
    input:not([type=checkbox]):not([type=radio]), select, textarea, .compose-rich, .compose-text { font-size: 16px; }
    .searchbox input { font-size: 16px; }
}

@media (max-width: 760px) {
    .topbar { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); }
    .sidebar { width: calc(280px + env(safe-area-inset-left)); }
    .page { padding: 20px calc(16px + env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
    .search-pop { top: calc(56px + env(safe-area-inset-top)); }
    .compose-dock { right: 0; }
    .compose { padding-bottom: env(safe-area-inset-bottom); }
    .compose-header { height: calc(42px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
    .install-banner { left: 12px; right: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* In the installed app there's no browser around it. */
html.standalone body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html.standalone .reader-toolbar .back { display: inline-flex; }
@media (min-width: 961px) {
    html.standalone .reader-toolbar .back { display: none; }
}

/* ---------- forwarding ---------- */

.forward-form { margin: 6px 0 4px; align-items: end; }
#forwarding select { max-width: 360px; }
.reply-bar { flex-wrap: wrap; }
@media (max-width: 640px) {
    #notify-what .setting-row:has(.segmented) { flex-wrap: wrap; }
    #notify-what .setting-row .segmented { margin-top: 0; }
    .install-sheet.center { width: calc(100vw - 24px); }
}
