/* ZXO Mail — Gmail-style shell (2026-11-24). One stylesheet for the whole page.
   Light by default; dark via prefers-color-scheme or [data-theme=dark]. No external resources. */

@font-face { font-family: Roboto; src: url('assets/roboto-latin-variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Material Symbols Outlined'; src: url('assets/material-symbols-outlined.woff2') format('woff2'); font-weight: 400; font-display: block; }

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f2f6fc;
  --surface-3: #e9eef6;
  --surface-menu: #ffffff;
  --text: #1f1f1f;
  --text-2: #444746;
  --text-3: #5f6368;
  --primary: #0b57d0;
  --on-primary: #ffffff;
  --primary-container: #c2e7ff;
  --on-primary-container: #001d35;
  --nav-active: #d3e3fd;
  --nav-active-text: #041e49;
  --hover: rgba(68, 71, 70, .08);
  --hover-strong: rgba(68, 71, 70, .14);
  --row-read: #f2f6fc;
  --row-unread: #ffffff;
  --row-selected: #c2dbff;
  --row-active: #e8f0fe;
  --divider: #eceff1;
  --border: #dadce0;
  --outline: #747775;
  --star: #f4b400;
  --danger: #b3261e;
  --danger-container: #fce8e6;
  --success: #137333;
  --snoozed: #8a4a00;
  --woke-bg: #feefe3;
  --woke-fg: #9c4400;
  --chip: #ffffff;
  --snackbar: #323232;
  --snackbar-text: #f2f2f2;
  --snackbar-action: #a8c7fa;
  --frame-bg: #ffffff;
  --shadow-1: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-2: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);
  --shadow-3: 0 4px 8px 3px rgba(60, 64, 67, .15), 0 1px 3px rgba(60, 64, 67, .3);
  --row-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --row-h: 40px;
  --font: Roboto, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}
/* Dark palettes are screen-only, so printing always uses the light tokens (and the print block below). */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1f1f1f; --surface: #2d2e30; --surface-2: #26272a; --surface-3: #3c3d40; --surface-menu: #303134;
    --text: #e3e3e3; --text-2: #c4c7c5; --text-3: #9aa0a6;
    --primary: #a8c7fa; --on-primary: #062e6f; --primary-container: #004a77; --on-primary-container: #c2e7ff;
    --nav-active: #004a77; --nav-active-text: #d3e3fd;
    --hover: rgba(227, 227, 227, .08); --hover-strong: rgba(227, 227, 227, .14);
    --row-read: #26272a; --row-unread: #2d2e30; --row-selected: #394457; --row-active: #303c4f;
    --divider: #3c4043; --border: #5f6368; --outline: #8e918f;
    --star: #fdd663; --danger: #f2b8b5; --danger-container: #601410; --success: #81c995; --chip: #3c3d40;
    --snoozed: #fcad70; --woke-bg: #614a19; --woke-fg: #fedfc8;
    --snackbar: #e3e3e3; --snackbar-text: #1f1f1f; --snackbar-action: #0b57d0;
    --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, .6), 0 1px 3px 1px rgba(0, 0, 0, .3);
    --shadow-2: 0 1px 3px 0 rgba(0, 0, 0, .6), 0 4px 8px 3px rgba(0, 0, 0, .3);
    --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .6);
    --row-shadow: inset 1px 0 0 #5f6368, inset -1px 0 0 #5f6368, 0 1px 3px 0 rgba(0, 0, 0, .6);
  }
}
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1f1f1f; --surface: #2d2e30; --surface-2: #26272a; --surface-3: #3c3d40; --surface-menu: #303134;
    --text: #e3e3e3; --text-2: #c4c7c5; --text-3: #9aa0a6;
    --primary: #a8c7fa; --on-primary: #062e6f; --primary-container: #004a77; --on-primary-container: #c2e7ff;
    --nav-active: #004a77; --nav-active-text: #d3e3fd;
    --hover: rgba(227, 227, 227, .08); --hover-strong: rgba(227, 227, 227, .14);
    --row-read: #26272a; --row-unread: #2d2e30; --row-selected: #394457; --row-active: #303c4f;
    --divider: #3c4043; --border: #5f6368; --outline: #8e918f;
    --star: #fdd663; --danger: #f2b8b5; --danger-container: #601410; --success: #81c995; --chip: #3c3d40;
    --snoozed: #fcad70; --woke-bg: #614a19; --woke-fg: #fedfc8;
    --snackbar: #e3e3e3; --snackbar-text: #1f1f1f; --snackbar-action: #0b57d0;
    --shadow-1: 0 1px 2px 0 rgba(0, 0, 0, .6), 0 1px 3px 1px rgba(0, 0, 0, .3);
    --shadow-2: 0 1px 3px 0 rgba(0, 0, 0, .6), 0 4px 8px 3px rgba(0, 0, 0, .3);
    --shadow-3: 0 4px 8px 3px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .6);
    --row-shadow: inset 1px 0 0 #5f6368, inset -1px 0 0 #5f6368, 0 1px 3px 0 rgba(0, 0, 0, .6);
  }
}

/* Label colors: dot, chip background, chip text */
.lc-gray { --lc-dot: #5f6368; --lc-bg: #e8eaed; --lc-fg: #3c4043; }
.lc-red { --lc-dot: #d93025; --lc-bg: #fce8e6; --lc-fg: #a50e0e; }
.lc-orange { --lc-dot: #e8710a; --lc-bg: #feefe3; --lc-fg: #9c4400; }
.lc-yellow { --lc-dot: #f9ab00; --lc-bg: #fef7e0; --lc-fg: #6d5200; }
.lc-green { --lc-dot: #1e8e3e; --lc-bg: #e6f4ea; --lc-fg: #0d652d; }
.lc-teal { --lc-dot: #12a4af; --lc-bg: #e4f7fb; --lc-fg: #00666d; }
.lc-blue { --lc-dot: #1a73e8; --lc-bg: #e8f0fe; --lc-fg: #174ea6; }
.lc-purple { --lc-dot: #9334e6; --lc-bg: #f3e8fd; --lc-fg: #681da8; }
.lc-pink { --lc-dot: #e52592; --lc-bg: #fde7f3; --lc-fg: #99124f; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lc-gray { --lc-dot: #bdc1c6; --lc-bg: #3c4043; --lc-fg: #e8eaed; }
  :root:not([data-theme="light"]) .lc-red { --lc-dot: #f28b82; --lc-bg: #5c2b29; --lc-fg: #fad2cf; }
  :root:not([data-theme="light"]) .lc-orange { --lc-dot: #fcad70; --lc-bg: #614a19; --lc-fg: #fedfc8; }
  :root:not([data-theme="light"]) .lc-yellow { --lc-dot: #fdd663; --lc-bg: #5b5015; --lc-fg: #feefc3; }
  :root:not([data-theme="light"]) .lc-green { --lc-dot: #81c995; --lc-bg: #1e4620; --lc-fg: #ceead6; }
  :root:not([data-theme="light"]) .lc-teal { --lc-dot: #78d9ec; --lc-bg: #16504b; --lc-fg: #cbf0f8; }
  :root:not([data-theme="light"]) .lc-blue { --lc-dot: #8ab4f8; --lc-bg: #1e3a5f; --lc-fg: #d2e3fc; }
  :root:not([data-theme="light"]) .lc-purple { --lc-dot: #d7aefb; --lc-bg: #42275e; --lc-fg: #e9d2fd; }
  :root:not([data-theme="light"]) .lc-pink { --lc-dot: #ff8bcb; --lc-bg: #5b2245; --lc-fg: #fdcfe8; }
}
@media screen {
  :root[data-theme="dark"] .lc-gray { --lc-dot: #bdc1c6; --lc-bg: #3c4043; --lc-fg: #e8eaed; }
  :root[data-theme="dark"] .lc-red { --lc-dot: #f28b82; --lc-bg: #5c2b29; --lc-fg: #fad2cf; }
  :root[data-theme="dark"] .lc-orange { --lc-dot: #fcad70; --lc-bg: #614a19; --lc-fg: #fedfc8; }
  :root[data-theme="dark"] .lc-yellow { --lc-dot: #fdd663; --lc-bg: #5b5015; --lc-fg: #feefc3; }
  :root[data-theme="dark"] .lc-green { --lc-dot: #81c995; --lc-bg: #1e4620; --lc-fg: #ceead6; }
  :root[data-theme="dark"] .lc-teal { --lc-dot: #78d9ec; --lc-bg: #16504b; --lc-fg: #cbf0f8; }
  :root[data-theme="dark"] .lc-blue { --lc-dot: #8ab4f8; --lc-bg: #1e3a5f; --lc-fg: #d2e3fc; }
  :root[data-theme="dark"] .lc-purple { --lc-dot: #d7aefb; --lc-bg: #42275e; --lc-fg: #e9d2fd; }
  :root[data-theme="dark"] .lc-pink { --lc-dot: #ff8bcb; --lc-bg: #5b2245; --lc-fg: #fdcfe8; }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.43 var(--font); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow-wrap: break-word; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .38; }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; font-weight: 400; }
p { margin: 0; }
img { display: block; max-width: 100%; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
kbd { font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 3px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
.material-symbols { font-family: 'Material Symbols Outlined'; font-weight: 400; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; word-wrap: normal; direction: ltr; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; flex-shrink: 0; user-select: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip { position: fixed; top: -80px; left: 16px; z-index: 100; background: var(--surface); color: var(--primary); padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow-2); }
.skip:focus { top: 8px; }

/* ------------------------------------------------------------------ buttons and controls */
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); position: relative; }
.icon-button:hover:not(:disabled) { background: var(--hover); }
.icon-button.small { width: 32px; height: 32px; }
.icon-button.small .material-symbols { font-size: 18px; }
.icon-button.tiny { width: 20px; height: 32px; border-radius: 4px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 24px; border-radius: 20px; background: var(--primary); color: var(--on-primary); font-weight: 500; letter-spacing: .1px; white-space: nowrap; }
.button:hover:not(:disabled) { box-shadow: var(--shadow-1); }
.button.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.button.danger { background: var(--danger); color: var(--surface); }
.text-button, .plain-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 18px; color: var(--primary); font-weight: 500; }
.plain-button { color: var(--text-2); }
.text-button:hover:not(:disabled), .plain-button:hover:not(:disabled) { background: var(--hover); }
.text-button.danger { color: var(--danger); }
.link-button { color: var(--text-2); padding: 4px 6px; border-radius: 4px; }
.link-button:hover { background: var(--hover); text-decoration: underline; }
.pill-button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 20px 0 14px; border: 1px solid var(--outline); border-radius: 18px; color: var(--text-2); font-weight: 500; }
.pill-button:hover:not(:disabled) { background: var(--hover); }
.check-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.small-note, .setting-help, .adv-note, .dialog-note { font-size: 12px; line-height: 1.5; color: var(--text-3); }
.form-error { color: var(--danger); font-size: 13px; }
select { height: 36px; border: 1px solid var(--outline); border-radius: 4px; background: var(--surface); padding: 0 8px; max-width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field > span { font-size: 13px; color: var(--text-2); }
.field input, .field textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--outline); border-radius: 4px; background: var(--surface); }
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

/* ------------------------------------------------------------------ auth */
.auth-view { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 16px; outline: none; }
.auth-card-wrap { width: min(450px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 20px; }
.auth-brand img { width: 32px; height: 32px; }
.auth-brand a { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-company { font-weight: 650; font-size: 20px; line-height: 1; color: var(--text); }
.auth-brand-word { font-size: 22px; color: var(--text-2); }
.language-control { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--text-3); }
.language-control select { height: 32px; border-color: var(--border); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 36px 40px 32px; }
.auth-title { font-size: 32px; line-height: 1.25; margin-bottom: 12px; }
.auth-title span { display: inline; }
.auth-lead { color: var(--text-2); margin-bottom: 8px; }
.auth-note { font-size: 12px; line-height: 1.6; color: var(--text-3); margin-top: 12px; }
.auth-error { color: var(--danger); background: var(--danger-container); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin-top: 16px; outline: none; }
.auth-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
#boot-message { color: var(--text-2); margin-top: 8px; }
#boot-retry { margin-top: 20px; }
.password-account { margin-top: 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; }
.auth-home { display: inline-block; margin: 20px 8px 0; color: var(--text-3); font-size: 13px; }

/* ------------------------------------------------------------------ app frame */
.mail-app { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
/* Explicit rows: hidden banners must not shift the shell out of the flexible row. */
.mail-app > .mail-header { grid-row: 1; }
.mail-app > .provider-banner { grid-row: 2; }
.mail-app > .global-error { grid-row: 3; }
.mail-app > .mail-shell { grid-row: 4; }
.mail-header { display: flex; align-items: center; gap: 8px; height: 64px; padding: 8px 12px 8px 16px; min-width: 0; }
.topbar-start { display: flex; align-items: center; gap: 4px; width: 260px; flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; color: var(--text-2); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand-word { font-size: 22px; line-height: 1; color: var(--text-2); }
.topbar-search { position: relative; flex: 1 1 auto; max-width: 720px; min-width: 0; }
.search-pill { display: flex; align-items: center; height: 48px; padding: 0 4px; border-radius: 24px; background: var(--surface-3); transition: background-color .15s, box-shadow .15s; }
.search-pill:focus-within { background: var(--surface); box-shadow: var(--shadow-1); }
.search-pill input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 16px; padding: 0 4px; }
.search-pill input::-webkit-search-cancel-button { display: none; }
.search-pill input::placeholder { color: var(--text-2); }
.search-pill .icon-button { color: var(--text-2); }
.topbar-end { display: flex; align-items: center; gap: 4px; margin-left: auto; padding-left: 8px; }
.account-avatar { width: 32px; height: 32px; margin: 0 4px 0 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 500; color: #fff; background: #1a73e8; flex-shrink: 0; }
.account-avatar:hover:not(:disabled) { box-shadow: 0 0 0 4px var(--hover-strong); }
.account-avatar.large { width: 80px; height: 80px; font-size: 36px; margin: 8px auto 4px; }

.advanced-search { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 35; background: var(--surface-menu); border-radius: 8px; box-shadow: var(--shadow-3); padding: 20px 24px 16px; display: grid; gap: 8px; max-height: calc(100dvh - 32px); overflow: auto; }
.adv-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 40px; }
.adv-row > label { color: var(--text-2); }
.adv-row input[type=text], .adv-row input[type=date] { width: 100%; height: 36px; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 0 2px; outline: none; }
.adv-row input:focus { border-bottom: 2px solid var(--primary); }
.adv-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adv-inline input[type=date] { width: auto; flex: 1; min-width: 140px; }
.adv-check { grid-template-columns: minmax(0, 1fr); }
.adv-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.provider-banner, .global-error { margin: 0 16px 8px; padding: 8px 16px; border-radius: 8px; font-size: 13px; }
.provider-banner { background: var(--surface-3); color: var(--text-2); }
.global-error { background: var(--danger-container); color: var(--danger); }

.mail-shell { position: relative; display: flex; min-height: 0; min-width: 0; }
.sidebar-veil { display: none; }

/* ------------------------------------------------------------------ sidebar */
.mail-sidebar { width: 256px; flex-shrink: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 4px 0 16px; scrollbar-width: thin; }
/* The sidebar scrolls; its parts (Compose above all) never get squeezed. */
.mail-sidebar > * { flex-shrink: 0; }
.compose-button { align-self: flex-start; display: inline-flex; align-items: center; gap: 12px; height: 56px; min-width: 56px; margin: 4px 0 16px 8px; padding: 0 20px 0 16px; border-radius: 16px; background: var(--primary-container); color: var(--on-primary-container); font-weight: 500; transition: box-shadow .15s; }
.compose-button:hover:not(:disabled) { box-shadow: var(--shadow-2); }
.compose-button .material-symbols { font-size: 24px; }
.folder-nav, .label-nav { padding-right: 16px; }
.label-nav { list-style: none; margin: 0; padding-left: 0; }
.nav-item { display: flex; align-items: center; gap: 18px; height: 32px; padding: 0 12px 0 26px; border-radius: 0 16px 16px 0; color: var(--text-2); text-decoration: none; white-space: nowrap; min-width: 0; }
.nav-item:hover { background: var(--hover); }
.nav-item[aria-current="page"] { background: var(--nav-active); color: var(--nav-active-text); font-weight: 700; }
.nav-item.has-unread { font-weight: 700; color: var(--text); }
.nav-item .material-symbols { font-size: 20px; }
.nav-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.nav-count { margin-left: auto; font-size: 12px; letter-spacing: .3px; }
.nav-divider { height: 1px; margin: 8px 16px 8px 26px; background: var(--divider); }
.label-section { margin-top: 16px; }
.label-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 26px; height: 40px; }
.label-heading h2 { font-size: 16px; font-weight: 500; color: var(--text); }
.label-item { position: relative; display: flex; align-items: center; }
.label-item .nav-item { flex: 1; padding-right: 36px; }
.label-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--lc-dot, #5f6368); flex-shrink: 0; margin: 0 4px; }
.label-more { position: absolute; right: 2px; opacity: 0; }
.label-item:hover .label-more, .label-more:focus-visible, .label-more[aria-expanded="true"] { opacity: 1; }
.label-item:hover .nav-count { visibility: hidden; }
.sidebar-bottom { margin-top: auto; padding-top: 16px; padding-right: 16px; }
.sidebar-bottom .nav-item[href="#settings"] { display: none; }

/* Collapsed rail: desktop toggle only (matches the JS `wide` query); the 761–1023px rail is in the tablet block. */
@media (min-width: 1024px) {
  .mail-shell.sidebar-collapsed .mail-sidebar { width: 72px; }
  .sidebar-collapsed .compose-button { padding: 0; justify-content: center; width: 56px; margin-left: 8px; }
  .sidebar-collapsed .mail-sidebar .nav-text, .sidebar-collapsed .mail-sidebar .nav-count, .sidebar-collapsed .label-heading, .sidebar-collapsed .label-more, .sidebar-collapsed .nav-divider { display: none; }
  .sidebar-collapsed .folder-nav, .sidebar-collapsed .label-nav, .sidebar-collapsed .sidebar-bottom { padding-right: 0; }
  .sidebar-collapsed .nav-item { width: 56px; margin-left: 8px; padding: 0; justify-content: center; border-radius: 16px; position: relative; }
  .sidebar-collapsed .label-item .nav-item { padding: 0; }
  .sidebar-collapsed .nav-item.has-unread::after { content: ''; position: absolute; top: 6px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  .sidebar-collapsed .label-section { margin-top: 8px; }
}

/* ------------------------------------------------------------------ main card and panes */
.mail-main { flex: 1; min-width: 0; display: flex; padding: 0 16px 16px 0; outline: none; }
.main-card { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; overflow: hidden; position: relative; }
.list-view { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; container-type: inline-size; container-name: list; }
.reader-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; container-type: inline-size; container-name: reader; }
.settings-view { display: flex; flex-direction: column; min-height: 0; flex: 1; overflow: auto; }
.mail-shell[data-pane="right"] .main-card { flex-direction: row; }
.mail-shell[data-pane="right"] .list-view { flex: 0 0 44%; min-width: 360px; max-width: 640px; border-right: 1px solid var(--divider); }
.mail-shell[data-pane="below"] .list-view { flex: 0 0 42%; border-bottom: 1px solid var(--divider); }
.mail-shell[data-pane="right"] .settings-view, .mail-shell[data-pane="below"] .settings-view { flex: 1; }

/* list toolbar */
.list-toolbar, .conv-toolbar { display: flex; align-items: center; gap: 2px; height: 48px; padding: 0 8px 0 12px; flex-shrink: 0; min-width: 0; }
.toolbar-group { display: flex; align-items: center; gap: 2px; min-width: 0; }
.toolbar-spacer { flex: 1; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--border); flex-shrink: 0; }
.select-control { display: flex; align-items: center; padding: 0 0 0 8px; border-radius: 4px; height: 36px; margin-right: 6px; }
.select-control:hover { background: var(--hover); }
.selection-count { margin-left: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.list-paging { display: flex; align-items: center; gap: 0; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.page-position { padding: 0 8px; }
.list-progress { height: 3px; margin-top: -3px; background: linear-gradient(90deg, transparent 0, var(--primary) 50%, transparent 100%); background-size: 50% 100%; background-repeat: no-repeat; animation: progress 1.1s linear infinite; flex-shrink: 0; position: relative; z-index: 2; }
@keyframes progress { from { background-position: -100% 0; } to { background-position: 200% 0; } }
.search-header { padding: 8px 16px 8px 24px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--divider); flex-shrink: 0; }
.search-title { font-size: 18px; color: var(--text); }
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--outline); border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13px; background: var(--chip); }
.chip .material-symbols { font-size: 18px; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--nav-active); color: var(--nav-active-text); border-color: transparent; }
.list-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }

/* ------------------------------------------------------------------ list rows */
.message-list { outline: none; }
.row { --row-bg: var(--row-read); position: relative; display: grid; grid-template-columns: 34px 60px minmax(100px, 200px) minmax(0, 1fr) auto minmax(64px, auto); grid-template-areas: "check star from main flags date"; align-items: center; height: var(--row-h); padding: 0 16px 0 10px; background: var(--row-bg); border-bottom: 1px solid var(--divider); cursor: pointer; color: var(--text-2); outline: none; }
.row.unread { --row-bg: var(--row-unread); color: var(--text); }
.row.selected { --row-bg: var(--row-selected); }
.row[aria-current="true"] { --row-bg: var(--row-active); }
/* Secondary text (snippet, count, flags) keeps AA contrast on the darker highlighted backgrounds. */
.row.selected, .row[aria-current="true"] { --text-3: var(--text-2); }
.row:hover { box-shadow: var(--row-shadow); z-index: 1; }
.row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; z-index: 2; }
.row.cursor::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--text-3); }
.cell { min-width: 0; display: flex; align-items: center; }
.cell-check { grid-area: check; justify-content: center; }
.cell-star { grid-area: star; justify-content: center; }
.cell-avatar { grid-area: avatar; display: none; }
.cell-from { grid-area: from; }
.cell-main { grid-area: main; }
.cell-flags { grid-area: flags; }
.cell-date { grid-area: date; }
.star-button { color: var(--text-3); width: 30px; height: 30px; }
.star-button .material-symbols { font-size: 20px; }
.star-button.on { color: var(--star); }
.star-button.on .material-symbols { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.important-button { color: var(--text-3); width: 30px; height: 30px; }
.important-button .material-symbols { font-size: 20px; }
.important-button.on { color: var(--star); }
.important-button.on .material-symbols { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.cell-from { padding-right: 24px; }
.from-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row.unread .from-text .p-unread, .row.unread .from-text > span:only-child, .p-unread { font-weight: 700; color: var(--text); }
.thread-count { margin-left: 4px; font-size: 12px; color: var(--text-3); font-weight: 400; }
.draft-flag { color: var(--danger); }
.cell-main { gap: 6px; overflow: hidden; white-space: nowrap; }
.row-labels { display: inline-flex; gap: 4px; flex-shrink: 0; }
.row-labels:empty { display: none; }
.row-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.row-subject { color: var(--text); }
.row.unread .row-subject { font-weight: 700; }
.row-snippet { color: var(--text-3); }
.row-snippet:not(:empty)::before { content: ' \2014  '; }
.no-snippets .row-snippet { display: none; }
.cell-flags { gap: 4px; padding-left: 8px; color: var(--text-3); }
.row-attachment { font-size: 18px; }
.cell-date { justify-content: flex-end; padding-left: 12px; font-size: 12px; white-space: nowrap; }
.row.unread .row-date { font-weight: 700; color: var(--text); }
.snoozed-date { display: inline-flex; align-items: center; gap: 4px; color: var(--snoozed); font-weight: 500; }
.snoozed-date .material-symbols { font-size: 16px; }
.row-actions { display: none; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); gap: 0; background: var(--row-bg); padding-left: 8px; }
.row:hover .row-actions { display: flex; }
.row:hover .row-date { visibility: hidden; }
@media (hover: none) { .row:hover .row-date { visibility: visible; } }
@media (hover: none) { .row:hover .row-actions { display: none; } }
.label-chip, .status-chip, .woke-chip, .folder-chip { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; max-width: 160px; }
.label-chip { background: var(--lc-bg); color: var(--lc-fg); }
.label-chip-name { overflow: hidden; text-overflow: ellipsis; }
.status-chip, .woke-chip, .folder-chip { background: var(--surface-3); color: var(--text-2); }
.status-chip.failed { background: var(--danger-container); color: var(--danger); }
.woke-chip { background: var(--woke-bg); color: var(--woke-fg); }
.label-chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; color: inherit; margin-right: -2px; }
.label-chip-remove .material-symbols { font-size: 14px; }
.label-chip-remove:hover { background: rgba(0, 0, 0, .12); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; font-weight: 500; flex-shrink: 0; user-select: none; }
.av-0 { background: #1a73e8; } .av-1 { background: #e8710a; } .av-2 { background: #188038; } .av-3 { background: #d93025; }
.av-4 { background: #9334e6; } .av-5 { background: #00796b; } .av-6 { background: #b06000; } .av-7 { background: #c2185b; }
.avatar-selected { background: var(--primary); color: var(--on-primary); font-size: 22px; }
.avatar-button { border-radius: 50%; display: inline-flex; }
.list-empty { padding: 72px 24px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-icon { font-size: 56px; color: var(--border); }
.list-empty h2 { font-size: 18px; color: var(--text-2); }
.list-error { padding: 32px 24px; text-align: center; color: var(--danger); }
.list-error p { margin-bottom: 12px; }
[data-density="compact"] { --row-h: 36px; }
[data-density="comfortable"] { --row-h: 48px; }

/* Narrow list (split panes, phones): stacked rows with avatars */
@container list (max-width: 600px) {
  .row { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "avatar from date" "avatar main star"; height: auto; min-height: 72px; padding: 8px 12px 8px 8px; align-items: start; row-gap: 2px; }
  .cell-check, .cell-flags { display: none; }
  .cell-avatar { display: flex; grid-area: avatar; padding-top: 2px; }
  .cell-from { grid-area: from; padding-right: 8px; font-size: 15px; }
  .cell-date { grid-area: date; padding-left: 8px; }
  .cell-main { grid-area: main; flex-direction: column; align-items: stretch; gap: 2px; }
  .row-line { display: flex; flex-direction: column; }
  .row-subject, .row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row-snippet::before, .row-snippet:not(:empty)::before { content: none; }
  .row-labels { order: 2; }
  .cell-star { grid-area: star; align-self: end; }
  .row-actions { display: none !important; }
  /* Toolbar: the bulk actions need the whole width; the count stays announced (role=status) but is
     only visually hidden. */
  .list-toolbar { padding: 0 4px 0 6px; }
  .select-control { padding-left: 4px; margin-right: 2px; }
  .toolbar-sep { display: none; }
  .has-selection .selection-count { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
/* While rows are selected in a list of up to 720px (split panes, tablets, phones) the bulk actions take the room of the paging. */
@container list (max-width: 720px) {
  .has-selection .list-paging { display: none; }
}

/* ------------------------------------------------------------------ conversation */
.reader-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); padding: 24px; }
.reader-empty .material-symbols { font-size: 48px; color: var(--border); }
.reader-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.conv-position { color: var(--text-3); font-size: 12px; padding: 0 8px; white-space: nowrap; }
.conv-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.reader-loading { padding: 24px 72px; color: var(--text-3); }
.reader-error { margin: 16px 24px; padding: 12px 16px; border-radius: 8px; background: var(--danger-container); color: var(--danger); }
.message-article { padding: 0 24px 24px 16px; max-width: 1100px; }
.conv-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 16px 0 16px 56px; }
.conv-subject { font-size: 22px; line-height: 28px; color: var(--text); outline: none; overflow-wrap: anywhere; }
.conv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.inquiry-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 16px 56px; }
.inquiry-details dt { color: var(--text-3); }
.inquiry-details dd { margin: 0; overflow-wrap: anywhere; }
.inquiry-body { margin-left: 56px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.6; margin: 0; }
#message-html { width: 100%; min-height: 360px; border: 0; background: var(--frame-bg); border-radius: 8px; }
.thread-more { padding: 0 0 8px 56px; }
.thread-error { margin-left: 56px; color: var(--danger); font-size: 13px; }
.conv-messages { display: flex; flex-direction: column; }
.msg-card { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.msg-card:last-child { border-bottom: 0; }
.msg-card > .msg-avatar { grid-column: 1; grid-row: 1 / span 2; cursor: pointer; }
.msg-card > :not(.msg-avatar) { grid-column: 2; min-width: 0; }
.msg-card.collapsed { cursor: pointer; }
.msg-card.collapsed:hover { background: var(--hover); }
.msg-header { display: flex; align-items: flex-start; gap: 8px; min-height: 40px; }
.msg-toggle { flex: 1; min-width: 0; padding-top: 2px; border-radius: 4px; cursor: pointer; outline-offset: 2px; }
.msg-name-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.msg-sender { font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-card.collapsed:not(.unread) .msg-sender { font-weight: 500; }
.msg-email { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-snippet { display: block; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-meta { display: flex; align-items: center; gap: 0; color: var(--text-3); font-size: 12px; flex-shrink: 0; }
.msg-date { padding: 0 6px; white-space: nowrap; }
.msg-date .date-short { display: none; }
.msg-clip { font-size: 16px; }
.msg-subline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: -18px; min-height: 20px; max-width: calc(100% - 170px); pointer-events: none; }
.msg-subline > * { pointer-events: auto; }
.to-toggle { display: inline-flex; align-items: center; color: var(--text-3); font-size: 12px; border-radius: 4px; padding: 0 2px; max-width: 100%; }
.to-toggle > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-toggle:hover { background: var(--hover); }
.msg-details { margin: 8px 0 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; display: grid; gap: 4px; font-size: 12px; max-width: 640px; box-shadow: var(--shadow-1); background: var(--surface); }
.detail-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
.detail-row dt { color: var(--text-3); text-align: right; }
.detail-row dd { margin: 0; overflow-wrap: anywhere; }
.msg-body { margin-top: 16px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; color: var(--text); }
.frame-wrap { resize: vertical; overflow: hidden; min-height: 120px; border-radius: 8px; background: var(--frame-bg); }
.frame-s { height: 200px; } .frame-m { height: 380px; } .frame-l { height: 580px; } .frame-xl { height: min(78vh, 900px); }
/* Image mail estimated taller than the extra-large frame (newsletters): the page scrolls instead of the frame. */
.frame-2xl { height: 1200px; } .frame-3xl { height: 1600px; }
.msg-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--frame-bg); }
.msg-body-tools { display: flex; justify-content: flex-start; margin-top: 4px; }
.translation-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.translation-result { margin-top: 8px; padding: 12px; border-left: 3px solid var(--primary); background: var(--surface-2); }
.translation-result pre, .translation-preview pre { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.translation-dialog { width: min(640px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto; }
.translation-preview { max-height: 45vh; overflow-y: auto; }
.compose-translation-actions { display: flex; align-items: center; gap: 8px; padding: 3px 16px; color: var(--text-3); font-size: 12px; }
.pdf-preview-dialog { width: min(960px, calc(100vw - 32px)); max-height: 90vh; overflow: hidden; }
.pdf-preview-page { max-height: 65vh; overflow: auto; text-align: center; background: var(--surface-2); }
.pdf-preview-page canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; background: white; }
.format-toggle { font-size: 12px; min-height: 28px; padding: 0 8px; }
.msg-note { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.msg-attachments { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--divider); }
.attachments-title { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
.attachment-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.attachment-card { display: grid; grid-template-columns: 28px minmax(0, 1fr) 24px; grid-template-rows: auto auto; column-gap: 8px; align-items: center; width: 220px; max-width: 100%; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); text-decoration: none; background: var(--surface); }
.attachment-card:hover { box-shadow: var(--shadow-1); }
.attachment-icon { grid-row: 1 / span 2; font-size: 24px; color: var(--danger); }
.attachment-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { grid-column: 2; font-size: 12px; color: var(--text-3); }
.attachment-download { grid-column: 3; grid-row: 1 / span 2; color: var(--text-3); }
/* Image attachments: a thumbnail (opens the preview) above the usual download bar. */
.attachment-tile { display: flex; flex-direction: column; width: 220px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.attachment-tile:hover { box-shadow: var(--shadow-1); }
.attachment-tile .attachment-card { width: auto; border: 0; border-top: 1px solid var(--divider); border-radius: 0; }
.attachment-tile .attachment-card:hover { box-shadow: none; background: var(--hover); }
.attachment-preview { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 132px; background: var(--surface-2); cursor: zoom-in; }
.attachment-preview:focus-visible { outline-offset: -2px; }
.attachment-thumb { width: 100%; height: 100%; object-fit: cover; }
.attachment-thumb-fallback { display: none; font-size: 40px; color: var(--text-3); }
.thumb-failed .attachment-thumb-fallback { display: inline-block; }
.attachment-tile .attachment-icon { color: var(--primary); }

/* Remote images hidden (setting "ask", Spam, failed sender verification): Gmail-like notice above the body. */
.image-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 12px; padding: 8px 8px 8px 12px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.image-banner.unsafe { background: var(--woke-bg); color: var(--woke-fg); }
.image-banner-icon { font-size: 20px; color: var(--text-3); }
.image-banner.unsafe .image-banner-icon { color: var(--woke-fg); }
.image-banner-text { flex: 1 1 220px; min-width: 0; line-height: 1.5; }
.image-banner-actions { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; }
.image-banner-actions .text-button { min-height: 32px; padding: 0 10px; font-size: 13px; max-width: 100%; text-align: left; overflow-wrap: anywhere; }
.image-banner.unsafe .text-button { color: var(--woke-fg); text-decoration: underline; }

/* Image preview: a full-window dialog with the picture, its name, Download and previous/next. */
.image-preview { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border-radius: 0; background: rgba(20, 20, 20, .96); color: #fff; }
.image-preview[open] { display: flex; flex-direction: column; }
.image-preview::backdrop { background: rgba(0, 0, 0, .6); }
.image-preview-bar { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 12px; flex-shrink: 0; }
.image-preview .icon-button { color: #fff; }
.image-preview .icon-button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.image-preview .icon-button:focus-visible { outline-color: #a8c7fa; }
.image-preview-kind { color: #f28b82; }
.image-preview-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-position { color: #dadce0; font-size: 13px; white-space: nowrap; }
.image-preview-download:not([href]) { visibility: hidden; }
.image-preview-stage { flex: 1; min-height: 0; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; grid-template-rows: minmax(0, 1fr); align-items: center; justify-items: center; gap: 8px; padding: 0 12px 24px; }
.image-preview-img { grid-column: 2; grid-row: 1; min-width: 0; max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; box-shadow: 0 4px 24px rgba(0, 0, 0, .5); }
.image-preview-error { grid-column: 2; grid-row: 1; text-align: center; color: #dadce0; }
.image-preview-nav { grid-row: 1; width: 48px; height: 48px; background: rgba(0, 0, 0, .35); }
#image-preview-prev { grid-column: 1; }
#image-preview-next { grid-column: 3; }
.image-preview-nav:disabled { visibility: hidden; }

/* Settings → General: senders whose images are always shown */
.image-senders { width: 100%; }
.image-sender-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 560px; }
.image-sender-list:empty { display: none; }
.image-sender { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--divider); }
.image-sender-icon { color: var(--text-3); }
.image-sender-address { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.older-divider { position: relative; display: flex; align-items: center; height: 40px; margin: 4px 0; padding-left: 0; width: 100%; }
.older-divider::before, .older-divider::after { content: ''; position: absolute; left: 0; right: 0; height: 1px; background: var(--divider); }
.older-divider::before { top: 17px; } .older-divider::after { top: 21px; }
.older-count { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); font-weight: 500; }
.older-divider:hover .older-count { background: var(--surface-3); }
.reply-bar { display: flex; flex-wrap: wrap; gap: 12px; padding: 20px 0 8px 56px; }

/* ------------------------------------------------------------------ settings */
.settings-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.settings-head h1 { font-size: 22px; outline: none; }
.settings-status { margin-left: auto; color: var(--text-3); font-size: 13px; }
.settings-tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--divider); overflow-x: auto; flex-shrink: 0; }
.settings-tab { height: 44px; padding: 0 16px; color: var(--text-2); font-weight: 500; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; white-space: nowrap; }
.settings-tab:hover { background: var(--hover); }
.settings-tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.settings-body { padding: 8px 24px 32px; }
.settings-panel { outline: none; max-width: 920px; }
.settings-panel:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.settings-panel > h2 { font-size: 18px; margin: 16px 0 8px; }
.settings-panel h3 { font-size: 14px; font-weight: 500; margin: 16px 0 6px; }
.setting-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--divider); align-items: start; }
.setting-name { font-weight: 500; padding-top: 8px; }
.setting-value { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.setting-value .check-label { padding-top: 6px; }
.settings-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 8px; flex-wrap: wrap; }
.settings-section-head h2 { font-size: 18px; }
.settings-label-list { list-style: none; margin: 0; padding: 0; }
.settings-label { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; min-height: 48px; border-bottom: 1px solid var(--divider); }
.settings-label-name { color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-label-name:hover { text-decoration: underline; }
.settings-label-counts { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.settings-identity { font-size: 16px; margin: 8px 0; overflow-wrap: anywhere; }
.address-list { margin: 0 0 8px; padding-left: 20px; }
.address-list li { overflow-wrap: anywhere; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.security-panel { margin: 24px 0 16px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.security-heading { display: flex; align-items: center; justify-content: space-between; }
.security-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.security-summary dt { font-size: 12px; color: var(--text-3); }
.security-summary dd { margin: 0 0 8px; font-size: 22px; }
.security-events { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.security-events li { display: grid; gap: 2px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.security-event-title { font-weight: 500; }
.security-event-detail, .security-event-time { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.security-panel h4 { font-size: 13px; font-weight: 500; margin-top: 8px; }

/* ------------------------------------------------------------------ menus */
.menu { position: fixed; z-index: 50; min-width: 200px; max-width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 8px 0; border-radius: 8px; background: var(--surface-menu); box-shadow: var(--shadow-3); color: var(--text); }
.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 36px; padding: 0 16px; text-align: left; color: var(--text); white-space: nowrap; }
.menu-item:hover:not(:disabled) { background: var(--hover); }
/* Arrow-key focus needs a real indicator, distinct from hover. */
.menu-item:focus-visible { background: var(--hover-strong); outline: 2px solid var(--primary); outline-offset: -2px; }
.menu-item .material-symbols { color: var(--text-2); }
.menu-item.mobile-only { display: none; }
.menu-title { padding: 4px 16px 8px; font-size: 13px; color: var(--text-3); }
.menu-note { padding: 4px 16px; font-size: 13px; color: var(--text-3); }
.menu-divider { height: 1px; margin: 8px 0; background: var(--divider); }
.snooze-choice { justify-content: space-between; gap: 32px; }
.snooze-when { color: var(--text-3); font-size: 13px; }
.label-menu { width: 280px; }
.label-menu-search { position: relative; margin: 0 16px 8px; }
.label-menu-search input { width: 100%; height: 32px; border: 0; border-bottom: 1px solid var(--border); background: transparent; outline: none; padding: 0 28px 0 2px; }
.label-menu-search input:focus { border-bottom: 2px solid var(--primary); }
.label-menu-search .material-symbols { position: absolute; right: 2px; top: 6px; font-size: 18px; color: var(--text-3); pointer-events: none; }
.label-menu-list { max-height: 260px; overflow: auto; }
.menu-check { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 16px; cursor: pointer; }
.menu-check:hover { background: var(--hover); }
.menu-check-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ snackbar and FAB */
.snackbar { position: fixed; left: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 8px; min-height: 48px; min-width: 288px; max-width: min(568px, calc(100vw - 48px)); padding: 6px 8px 6px 16px; border-radius: 4px; background: var(--snackbar); color: var(--snackbar-text); box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), 0 6px 10px rgba(0, 0, 0, .14), 0 1px 18px rgba(0, 0, 0, .12); }
.snackbar-text { flex: 1; font-size: 14px; line-height: 20px; padding: 8px 0; }
.snackbar-action { color: var(--snackbar-action); font-weight: 500; padding: 8px 10px; border-radius: 4px; white-space: nowrap; }
.snackbar-action:hover { background: rgba(255, 255, 255, .08); }
.snackbar-close { color: var(--snackbar-text); }
/* undo send: its own bar; the regular snackbar moves up while it is shown */
.snackbar.stacked { margin-bottom: 60px; }
.send-snackbar { z-index: 61; padding-right: 8px; }
.send-countdown { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-width: 26px; height: 26px; padding: 0 4px; border: 2px solid var(--snackbar-action); border-radius: 13px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.send-countdown:empty { display: none; }
/* Keep notices off an open compose window's Send button (e.g. "Sending undone." right after Undo send).
   Below ~1200px the docked window reaches the bottom-left corner: lift the notice above the window.
   An expanded window covers the bottom edge at every width: show the notice at the top instead. */
@media (min-width: 761px) and (max-width: 1199px) {
  body:has(#compose-dialog[open]:not(.minimized)) .snackbar { bottom: calc(min(600px, 100dvh - 72px) + 8px); }
}
@media (min-width: 761px) {
  body:has(#compose-dialog.expanded[open]) .snackbar { top: 8px; bottom: auto; }
}
.mobile-compose { display: none; }

/* ------------------------------------------------------------------ dialogs */
dialog { color: var(--text); background: var(--surface); border: 0; padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.plain-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border-radius: 16px; box-shadow: var(--shadow-3); }
.plain-dialog h2 { font-size: 22px; line-height: 28px; margin-bottom: 12px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog-head h2 { margin-bottom: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.dialog-note { margin-bottom: 12px; font-size: 14px; color: var(--text-2); }
#spam-dialog .check-label { margin-top: 4px; }
.color-swatches { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.color-swatches legend { font-size: 13px; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.swatch { position: relative; display: inline-flex; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch-chip { width: 32px; height: 32px; border-radius: 50%; background: var(--lc-dot); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5); }
.swatch input:checked + .swatch-chip { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch input:focus-visible + .swatch-chip { outline: 2px solid var(--primary); outline-offset: 4px; }
.snooze-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shortcuts-dialog { width: min(760px, calc(100vw - 32px)); }
.shortcut-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; }
.shortcut-list { margin: 0; display: grid; gap: 6px; }
.shortcut-list > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: center; }
.shortcut-list dt { white-space: nowrap; }
.shortcut-list dd { margin: 0; color: var(--text-2); }
.account-dialog { position: fixed; inset: 60px 12px auto auto; margin: 0; width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 72px); overflow: auto; border-radius: 28px; background: var(--surface-2); box-shadow: var(--shadow-3); }
.account-dialog::backdrop { background: transparent; }
.account-card { padding: 12px 16px 20px; display: flex; flex-direction: column; align-items: stretch; }
.account-top { display: flex; align-items: center; justify-content: center; position: relative; min-height: 36px; }
.account-email { font-weight: 500; text-align: center; padding: 0 40px; overflow-wrap: anywhere; }
.account-top .icon-button { position: absolute; right: 0; top: 2px; }
.account-hello { text-align: center; font-size: 20px; margin: 4px 0 12px; }
.account-section { background: var(--surface); border-radius: 16px; padding: 12px 16px; }
.account-section h3 { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.account-language { display: flex; align-items: center; gap: 8px; margin: 12px 4px 0; color: var(--text-2); }
.account-language select { flex: 1; }
.account-actions { display: grid; gap: 2px; margin-top: 12px; background: var(--surface); border-radius: 16px; overflow: hidden; }
.account-action { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 20px; text-align: left; color: var(--text); }
.account-action:hover:not(:disabled) { background: var(--hover); }

/* ------------------------------------------------------------------ compose window */
.compose-window { position: fixed; inset: auto 16px 0 auto; margin: 0; width: 560px; max-width: calc(100vw - 32px); height: min(600px, calc(100dvh - 72px)); padding: 0; border-radius: 12px 12px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .2); z-index: 40; overflow: hidden; }
.compose-window form { display: flex; flex-direction: column; height: 100%; }
.compose-head { display: flex; align-items: center; gap: 4px; height: 40px; flex-shrink: 0; padding: 0 6px 0 16px; background: var(--surface-2); }
.compose-head h2 { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose-window-controls { display: flex; gap: 0; }
.compose-window-controls .icon-button { width: 28px; height: 28px; border-radius: 4px; }
.compose-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; padding: 0 16px; }
.compose-row { display: flex; align-items: center; gap: 8px; min-height: 40px; border-bottom: 1px solid var(--divider); flex-shrink: 0; }
.compose-row input, .compose-row select { flex: 1; min-width: 0; height: 38px; border: 0; outline: none; background: transparent; padding: 0; }
.compose-row select { padding: 0 4px; }
.compose-row:focus-within { border-bottom-color: var(--text-3); }
.compose-label { color: var(--text-3); min-width: 32px; }
.recipient-toggles { display: flex; gap: 2px; }
/* recipient chips + contact suggestions */
.compose-to-row, .optional-recipient { position: relative; flex-wrap: wrap; row-gap: 4px; padding: 4px 0; }
.compose-to-row > .compose-label, .optional-recipient > .compose-label { align-self: center; }
.compose-row > .recipient-input { flex: 1 0 140px; height: 30px; }
.compose-to-row > .recipient-toggles { margin-left: auto; }
.recipient-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; height: 28px; padding: 0 2px 0 2px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); font-size: 13px; line-height: 1; cursor: default; }
.recipient-chip .chip-avatar { width: 22px; height: 22px; font-size: 12px; }
.recipient-chip.invalid { padding-left: 10px; border-color: var(--danger); background: var(--danger-container); color: var(--danger); cursor: pointer; }
.recipient-chip:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.chip-label { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-email { min-width: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.recipient-chip.invalid .chip-email { color: inherit; }
.chip-remove { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; color: var(--text-3); }
.recipient-chip.invalid .chip-remove { color: var(--danger); }
.chip-remove .material-symbols { font-size: 16px; }
.chip-remove:hover:not(:disabled) { background: var(--hover-strong); color: var(--text); }
.chip-remove:focus-visible { outline-offset: 0; }
.recipient-suggestions { position: absolute; top: calc(100% + 1px); left: 32px; right: 0; z-index: 5; max-height: min(336px, 50vh); overflow-y: auto; margin: 0; padding: 6px 0; list-style: none; border-radius: 8px; background: var(--surface-menu); color: var(--text); box-shadow: var(--shadow-3); }
.suggestion { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 16px; cursor: pointer; }
.suggestion[aria-selected="true"] { background: var(--hover-strong); }
.suggestion .avatar { width: 32px; height: 32px; font-size: 14px; }
.suggestion-text { display: flex; flex-direction: column; min-width: 0; }
.suggestion-name, .suggestion-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-name { font-weight: 500; }
.suggestion-email { color: var(--text-3); font-size: 12px; }
.forward-note { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.forward-attachments { margin-top: 8px; font-size: 13px; }
.compose-editor { flex: 1 0 140px; padding: 12px 0; outline: none; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.compose-editor:empty::before { content: ''; }
.compose-editor[aria-disabled="true"] { opacity: .7; }
.compose-editor blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid var(--border); color: var(--text-2); }
.compose-attachments-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.compose-attachments-list:empty { display: none; }
.compose-attachment-row { display: flex; align-items: center; gap: 8px; max-width: 420px; padding: 2px 4px 2px 10px; border-radius: 4px; background: var(--surface-2); font-size: 13px; }
.compose-attachment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); font-weight: 500; }
.compose-attachment-size { color: var(--text-3); }
#compose-attachment-status:empty, #compose-progress:empty { display: none; }
.compose-progress { font-size: 13px; color: var(--text-2); padding: 4px 0; }
.compose-error { margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: var(--danger-container); color: var(--danger); font-size: 13px; outline: none; }
.compose-discard-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.compose-discard-confirm p { flex: 1 1 200px; }
.compose-format-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin: 0 12px; padding: 2px 6px; border-radius: 16px; background: var(--surface-2); flex-shrink: 0; }
.compose-format-toolbar .icon-button { width: 30px; height: 30px; border-radius: 4px; }
.compose-footer { display: flex; align-items: center; gap: 2px; padding: 8px 8px 12px 16px; flex-shrink: 0; flex-wrap: wrap; }
.send-button { height: 36px; padding: 0 24px; margin-right: 6px; border-radius: 18px; background: var(--primary); color: var(--on-primary); font-weight: 500; letter-spacing: .25px; }
.send-button:hover:not(:disabled) { box-shadow: var(--shadow-1); }
.attach-button { position: relative; cursor: pointer; overflow: hidden; }
.attach-button:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-input:disabled { cursor: default; }
.draft-save-bar { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; font-size: 12px; color: var(--text-3); }
#draft-save-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
#draft-save-status.save-failed { color: var(--danger); white-space: normal; }
.draft-save-bar .text-button { min-height: 30px; padding: 0 8px; font-size: 12px; }
.compose-window.minimized { height: 40px; width: 300px; }
.compose-window.minimized .compose-body, .compose-window.minimized .compose-format-toolbar, .compose-window.minimized .compose-footer { display: none; }
.compose-window.minimized .compose-head { cursor: pointer; }
.compose-window.expanded { inset: 5vh 8vw; width: auto; height: auto; max-width: none; border-radius: 12px; }
.compose-window.is-busy .compose-editor { cursor: progress; }

/* ------------------------------------------------------------------ narrow reading pane (split view, tablets, phones) */
@container reader (max-width: 620px) {
  .conv-toolbar { padding: 0 4px; gap: 0; }
  .conv-toolbar .toolbar-sep, .conv-position { display: none; }
  .message-article { padding: 0 16px 24px; }
  .conv-header { padding: 12px 0; }
  .conv-subject { font-size: 20px; }
  .msg-card { column-gap: 12px; }
  .msg-card > .msg-body, .msg-card > .msg-attachments, .msg-card > .msg-details { grid-column: 1 / -1; }
  .msg-toggle { min-width: 42%; }
  .msg-email, .msg-meta .msg-reply { display: none; }
  .msg-meta { flex-shrink: 1; min-width: 0; }
  .msg-meta .msg-date { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .msg-date .date-long { display: none; }
  .msg-date .date-short { display: inline; }
  .reply-bar, .thread-more, .inquiry-body { padding-left: 0; margin-left: 0; }
  .thread-error, .inquiry-details { margin-left: 0; }
  /* two image thumbnails side by side in a narrow reading pane */
  .attachment-tile { width: calc(50% - 6px); }
}
/* Split view on mid-size screens: the secondary conversation actions move into "More" so the toolbar fits. */
@media (min-width: 761px) and (max-width: 1279px) {
  .mail-shell[data-pane="right"] .conv-toolbar .desktop-only { display: none; }
  body:has(.mail-shell[data-pane="right"]) #conv-more-menu .menu-item.mobile-only { display: flex; }
}

/* ------------------------------------------------------------------ tablet (760–1023px): rail sidebar by default */
@media (min-width: 761px) and (max-width: 1023px) {
  .topbar-start { width: auto; }
  .brand-word { display: none; }
  .mail-shell:not(.sidebar-expanded) .mail-sidebar { width: 72px; }
  .mail-shell:not(.sidebar-expanded) .compose-button { padding: 0; justify-content: center; width: 56px; }
  .mail-shell:not(.sidebar-expanded) .mail-sidebar .nav-text, .mail-shell:not(.sidebar-expanded) .mail-sidebar .nav-count, .mail-shell:not(.sidebar-expanded) .label-heading, .mail-shell:not(.sidebar-expanded) .label-more, .mail-shell:not(.sidebar-expanded) .nav-divider { display: none; }
  .mail-shell:not(.sidebar-expanded) .folder-nav, .mail-shell:not(.sidebar-expanded) .label-nav, .mail-shell:not(.sidebar-expanded) .sidebar-bottom { padding-right: 0; }
  .mail-shell:not(.sidebar-expanded) .nav-item { width: 56px; margin-left: 8px; padding: 0; justify-content: center; border-radius: 16px; position: relative; }
  .mail-shell:not(.sidebar-expanded) .nav-item.has-unread::after { content: ''; position: absolute; top: 6px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  .mail-shell.sidebar-expanded .mail-sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; background: var(--bg); box-shadow: var(--shadow-3); border-radius: 0 16px 16px 0; }
  .mail-shell.sidebar-expanded .mail-main { margin-left: 72px; }
  .settings-view .setting-row { grid-template-columns: 180px minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ phones (< 760px) */
@media (max-width: 760px) {
  .mail-app { grid-template-rows: auto auto auto minmax(0, 1fr); }
  .mail-header { height: 48px; margin: 8px 12px 6px; padding: 0 4px; gap: 0; border-radius: 24px; background: var(--surface-3); }
  .mail-header:focus-within { background: var(--surface); box-shadow: var(--shadow-1); }
  .topbar-start { width: auto; }
  .brand, #help-button, #settings-button, .search-submit { display: none; }
  .topbar-search { position: static; }
  .search-pill { height: 48px; background: transparent; padding: 0; }
  .search-pill:focus-within { background: transparent; box-shadow: none; }
  .search-pill input { font-size: 16px; }
  .topbar-end { padding-left: 0; }
  .account-avatar { margin: 0 4px; }
  .advanced-search { position: fixed; top: 60px; left: 8px; right: 8px; max-height: calc(100dvh - 72px); padding: 16px; }
  .adv-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .provider-banner, .global-error { margin: 0 12px 6px; }
  .mail-shell { display: block; }
  .mail-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 46; width: min(300px, 86vw); background: var(--surface); padding-top: 12px; box-shadow: var(--shadow-3); border-radius: 0 16px 16px 0; transform: translateX(-105%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  .nav-open .mail-sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .sidebar-veil { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .4); }
  .mail-sidebar .compose-button { display: none; }
  .nav-item { height: 44px; }
  .sidebar-bottom .nav-item[href="#settings"] { display: flex; }
  .mail-main { height: 100%; padding: 0; }
  .main-card { border-radius: 16px 16px 0 0; height: 100%; }
  .list-toolbar { padding: 0 4px 0 6px; }
  .select-control { padding-left: 4px; margin-right: 2px; }
  /* touch targets: at least 24px each for "select all" and its menu button */
  .select-control input[type=checkbox] { width: 24px; height: 24px; }
  .select-control .icon-button.tiny { width: 28px; }
  .page-position { padding: 0 2px; }
  .has-selection .list-paging { display: none; }
  .toolbar-sep { display: none; }
  .row { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "avatar from date" "avatar main star"; height: auto; min-height: 76px; padding: 10px 12px 10px 8px; align-items: start; row-gap: 2px; }
  .row:hover { box-shadow: none; }
  .cell-check, .cell-flags { display: none; }
  .cell-avatar { display: flex; grid-area: avatar; padding-top: 2px; }
  .cell-from { grid-area: from; padding-right: 8px; font-size: 15px; }
  .cell-date { grid-area: date; padding-left: 8px; }
  .cell-main { grid-area: main; flex-direction: column; align-items: stretch; gap: 2px; }
  .row-line { display: flex; flex-direction: column; }
  .row-snippet:not(:empty)::before { content: none; }
  .row-labels { order: 2; }
  .cell-star { grid-area: star; align-self: end; }
  .row-actions { display: none !important; }
  /* room below the last row so the Compose button never covers its star and date */
  .list-scroll { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .mobile-compose { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 16px; border-radius: 16px; background: var(--primary-container); color: var(--on-primary-container); font-weight: 500; box-shadow: var(--shadow-2); }
  .reader-active ~ .mobile-compose, .mail-app:has(.reader-active) .mobile-compose, body:has(#compose-dialog[open]) .mobile-compose { display: none; }
  .snackbar { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); min-width: 0; max-width: none; }
  .mail-app:has(.reader-active) .snackbar { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .desktop-only, .conv-position { display: none; }
  .menu-item.mobile-only { display: flex; }
  .conv-toolbar { padding: 0 4px; gap: 0; }
  .message-article { padding: 0 16px 24px; }
  .conv-header { padding: 12px 0 12px; }
  .conv-subject { font-size: 20px; }
  .msg-card { column-gap: 12px; }
  .msg-card > .msg-body, .msg-card > .msg-attachments, .msg-card > .msg-details { grid-column: 1 / -1; }
  .msg-email { display: none; }
  .msg-meta .msg-date { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .reply-bar, .thread-more, .inquiry-body { padding-left: 0; margin-left: 0; }
  .thread-error, .inquiry-details { margin-left: 0; }
  .reply-bar { padding: 16px 0 72px; }
  .pill-button { flex: 1 1 0; justify-content: center; padding: 0 12px; }
  .settings-head { padding: 8px 8px 0; }
  .settings-body { padding: 4px 16px calc(88px + env(safe-area-inset-bottom)); }
  .setting-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .setting-name { padding-top: 0; }
  .settings-label { grid-template-columns: 20px minmax(0, 1fr) auto auto; }
  .settings-label-counts { display: none; }
  .security-summary { grid-template-columns: minmax(0, 1fr); }
  .compose-window, .compose-window.expanded { inset: 0; width: 100vw; max-width: none; height: 100dvh; border-radius: 0; }
  .compose-window.minimized { inset: auto 12px env(safe-area-inset-bottom) auto; width: min(300px, calc(100vw - 24px)); height: 40px; border-radius: 12px 12px 0 0; }
  #compose-expand { display: none; }
  .compose-row input, .compose-row select { font-size: 16px; }
  /* a named chip still shows its real address on phones, only shortened; an address-only chip may use the row width */
  .recipient-chip:has(.chip-email) .chip-label { max-width: 120px; }
  .recipient-chip:not(:has(.chip-email)) .chip-label { max-width: none; }
  .chip-email { max-width: 140px; }
  .recipient-suggestions { left: 0; }
  .compose-editor { font-size: 16px; }
  .compose-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  #draft-save-status { max-width: 110px; }
  .shortcut-columns { grid-template-columns: minmax(0, 1fr); }
  .account-dialog { inset: 8px 8px auto auto; width: calc(100vw - 16px); }
  .auth-card { padding: 28px 22px 24px; border-radius: 24px; }
  .auth-title { font-size: 26px; }
  /* phones: the picture takes the full width; previous/next float over its edges */
  .image-preview-bar { padding: 4px; gap: 4px; }
  .image-preview-stage { grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 0; padding: 0 0 16px; }
  .image-preview-img { grid-column: 1 / -1; }
  .image-preview-error { grid-column: 1 / -1; padding: 0 56px; }
  .image-preview-nav { z-index: 1; }
  .attachment-tile { width: calc(50% - 6px); }
  .attachment-preview { height: 112px; }
}
@media (max-width: 420px) {
  .snooze-fields { grid-template-columns: minmax(0, 1fr); }
  .list-paging .page-position { display: none; }
  .account-email { padding: 0 36px; }
}

/* ------------------------------------------------------------------ motion and print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .list-progress { background: var(--primary); opacity: .5; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --text: #000; --text-2: #222; --text-3: #444; --divider: #ccc; }
  html, body { height: auto; background: #fff; }
  .skip, .auth-view, .mail-header, .provider-banner, .global-error, .mail-sidebar, .sidebar-veil, .list-view, .conv-toolbar, .reply-bar, .snackbar, .mobile-compose, .menu, .compose-window, dialog, .msg-meta .icon-button, .msg-body-tools, .thread-more, .reader-empty, .settings-view, .label-chip-remove, .older-divider, .image-banner { display: none !important; }
  .mail-app { display: block !important; height: auto; overflow: visible; }
  .mail-shell, .mail-main, .main-card, .reader-pane, .reader-content, .conv-scroll { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; border-radius: 0; box-shadow: none; background: #fff; }
  .message-article { padding: 0; max-width: none; }
  .conv-header { padding-left: 0; }
  .msg-card { break-inside: avoid; }
  /* A sandboxed frame prints only its fixed-height box, so a long formatted message would be cut off.
     When the reader puts a print copy right after the frame (.msg-print, hidden on screen: the text of the
     formatted content), print that instead of the frame. Without one, print the frame as on screen followed by
     the text version: content is then lost only when the formatted body overflows its box AND the text part is a stub. */
  .frame-wrap { resize: none; border: 1px solid #ddd; }
  /* .has-print-copy is set on the frame when its print copy has been filled (on beforeprint / Print all). */
  .msg-body .frame-wrap.has-print-copy { display: none !important; }
  .msg-body .frame-wrap.has-print-copy:not([hidden]) + .msg-print { display: block !important; }
  .msg-body .frame-wrap:not(.has-print-copy):not([hidden]) + .msg-print + .msg-text[hidden] { display: block !important; margin-top: 8px; }
  .msg-details { box-shadow: none; }
}
