/* ─────────────────────────────────────────────────────────────
 * TGMail Mini App stylesheet
 * Brand: graphite. Flat, type-led, no gradients. Ink CTAs, blue
 * reserved for links and live emphasis. Follows the user's
 * light/dark scheme, rendered in brand colors.
 * ──────────────────────────────────────────────────────────── */

:root {
  /* Brand tokens: light */
  --bg: #FFFFFF;
  --surface: #F7F8F9;
  --press: #F2F3F5;
  --text: #17181A;
  --muted: #8B9096;
  --separator: #EEF0F2;
  --accent: #2AABEE;
  --accent-solid: #17181A;
  --on-accent: #FFFFFF;
  --danger: #D92D20;
  --tone-warn: #C77D0A;
  --danger-bg: #FDECEA;
  --text-2: #45484C;
  --text-3: #55585C;
  --faint: #9AA0A6;
  --hairline-2: #F4F5F6;
  --gmail: #EA4335;
  --highlight: #F2F6FA;

  /* Safe areas (mirrored by JS in safeAreaChanged/contentSafeAreaChanged) */
  --tg-safe-area-inset-top: 0px;
  --tg-safe-area-inset-right: 0px;
  --tg-safe-area-inset-bottom: 0px;
  --tg-safe-area-inset-left: 0px;
  --tg-content-safe-area-inset-top: 0px;
  --tg-content-safe-area-inset-right: 0px;
  --tg-content-safe-area-inset-bottom: 0px;
  --tg-content-safe-area-inset-left: 0px;

  /* Effective insets: max of system, Telegram chrome, and iOS env() */
  --safe-top: max(
    env(safe-area-inset-top, 0px),
    var(--tg-safe-area-inset-top),
    var(--tg-content-safe-area-inset-top)
  );
  --safe-bottom: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom),
    var(--tg-content-safe-area-inset-bottom)
  );
  --safe-left: max(
    env(safe-area-inset-left, 0px),
    var(--tg-safe-area-inset-left),
    var(--tg-content-safe-area-inset-left)
  );
  --safe-right: max(
    env(safe-area-inset-right, 0px),
    var(--tg-safe-area-inset-right),
    var(--tg-content-safe-area-inset-right)
  );

  /* Spacing scale */
  --gutter: 18px;
  --row-pad-y: 12px;
  --row-pad-x: var(--gutter);

  /* Type: system stack everywhere; mono for every email address */
  --font-stack:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono:
    ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Mono", Consolas,
    monospace;

  /* Radii: pills are always 100px */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
}

/* Brand tokens: dark (graphite deep). CTA pills invert to paper. */
[data-color-scheme="dark"] {
  --bg: #0F1012;
  --surface: #17181A;
  --press: #1D1F22;
  --text: #F2F3F5;
  --muted: #8B9096;
  --separator: #202226;
  --accent: #2AABEE;
  --accent-solid: #F2F3F5;
  --on-accent: #17181A;
  --danger: #F0655B;
  --tone-warn: #E5A50A;
  --danger-bg: #2A1513;
  --text-2: #C9CCD1;
  --text-3: #B4B8BE;
  --faint: #7E838A;
  --hairline-2: #1A1C1F;
  --gmail: #EA4335;
  --highlight: #16202B;
}

/* ── Base ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The hidden attribute must always win; author display rules
   silently defeat the UA stylesheet otherwise. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-stack);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ── Shared primitives ──────────────────────────────────── */

/* Kicker / eyebrow label */
.kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  -webkit-user-select: none;
  user-select: none;
}

/* Pills. Primary CTA is ink (paper in dark); blue never fills. */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  background: var(--press);
  color: var(--text);
  transition:
    background-color 0.12s ease,
    transform 0.12s ease,
    opacity 0.12s ease;
}

.pill:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.pill--primary {
  background: var(--accent-solid);
  color: var(--on-accent);
  font-weight: 700;
}

.pill--danger {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

.pill[disabled] {
  background: var(--press);
  color: var(--faint);
  pointer-events: none;
}

/* Full-width primary CTA: 52px pill */
.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  border-radius: 100px;
  background: var(--accent-solid);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.cta:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.cta[disabled] {
  background: var(--press);
  color: var(--faint);
  pointer-events: none;
}

.cta--sheet {
  min-height: 50px;
  font-size: 15px;
}

/* Ghost / secondary text action */
.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--press);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.chip[aria-pressed="true"],
.chip--active {
  background: var(--accent-solid);
  color: var(--on-accent);
}

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent-solid);
  flex: 0 0 auto;
}

.chip__dot--gmail {
  background: var(--gmail);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 16px;
}

/* Progress bars: 6px, radius 100 */
.progress {
  height: 6px;
  border-radius: 100px;
  background: var(--press);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-solid);
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.progress__fill[data-tone="danger"] {
  background: var(--danger);
}

/* Section headings inside settings / detail */
.section-heading {
  margin: 26px 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ── App shell ──────────────────────────────────────────── */
.app {
  min-height: 100%;
  display: block;
  position: relative;
  background: var(--bg);
}

.screen {
  display: block;
  min-height: 100vh;
  min-height: 100dvh;
}

.inbox,
.detail,
.detail__actions {
  padding-left: max(0px, var(--safe-left));
  padding-right: max(0px, var(--safe-right));
}

.detail {
  padding-left: max(var(--gutter), var(--safe-left));
  padding-right: max(var(--gutter), var(--safe-right));
}

/* ── Boot screen ────────────────────────────────────────── */
.screen--boot {
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: max(var(--safe-top), 24px) max(var(--gutter), var(--safe-right))
    max(var(--safe-bottom), 24px) max(var(--gutter), var(--safe-left));
}

.boot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  max-width: 320px;
}

.boot__mark {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

.boot__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.boot__hint {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.boot__cta {
  margin-top: 12px;
  padding: 0 26px;
  text-decoration: none;
}

/* ── Inbox header ───────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--separator);
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.app-header__inner {
  padding: 12px var(--gutter) 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Header title: tapping opens the switcher/folders sheet */
.header-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  min-width: 0;
  color: var(--text);
}

.header-title__text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.header-title__chev {
  flex: 0 0 auto;
  color: var(--text);
}

.masthead__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-button {
  flex: 0 0 auto;
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text-3);
  transition:
    background-color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease;
}

.icon-button--fill {
  width: 42px;
  height: 42px;
  background: var(--press);
}

.icon-button:active {
  background: var(--press);
  transform: scale(0.94);
}

.icon-button[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.icon-button[data-busy="true"] svg {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Header sub line: the address, tap to copy. Mono, quiet. */
.address-pill {
  align-self: flex-start;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  transition: opacity 0.15s ease;
}

.address-pill > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.address-pill__icon {
  flex: 0 0 auto;
  opacity: 0.55;
}

.address-pill:active {
  opacity: 0.6;
}

/* Search bar (replaces the address line while searching) */
.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.searchbar__field {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  background: var(--press);
  border-radius: 100px;
  padding: 0 16px;
}

.searchbar__icon {
  flex: 0 0 auto;
  color: var(--text-3);
}

.searchbar__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  color: var(--text);
  padding: 8px 0;
  outline: none;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.searchbar__input::placeholder {
  color: var(--faint);
}

.searchbar__input::-webkit-search-cancel-button {
  display: none;
}

.searchbar__cancel {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 2px;
  min-height: 44px;
}

/* Account filter chips row (hidden until accounts exist) */
.account-chips {
  display: flex;
  gap: 8px;
  padding: 10px var(--gutter);
  border-top: 1px solid var(--separator);
  overflow-x: auto;
  scrollbar-width: none;
}

.account-chips::-webkit-scrollbar {
  display: none;
}

/* Account filter chips run one step larger than the generic chip (09) */
.account-chips .chip {
  min-height: 32px;
  padding: 6px 14px;
  font-size: 13px;
}

/* Refresh icon is redundant chrome on touch clients */
@media (pointer: coarse) {
  [data-role="refresh"] {
    display: none !important;
  }
}

/* ── Banners and cards above the list ───────────────────── */

/* Storage banner (danger card, screen 15; shown from 95%) */
.quota-banner {
  margin: 12px max(12px, var(--safe-right)) 0
    max(12px, var(--safe-left));
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--danger);
}

.quota-banner__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quota-banner__actions .minipill--primary {
  font-weight: 600;
}

.quota-banner__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--danger);
}

.quota-banner__used {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quota-banner .progress {
  height: 6px;
  margin-top: 8px;
  background: var(--press);
}

.quota-banner__caption {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}

.quota-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Offline bar */
.offline-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 9px var(--gutter);
  border-bottom: 1px solid var(--separator);
  font-size: 12px;
  color: var(--text-3);
}

/* Setup card (screen 06) */
.setup-card {
  position: relative;
  margin: 12px 14px 2px;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
}

.setup-card__close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--faint);
}

.setup-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.setup-card__chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.setup-card__chips .chip {
  background: var(--bg);
  border: 1px solid var(--separator);
  color: var(--text);
  padding: 8px 14px;
}

.setup-card__note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--faint);
}

/* Outbox section above the list */
.outbox-section .kicker {
  padding: 12px var(--gutter) 6px;
}

.outbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px var(--gutter);
}

.outbox-row__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  display: grid;
  place-items: center;
}

.outbox-row__meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.outbox-row__title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outbox-row__status {
  font-size: 12px;
  font-weight: 500;
  color: var(--danger);
}

.outbox-row__status--quiet {
  color: var(--faint);
}

/* Outbox folder rows: main row + trailing Retry chip */
.outbox-li {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: var(--gutter);
}

.outbox-li .outbox-row {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.outbox-li .chip {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 8px 14px;
  color: var(--text);
}

/* ── Message list ───────────────────────────────────────── */
.inbox {
  position: relative;
  padding-bottom: calc(var(--safe-bottom) + 24px);
  background: var(--bg);
  min-height: 60vh;
  will-change: transform;
}

/* Pull-to-refresh indicator */
.ptr {
  position: absolute;
  top: -42px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

.ptr__spinner {
  display: block;
  will-change: transform;
}

.ptr[data-spin="true"] .ptr__spinner {
  animation: spin 0.8s linear infinite;
}

.inbox__list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg);
}

.inbox__list > li {
  position: relative;
  overflow: hidden; /* clips the swipe action */
  isolation: isolate;
}

/* Swipe underlays (screen 12): ink at the start edge (swipe right =
   archive/restore), red at the end edge (swipe left = snooze/delete). */
.swipe-under {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

.swipe-under--start {
  justify-content: flex-start;
  padding-left: 20px;
  background: var(--accent-solid);
  color: var(--on-accent);
}

.swipe-under--end {
  justify-content: flex-end;
  padding-right: 20px;
  background: var(--accent-solid);
  color: var(--on-accent);
}

.swipe-under--danger {
  background: var(--danger);
  color: #ffffff;
}

/* Multi-select (screen 13) */
.row__selcheck {
  flex: 0 0 auto;
  align-self: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1.5px solid var(--faint);
  display: grid;
  place-items: center;
  color: var(--on-accent);
}

.row__selcheck--on {
  background: var(--accent-solid);
  border-color: var(--accent-solid);
}

.inbox__list > li[data-selected="true"] > .row {
  background: var(--surface);
}

/* New-mail highlight (screen 11): tinted row that fades back */
.row--highlight-fade {
  background: var(--bg);
  transition: background-color 1.2s ease;
}

/* Trailing per-row actions (trash restore, spam not-spam, screen 33) */
.inbox__list > li.has-trailing > .row {
  padding-right: 72px;
}

.inbox__list > li.has-trailing--wide > .row {
  padding-right: 108px;
}

.row-restore {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--press);
  color: var(--text);
  display: grid;
  place-items: center;
  z-index: 2;
}

.row-notspam {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

/* Infinite-scroll sentinel */
.list-sentinel {
  display: flex;
  justify-content: center;
  padding: 18px 0 26px;
  color: var(--muted);
}

.list-sentinel svg {
  animation: spin 0.8s linear infinite;
}

/* Trash footer: retention note + empty action */
.trash-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px var(--gutter) 30px;
  text-align: center;
}

.trash-footer__note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 320px;
}

/* Date group labels */
.group-label {
  padding: 16px var(--row-pad-x) 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  -webkit-user-select: none;
  user-select: none;
}

/* Mail row: avatar with source badge, sender, time, subject,
   snippet, unread dot, thread count chip. */
.row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: var(--row-pad-y) var(--row-pad-x);
  width: 100%;
  position: relative;
  transition: background-color 0.12s ease;
  cursor: pointer;
  background: var(--bg);
  color: var(--text);
  will-change: transform;
  z-index: 1;
}

/* hairline between rows, full width */
.inbox__list > li + li > .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--hairline-2);
}

.inbox__list > li.group-label + li > .row::before {
  display: none;
}

.row:active {
  background: var(--press);
}

@media (hover: hover) {
  .row:hover {
    background: color-mix(in srgb, var(--text) 3%, var(--bg));
  }
}

.row:focus-visible {
  background: var(--press);
  outline: none;
}

.row--highlight {
  background: var(--highlight);
}

/* Avatar with source badge */
.row__avatar {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--separator);
  color: var(--text-2);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  -webkit-user-select: none;
  user-select: none;
}

.row__srcbadge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  border: 2px solid var(--bg);
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.row__srcbadge--gmail {
  background: var(--gmail);
  color: #ffffff;
}

.row__body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.55;
}

.row__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 8px;
  min-width: 0;
}

.row__from {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.row__time {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex: 0 0 auto;
}

.row__to-tag {
  color: var(--muted);
  font-weight: 400;
}

.row__subject {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.row__subject-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.row__paperclip {
  flex: 0 0 auto;
  color: var(--faint);
}

.row__count {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 8px;
  border-radius: 100px;
  background: var(--press);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row__snippet {
  font-size: 13px;
  color: var(--faint);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
}

/* Unread: trailing dot and a heavier sender (screens 09, 11) */
.row[data-unread="true"] {
  padding-right: calc(var(--row-pad-x) + 20px);
}

.row[data-unread="true"]::after {
  content: "";
  position: absolute;
  right: var(--row-pad-x);
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-solid);
  transform: translateY(-50%);
}

.row[data-unread="true"] .row__from {
  font-weight: 700;
}

/* Only the freshly arrived row carries a heavier subject and time (11) */
.row.row--highlight .row__from {
  font-weight: 600;
}

.row.row--highlight .row__subject {
  font-weight: 600;
  color: var(--text);
}

.row.row--highlight .row__time {
  color: var(--text);
  font-weight: 700;
}

/* Empty + error + skeleton states */
.placeholder {
  padding: 56px 40px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.placeholder__icon {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: var(--press);
  display: grid;
  place-items: center;
  color: var(--faint);
  margin-bottom: 6px;
}

.placeholder__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}

.placeholder__body {
  font-size: 13px;
  margin: 0;
  max-width: 280px;
  line-height: 1.55;
  color: var(--muted);
}

/* Inbox zero (screen 14): larger disc + title, search escape hatch */
.placeholder__icon--lg {
  width: 72px;
  height: 72px;
  color: var(--text);
}

.placeholder__title--lg {
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.placeholder__icon--lg ~ .placeholder__body {
  font-size: 14px;
  max-width: 308px;
}

.placeholder > .pill {
  margin-top: 6px;
}

.placeholder__icon--lg ~ .pill {
  padding: 10px 20px;
  font-size: 14px;
}

/* Snoozed wake time + trash countdown in the row's time slot */
.row__time--wake {
  color: var(--text-3);
  font-weight: 600;
}

.row__time--danger {
  color: var(--danger);
  font-weight: 600;
}

.placeholder__address {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: var(--press);
}

/* Skeleton rows (screen 08) */
.skeleton {
  display: flex;
  gap: 12px;
  padding: 14px var(--row-pad-x);
  border-bottom: 1px solid var(--hairline-2);
}

.skeleton__avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--separator);
}

.skeleton__lines {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  flex: 1 1 auto;
  padding-top: 0;
}

.skeleton__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.skeleton__bar {
  height: 12px;
  border-radius: 6px;
  background: var(--separator);
}

.skeleton__bar--from {
  width: 40%;
  min-width: 80px;
  flex: 0 1 auto;
}

.skeleton__bar--time {
  width: 32px;
  height: 8px;
  flex: 0 0 auto;
  opacity: 0.6;
}

.skeleton__bar--subject {
  width: 85%;
  height: 10px;
  margin-top: 8px;
  background: var(--hairline-2);
}

.skeleton__bar--snippet {
  width: 60%;
  height: 10px;
  margin-top: 6px;
  background: var(--hairline-2);
}

/* First-sync footer under the boot skeleton (screen 08). The note sits at
   the foot of the frame, so the list stretches while the note is present. */
.screen--inbox:has(.skeleton-note),
.screen--inbox:has(.skeleton-note) .inbox,
.screen--inbox:has(.skeleton-note) .inbox__list {
  display: flex;
  flex-direction: column;
}

.screen--inbox:has(.skeleton-note) .inbox,
.screen--inbox:has(.skeleton-note) .inbox__list {
  flex: 1 1 auto;
}

.screen--inbox:has(.skeleton-note) .inbox {
  padding-bottom: var(--safe-bottom);
}

.skeleton-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px var(--gutter);
  border-top: 1px solid var(--hairline-2);
  font-size: 12px;
  color: var(--faint);
}

.skeleton-note svg {
  flex: 0 0 auto;
}

/* Compose FAB */
.fab {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(18px + var(--safe-bottom));
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(23, 24, 26, 0.28);
  z-index: 20;
  transition: transform 0.12s ease;
}

.fab:active {
  transform: scale(0.94);
}

/* Jump pill (new mail while scrolled down) */
.jump-pill {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-solid);
  color: var(--on-accent);
  border-radius: 100px;
  padding: 8px 16px;
  min-height: 36px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(23, 24, 26, 0.3);
  z-index: 25;
}

/* Multi-select bars */
.msel-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px var(--gutter);
}

.msel-top__count {
  font-size: 18px;
  font-weight: 700;
  margin-right: auto;
}

.msel-top__action {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.msel-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--separator);
  padding: 10px 12px calc(var(--safe-bottom) + 18px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 30;
}

.msel-bottom__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  min-height: 44px;
}

.msel-bottom__action--danger {
  color: var(--danger);
}

/* ── Detail / thread screen ─────────────────────────────── */
.screen--detail {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.detail {
  flex: 1 1 auto;
  padding-top: calc(var(--safe-top) + 16px);
  padding-bottom: 24px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.detail__subject,
.thread__subject {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--text);
}

.detail__subject:focus,
.thread__subject:focus {
  outline: none;
}

.thread__chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--separator);
}

.tchip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--press);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
}

.tchip--dark {
  background: var(--accent-solid);
  color: var(--on-accent);
}

/* One message in the stacked thread view */
.msg {
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline-2);
}

.msg:last-of-type {
  border-bottom: 0;
}

.msg__head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  min-width: 0;
}

.msg__avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--separator);
  color: var(--text-2);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.msg__avatar--own {
  background: var(--accent-solid);
  color: var(--on-accent);
}

.msg__id {
  min-width: 0;
  flex: 1 1 auto;
}

.msg__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg__name-you {
  font-weight: 400;
  color: var(--faint);
}

.msg__meta {
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg__time {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.msg__actions {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}

.msg-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 44px;
  padding: 0 2px;
}

.msg-action--danger {
  color: var(--danger);
}

/* Collapsed older message (screen 16): one line, tap to expand */
.msgc {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline-2);
  min-height: 48px;
  color: var(--faint);
}

.msgc__avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--separator);
  color: var(--faint);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.msgc__name {
  flex: 0 0 auto;
  max-width: 40%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msgc__snippet {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msgc__date {
  flex: 0 0 auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Outbound send states (screen 19) */
.msg--sending {
  opacity: 0.7;
}

.msg--failed {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1.5px solid var(--danger);
  border-radius: var(--r-md);
}

/* The failed card is usually the last message in the thread, where
   .msg:last-of-type would otherwise strip the bottom of its outline. */
.msg--failed:last-of-type {
  border-bottom: 1.5px solid var(--danger);
}

.msg-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.msg-status--danger {
  color: var(--danger);
  font-weight: 700;
}

.msg__pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Links outside the sandbox (screen 17) */
.thread-links {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0 0;
  min-width: 0;
}

.thread-links__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 2px;
  flex: 0 0 auto;
}

.thread-links__note {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--faint);
  min-width: 0;
}

/* Legacy single-message sender block (trash + deep-link view) */
.sender-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
}

.sender-block__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.sender-block__address {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}

.sender-block__route {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.sender-block__time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

.sender-block__block {
  position: absolute;
  top: 10px;
  right: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 4px 6px;
  min-height: 32px;
  border-radius: var(--r-sm);
}

.sender-block__block:active {
  background: var(--press);
  color: var(--danger);
}

.detail__body {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.sender-block ~ .detail__body {
  margin-top: 20px;
  font-size: 15px;
}

.detail__body--empty {
  color: var(--muted);
  font-style: italic;
}

.detail__body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.detail__html-frame {
  display: block;
  width: 100%;
  height: 1px;
  border: 0;
  background: var(--bg);
  margin: 8px 0;
  border-radius: var(--r-md);
  transition: height 0.18s ease;
}

/* Remote-content banner above HTML mail (screen 18) */
.remote-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--separator);
  border-radius: 16px;
  background: var(--surface);
}

.remote-banner__icon {
  flex: 0 0 auto;
  color: var(--text);
  margin-top: 1px;
}

.remote-banner__meta {
  flex: 1 1 auto;
  min-width: 0;
}

.remote-banner__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.remote-banner__sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.45;
}

.remote-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.remote-banner__actions .minipill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spec 18 sets both banner pills at 600; the primary weight elsewhere
   (outbox Retry) stays 700. */
.remote-banner__actions .minipill--primary {
  font-weight: 600;
}

.remote-banner:not([hidden]) + .detail__html-frame {
  margin-top: 8px;
}

/* Small screens: HTML mail runs edge to edge. */
@media (max-width: 600px) {
  .detail__html-frame {
    /* iframes are replaced elements: width auto would collapse to the
       intrinsic 300px, so the bleed must be added explicitly. */
    width: calc(
      100% + max(var(--gutter), var(--safe-left)) +
        max(var(--gutter), var(--safe-right))
    );
    margin-left: calc(-1 * max(var(--gutter), var(--safe-left)));
    margin-right: calc(-1 * max(var(--gutter), var(--safe-right)));
    border-radius: 0;
  }
}

.attachments {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.attachment {
  display: grid;
  grid-template-columns: 34px 1fr 24px;
  column-gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--r-md);
  width: 100%;
  transition: background-color 0.12s ease;
}

.attachment:active {
  background: var(--press);
}

.attachment__icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

.attachment__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.attachment__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment__size {
  font-size: 11px;
  line-height: 1.55;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.attachment__chev {
  color: var(--faint);
  justify-self: end;
}

.attachment[data-busy="true"] .attachment__chev svg {
  animation: spin 0.9s linear infinite;
}

/* Bottom actions on detail: legacy buttons or the reply bar */
.detail__actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--separator);
  padding: 10px max(var(--gutter), var(--safe-right))
    calc(var(--safe-bottom) + 10px) max(var(--gutter), var(--safe-left));
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.detail__actions:empty {
  display: none;
}

/* Reply bar pinned at the bottom of a thread */
.replybar {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.replybar__field {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--press);
  border-radius: 100px;
  padding: 11px 16px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replybar__send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

/* Buttons (legacy actions, dialogs) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  background: var(--press);
  color: var(--text);
  transition:
    background-color 0.12s ease,
    transform 0.12s ease,
    opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.btn--danger {
  color: var(--danger);
}

.btn--danger:active {
  background: var(--danger-bg);
}

.btn--primary {
  background: var(--accent-solid);
  color: var(--on-accent);
  font-weight: 700;
}

.btn--primary:active {
  background: color-mix(in srgb, var(--accent-solid) 86%, var(--bg));
}

.detail__actions .btn--primary {
  flex: 1 1 auto;
}

.btn--wide {
  width: 100%;
}

.btn[data-busy="true"] {
  opacity: 0.7;
  pointer-events: none;
}

/* ── Compose screen ─────────────────────────────────────── */
.screen--compose {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.compose {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding-top: calc(var(--safe-top) + 16px);
}

.compose__head {
  padding: 0 max(var(--gutter), var(--safe-right)) 12px
    max(var(--gutter), var(--safe-left));
}

.compose__title {
  margin: 0 0 3px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
}

.compose__title:focus {
  outline: none;
}

.compose__from {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  min-width: 0;
}

.compose__from-addr {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Compose title row: title left, attach paperclip right */
.compose__head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.compose__head-row .icon-button {
  margin: -8px -10px 0 0;
  color: var(--muted);
}

/* From row opens the picker sheet (screen 21) */
.compose__from-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 32px;
  padding: 2px 0;
  color: inherit;
  font-size: inherit;
}

.compose__from-btn[disabled] {
  pointer-events: none;
}

.compose__from-chev {
  flex: 0 0 auto;
  color: var(--muted);
}

.compose__form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.field {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  column-gap: 10px;
  padding: 0 max(var(--gutter), var(--safe-right)) 0
    max(var(--gutter), var(--safe-left));
  border-top: 1px solid var(--hairline-2);
}

.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  -webkit-user-select: none;
  user-select: none;
}

.field__input {
  border: 0;
  background: transparent;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  color: var(--text);
  padding: 14px 0;
  min-width: 0;
  outline: none;
  border-radius: 0;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.field__input::placeholder,
.compose__body::placeholder {
  color: var(--faint);
}

/* Recipient chips (screen 22) */
.field--chips {
  align-items: flex-start;
  grid-template-columns: 44px 1fr auto;
}

.field--chips .field__label {
  padding-top: 17px;
}

.rchips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 0;
  min-width: 0;
  min-height: 48px;
}

.rchips__input {
  flex: 1 1 120px;
  min-width: 90px;
  border: 0;
  background: transparent;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  color: var(--text);
  padding: 8px 0;
  min-height: 36px;
  outline: none;
  border-radius: 0;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.rchips__input::placeholder {
  color: var(--faint);
}

.rchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--press);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rchip svg {
  flex: 0 0 auto;
}

.rchip--invalid {
  background: var(--danger-bg);
  color: var(--danger);
}

/* Cc/Bcc reveal at the trailing edge of the To row */
.field__ccbtn {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  min-height: 44px;
  padding: 8px 2px 0;
  align-self: flex-start;
}

.field__error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 600;
  line-height: 1.55;
  margin: 0;
  padding: 0 max(var(--gutter), var(--safe-right)) 8px
    calc(max(var(--gutter), var(--safe-left)) + 54px);
}

/* Attachment stack in compose */
.compose__atts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 max(var(--gutter), var(--safe-right)) 12px
    max(var(--gutter), var(--safe-left));
}

.catt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 14px;
}

/* Over-limit / failed cards stack an action row under the meta, so the
 * disc aligns to the filename rather than to the whole card. */
.catt--error {
  background: var(--danger-bg);
  align-items: flex-start;
}

.catt__icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

.catt__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.catt__name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catt__status {
  font-size: 11px;
  line-height: 1.55;
  color: var(--faint);
  margin-top: 0;
}

/* Only the uploading card needs air under the progress track. */
.catt .progress + .catt__status {
  margin-top: 4px;
}

.catt--error .catt__status {
  color: var(--danger);
  font-weight: 600;
}

.catt__icon--quiet {
  background: var(--separator);
  color: var(--text-2);
}

.catt__icon--danger {
  background: var(--danger);
  color: #ffffff;
}

/* Upload progress: 5px per spec, inside the chip row */
.catt .progress {
  height: 5px;
  margin-top: 6px;
  background: var(--separator);
}

.catt__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Screen 23 sets the attachment CTA a notch lighter than the send-state
 * Retry pill, which stays at 700. */
.catt__actions .minipill--primary {
  font-weight: 600;
}

.catt__x {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--faint);
}

.catt__x:active {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

/* Small action pills (send states, attachment cards, image banner) */
.minipill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  background: var(--press);
  color: var(--text-3);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.minipill:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.minipill--primary {
  background: var(--accent-solid);
  color: var(--on-accent);
  font-weight: 700;
}

.minipill--bare {
  background: transparent;
  color: var(--faint);
  padding: 8px 4px;
}

.minipill[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.compose__body {
  flex: 1 1 auto;
  border: 0;
  border-top: 1px solid var(--hairline-2);
  background: transparent;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  padding: 14px max(var(--gutter), var(--safe-right))
    calc(var(--safe-bottom) + 28px) max(var(--gutter), var(--safe-left));
  min-height: 38vh;
  resize: none;
  outline: none;
  border-radius: 0;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
  overflow: hidden;
}

.compose__footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--separator);
  padding: 12px max(var(--gutter), var(--safe-right))
    12px max(var(--gutter), var(--safe-left));
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
}

.compose__footnote-save {
  margin-left: auto;
  white-space: nowrap;
}

.compose__fallback {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--separator);
  padding: 10px max(var(--gutter), var(--safe-right))
    calc(var(--safe-bottom) + 10px) max(var(--gutter), var(--safe-left));
}

.field__input:focus-visible,
.compose__body:focus-visible {
  outline: none;
}

/* ── Settings screen ────────────────────────────────────── */
.screen--settings {
  background: var(--bg);
}

.settings {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 16px) max(var(--gutter), var(--safe-right))
    calc(var(--safe-bottom) + 24px) max(var(--gutter), var(--safe-left));
}

.settings__title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
}

.settings__title:focus {
  outline: none;
}

.settings .section-heading {
  margin-top: 10px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hairline-2);
  border-radius: var(--r-md);
  overflow: hidden;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  background: var(--surface);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.setting__meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.setting__label {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
}

.setting__hint {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.55;
}

.setting--column {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  cursor: text;
}

.setting--column .setting__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

.setting__input {
  border: 0;
  background: transparent;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  padding: 2px 0;
  min-width: 0;
  outline: none;
  border-radius: 0;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.setting__input::placeholder {
  color: var(--faint);
}

.setting__input:focus-visible {
  outline: none;
}

.setting__input:disabled {
  opacity: 0.55;
}

.settings__note {
  margin: 10px 4px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--faint);
}

/* Segmented control (theme picker) */
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-top: 8px;
  background: var(--press);
  border-radius: 100px;
}

.segmented__option {
  flex: 1 1 0;
  text-align: center;
  padding: 8px 0;
  min-height: 36px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-3);
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.segmented__option[aria-checked="true"] {
  background: var(--accent-solid);
  color: var(--on-accent);
}

/* Toggle: 46x28 pill, 22px knob */
.switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
}

.switch input {
  position: absolute;
  inset: -8px;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.switch__track {
  display: block;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 12%, var(--bg));
  transition: background-color 0.2s ease;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.switch input:checked ~ .switch__track {
  background: var(--accent-solid);
}

[data-color-scheme="dark"] .switch input:checked ~ .switch__track .switch__thumb {
  background: var(--bg);
}

.switch input:checked ~ .switch__track .switch__thumb {
  transform: translateX(18px);
}

.switch input:disabled ~ .switch__track {
  opacity: 0.55;
}

.switch input:focus-visible ~ .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Addresses list (settings) */
.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
}

.address-row__value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.address-row__tag {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--on-accent);
  background: var(--accent-solid);
  border-radius: 100px;
  padding: 2px 8px;
}

.address-row__tag--quiet {
  background: var(--press);
  color: var(--muted);
  font-weight: 600;
}

/* Blocked senders list */
.blocked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
}

.blocked-row__value {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.blocked-row__unblock {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  padding: 6px 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Plus card (settings; wired in a later stage) */
.plus-card {
  margin-top: 14px;
  border-radius: var(--r-lg);
  background: #17181A;
  color: #ffffff;
  padding: 18px;
}

.plus-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
}

.plus-card__body {
  margin: 6px 0 0;
  font-size: 13px;
  color: #B9BCC1;
  line-height: 1.6;
}

.plus-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.plus-card__cta {
  background: #ffffff;
  color: #17181A;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
}

.plus-card__price {
  font-size: 13px;
  line-height: 1.55;
  color: #B9BCC1;
}

/* ── Sub-page screens (addresses, search, onboarding, offline) ── */
.subpage {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding-top: calc(var(--safe-top) + 4px);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

.subpage__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--separator);
}

.subpage__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.subpage .kicker {
  padding: 14px var(--gutter) 4px;
  line-height: 1.55;
}

.plainrow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px var(--gutter);
  border-bottom: 1px solid var(--hairline-2);
  min-height: 44px;
}

.plainrow__icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--press);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.plainrow__icon--dashed {
  background: transparent;
  border: 1.5px dashed var(--faint);
  color: var(--text-3);
  font-size: 15px;
  font-weight: 400;
}

.plainrow__meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.plainrow__title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plainrow__title--mono {
  font-family: var(--font-mono);
}

.plainrow__sub {
  display: block;
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plainrow__trailing {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.55;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--accent-solid);
  color: var(--on-accent);
}

.badge--quiet {
  background: var(--press);
  color: var(--muted);
  font-weight: 600;
}

.badge--gmail {
  background: var(--gmail);
  color: #ffffff;
}

.burn-btn {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  padding: 7px 14px;
  min-height: 34px;
  border-radius: 100px;
}

.infonote {
  margin: 16px var(--gutter);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* Onboarding */
.onb {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(var(--safe-bottom) + 20px);
}

.onb__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px;
  color: var(--faint);
}

.onb__wordmark {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.onb__body {
  padding: 30px 26px 0;
}

.onb__lead {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.onb__address {
  margin-top: 16px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

/* Prefer the line break between the local part and the domain, the way
   the spec renders it; each span still wraps internally as a last resort. */
.onb__address > span {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.onb__address .dim,
.onb__domain {
  color: var(--faint);
}

.onb__pills {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.onb__card {
  margin: 24px 18px 0;
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
}

.onb__card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.onb__free {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.onb__card-name {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
  word-break: break-all;
}

.onb__card-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.onb__card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.onb__list {
  margin-top: auto;
  padding: 0 18px 8px;
}

.onb__row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border-top: 1px solid var(--hairline-2);
  padding: 13px 8px;
  font-size: 14px;
  color: var(--text-3);
  min-height: 44px;
}

.onb__row b {
  font-weight: 600;
  color: var(--text);
}

.onb__row-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--press);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.onb__row-icon--gmail {
  color: var(--gmail);
}

.onb__row-chev {
  margin-left: auto;
  color: var(--faint);
  flex: 0 0 auto;
}

.onb__footer {
  padding: 16px 26px 6px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Screen 01: the CTA sits on the 18px gutter, 14px under the last row. */
[data-role="onb-default"]:not([hidden]) ~ .onb__footer {
  padding: 6px 18px 6px;
}

/* Screen 04: the confirmation CTA is pinned to the bottom of the frame. */
[data-role="onb-claimed"]:not([hidden]) ~ .onb__footer {
  margin-top: auto;
  padding: 26px 26px 6px;
}

/* Screen 01: "Pick another" is the quieter half of the card actions. */
.onb__card-actions .ghost {
  font-size: 13px;
  color: var(--text-3);
}

/* Screen 02: the editor's own footer sits at the bottom of the frame. */
[data-role="onb-editor"]:not([hidden]) {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

[data-role="onb-editor"] > .onb__footer {
  margin-top: auto;
}

/* Name editor state */
.onb__focus-card {
  margin: 20px 18px 0;
  background: var(--bg);
  border: 1.5px solid var(--accent-solid);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(23, 24, 26, 0.08);
}

.onb__input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--press);
  border-radius: 12px;
  padding: 3px 3px 3px 14px;
  margin-top: 10px;
}

.onb__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-mono);
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  min-height: 44px;
  outline: none;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.onb__suffix {
  flex: 0 0 auto;
  background: var(--bg);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.onb__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-3);
}

.onb__status[data-tone="error"] {
  color: var(--danger);
  font-weight: 600;
}

/* The spinner is quieter than the label it sits next to. */
.onb__status:not([data-tone]) svg {
  color: var(--faint);
}

/* Screen 03: a taken name tints the field it was typed into. */
.onb__focus-card:has(.onb__status[data-tone="error"]) .onb__input-row {
  background: var(--danger-bg);
  box-shadow: inset 0 0 0 1.5px var(--danger);
}

.onb__suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.onb__rules {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--faint);
}

/* Screen 04: the confirmation sits lower and its headline is a step
   smaller than the first-run address, which has to carry the screen. */
[data-role="onb-claimed"] .onb__body {
  padding-top: 40px;
}

[data-role="onb-claimed"] .onb__address {
  font-size: 30px;
  line-height: 1.12;
}

[data-role="onb-claimed"] .onb__pills {
  margin-top: 18px;
}

.onb__check {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: var(--accent-solid);
  color: var(--on-accent);
  display: grid;
  place-items: center;
}

.onb__infostrip {
  margin: 26px 18px 0;
  background: var(--surface);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
}

.onb__infostrip-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--separator);
  display: grid;
  place-items: center;
  color: var(--text);
}

/* Search screen (screens 25-26) */
.searchpage {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}

.searchpage .inbox__list {
  flex: 0 0 auto;
}

.searchpage__fromrow {
  padding: 8px 14px;
  border-bottom: 1px solid var(--separator);
}

.searchpage__from-input {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--press);
  padding: 0 14px;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  color: var(--text);
  outline: none;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.searchpage__from-input::placeholder {
  color: var(--faint);
}

.searchpage__recent-kicker {
  padding: 16px var(--gutter) 4px;
  border-top: 1px solid var(--hairline-2);
}

.searchpage .placeholder {
  padding: 44px 40px 28px;
  gap: 12px;
}

.searchpage .placeholder__title {
  line-height: 1.55;
}

.searchpage .placeholder__body {
  max-width: 308px;
}

/* Screen 26 spaces the escape hatch on the block's own gap. */
.searchpage .placeholder > .pill {
  margin-top: 0;
  padding: 9px 18px;
}

.searchpage__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--separator);
}

.searchpage__chips {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--separator);
  overflow-x: auto;
  scrollbar-width: none;
}

.searchpage__chips::-webkit-scrollbar {
  display: none;
}

.searchpage__chips .chip {
  padding: 6px 12px;
  line-height: 1.55;
}

.searchpage .kicker {
  line-height: 1.55;
}

.searchpage__count {
  padding: 12px var(--gutter) 4px;
}

.searchpage__footer {
  margin: 0;
  padding: 14px var(--gutter);
  font-size: 12px;
  line-height: 1.55;
  color: var(--faint);
}

.searchpage mark {
  background: color-mix(in srgb, var(--text) 12%, var(--bg));
  color: var(--text);
  font-weight: 700;
  padding: 0 1px;
  border-radius: 3px;
}

.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px var(--gutter);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-2);
  border-bottom: 1px solid var(--hairline-2);
  min-height: 44px;
}

.recent-row svg {
  color: var(--faint);
  flex: 0 0 auto;
}

/* Connection lost */
.connlost {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: calc(var(--safe-top) + 8px);
  padding-bottom: calc(var(--safe-bottom) + 20px);
}

.connlost__center {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 44px;
  text-align: center;
}

.connlost__icon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: var(--press);
  color: var(--faint);
  display: grid;
  place-items: center;
}

.connlost__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: -0.02em;
}

.connlost__body {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.connlost__retry {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  background: var(--accent-solid);
  color: var(--on-accent);
  padding: 12px 26px;
  min-height: 44px;
  border-radius: 100px;
}

.connlost__cached {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── Bottom sheets ──────────────────────────────────────── */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 24, 26, 0.35);
}

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 8px 18px calc(var(--safe-bottom) + 20px);
  max-height: 86vh;
  overflow-y: auto;
  animation: sheetUp 0.24s cubic-bezier(0.3, 0.8, 0.3, 1) both;
}

@keyframes sheetUp {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sheet__handle {
  width: 36px;
  height: 4px;
  border-radius: 100px;
  background: var(--separator);
  margin: 6px auto 12px;
}

.sheet__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
}

.sheet__sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* Screen 24: "Keep writing" is the quiet third option, not a hint. */
.sheet__panel .ghost {
  color: var(--text-3);
}

.sheet .kicker {
  padding: 12px 0 4px;
  line-height: 1.55;
}

/* Screen 32: the first kicker sits tight under the handle. */
[data-role="sheet-folders"] .kicker:first-of-type {
  padding-top: 4px;
}

/* Rows inside sheets (inboxes, actions) */
.sheetrow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline-2);
  min-height: 44px;
}

.sheetrow:last-child {
  border-bottom: 0;
}

.sheetrow__icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--press);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.sheetrow__icon--ink {
  background: var(--accent-solid);
  color: var(--on-accent);
}

.sheetrow__icon--gmail {
  background: var(--gmail);
  color: #ffffff;
}

.sheetrow__icon--dashed {
  background: transparent;
  border: 1.5px dashed var(--faint);
  color: var(--text-3);
  font-size: 16px;
  font-weight: 600;
}

/* Compact round avatar variant (From picker, screen 21) */
.sheetrow__icon--av {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 11px;
}

.sheetrow__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheetrow__name--mono {
  font-family: var(--font-mono);
}

/* Mono is for the address itself; the caption under it is prose. */
.sheetrow__name--mono .sheetrow__sub {
  font-family: var(--font-stack);
}

.sheetrow__sub {
  font-size: 12px;
  color: var(--faint);
  font-weight: 400;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheetrow__count {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sheetrow__check {
  flex: 0 0 auto;
  color: var(--text);
}

/* The From picker appends the check only to the current row; the static
   "All inboxes" row carries it always, so hide it off the current row. */
.sheetrow:not([aria-current="true"]) .sheetrow__check {
  display: none;
}

/* Screen 10: the inbox switcher runs on a larger rhythm than the
   generic sheet row shared with the link and From pickers. */
[data-role="sheet-folders"] .sheetrow {
  padding: 13px 0;
}

[data-role="sheet-folders"] .sheetrow__icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 13px;
}

[data-role="sheet-folders"] .sheetrow__icon--dashed {
  font-size: 18px;
}

[data-role="sheet-folders"] .sheetrow__name {
  font-size: 15px;
}

.sheetrow[aria-current="true"] .sheetrow__name {
  font-weight: 700;
}

/* Folder grid in the switcher sheet */
.folder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.folder-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline-2);
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  color: var(--text);
}

.folder-cell svg {
  flex: 0 0 auto;
  color: var(--text-3);
}

.folder-cell[aria-current="true"] {
  font-weight: 700;
}

/* Screen 32: the last grid row runs into the Outbox rule above it, so it
   drops its own hairline rather than doubling up. */
.folder-cell:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.folder-cell__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.outbox-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 0 0;
  border-top: 1px solid var(--separator);
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  color: var(--text);
}

.outbox-cell svg {
  flex: 0 0 auto;
  color: var(--text-3);
}

/* Screen 32: mail actually stuck in the outbox turns the whole row red,
   icon and label included. An empty outbox stays quiet. */
.outbox-cell:has(.outbox-cell__count:not(:empty)) {
  color: var(--danger);
}

.outbox-cell:has(.outbox-cell__count:not(:empty)) svg {
  color: currentColor;
}

.outbox-cell__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
}

/* Action rows (sender sheet, snooze sheet) */
.actrow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 0;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 500;
  border-bottom: 1px solid var(--hairline-2);
  min-height: 44px;
  color: var(--text);
}

.actrow svg {
  flex: 0 0 auto;
  color: var(--text-3);
}

.actrow--danger {
  font-weight: 700;
  color: var(--danger);
}

.actrow--danger svg {
  color: var(--danger);
}

.actrow__note {
  margin: 4px 0 8px 29px;
  font-size: 12px;
  color: var(--faint);
}

.sheet__context {
  margin: 0;
  padding: 4px 0 10px;
  font-size: 12px;
  color: var(--faint);
  border-bottom: 1px solid var(--hairline-2);
  font-family: var(--font-mono);
}

/* Plan cards in the Plus sheet */
.plan-cards {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.plan-card {
  flex: 1 1 0;
  text-align: center;
  border-radius: 12px;
  padding: 10px 0 8px;
  border: 1px solid var(--separator);
  color: var(--text-3);
}

.plan-card[aria-pressed="true"] {
  border: 1.5px solid var(--accent-solid);
  color: var(--text);
}

.plan-card__price {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

.plan-card__per {
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.plan-card__approx {
  display: block;
  font-size: 11px;
  line-height: 1.55;
  color: var(--faint);
  margin-top: 2px;
}

.feature-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  line-height: 1.55;
  padding: 7px 0;
}

.feature-row svg {
  flex: 0 0 auto;
  color: var(--text);
}

.sheet__legal {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  line-height: 1.55;
}

/* Burner sheet address box */
.burner-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 14px;
}

.burner-box__addr {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
  word-break: break-all;
}

.burner-box__reroll {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--separator);
  display: grid;
  place-items: center;
  color: var(--text);
}

.sheet__footnote {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}

/* Storage meter row (settings) */
.storage-row__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

/* ── Link sheet: IMAP form ──────────────────────────────── */
.sheetform {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheetform .sheetform {
  margin-top: 0;
}

.sheetform__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sheetform__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
}

.sheetform__input {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--press);
  padding: 0 14px;
  font-family: inherit;
  /* ≥16px: iOS WebKit auto-zooms on focus for anything smaller */
  font-size: 16px;
  color: var(--text);
  outline: none;
  caret-color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}

.sheetform__input--mono {
  font-family: var(--font-mono);
}

.sheetform__input::placeholder {
  color: var(--faint);
}

.sheetform__row {
  display: flex;
  gap: 10px;
}

.sheetform__row .sheetform__field {
  flex: 1 1 0;
}

.sheetform__row .sheetform__field--wide {
  flex: 2 1 0;
}

.sheetform__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.sheetform__toggle-label {
  font-size: 14px;
  font-weight: 600;
}

.sheetform__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Linked account card (link sheet + addresses screen) */
.linked-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  margin: 10px var(--gutter) 0;
}

.sheet .linked-card {
  margin: 10px 0 0;
}

.linked-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.linked-card__icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--press);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.linked-card__icon--gmail {
  background: var(--gmail);
  color: #ffffff;
}

.linked-card__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.linked-card__addr {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linked-card__state {
  font-size: 12px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linked-card__state[data-tone="error"] {
  color: var(--danger);
}

.linked-card__pct {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.linked-card .progress {
  margin-top: 12px;
  background: var(--separator);
}

.linked-card__caption {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}

.linked-card__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

/* Plus card active state line */
.plus-card__status {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 600;
}

/* Settings addresses: link-another row */
.address-row--link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  justify-content: flex-start;
}

.address-row__tag--gmail {
  background: var(--gmail);
  color: #ffffff;
  font-weight: 700;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 24px);
  transform: translateX(-50%);
  padding: 13px 20px;
  border-radius: 100px;
  background: #17181A;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1);
  box-shadow: 0 8px 24px rgba(23, 24, 26, 0.25);
  max-width: 84vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Undo toasts span the gutter with the action at the far edge (12) */
.toast[data-actionable="true"] {
  pointer-events: auto;
  display: flex;
  align-items: center;
  width: calc(100% - 36px);
  max-width: 352px;
}

.toast__action {
  margin-left: 12px;
  font-weight: 700;
  color: inherit;
}

.toast[data-actionable="true"] .toast__action {
  margin-left: auto;
}

/* ── Screen transitions ─────────────────────────────────── */
.screen[data-entering="true"] {
  animation: fadeIn 0.18s ease-out both;
}

.screen--detail[data-entering="true"],
.screen--settings[data-entering="true"],
.screen--addresses[data-entering="true"] {
  animation: slideInRight 0.24s cubic-bezier(0.3, 0.8, 0.3, 1) both;
}

.screen--compose[data-entering="true"],
.screen--search[data-entering="true"] {
  animation: slideUp 0.26s cubic-bezier(0.3, 0.8, 0.3, 1) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Accessibility / motion ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Focus visibility (keyboard) ───────────────────────── */
:focus {
  outline: none;
}
:focus-visible {
  /* Ink, not accent blue: the only blue in the system is links */
  outline: 1.5px solid var(--text);
  outline-offset: 2px;
  border-radius: inherit;
}

/* ── Dark scheme refinements ───────────────────────────── */
[data-color-scheme="dark"] .toast {
  background: #F2F3F5;
  color: #17181A;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-color-scheme="dark"] .fab,
[data-color-scheme="dark"] .jump-pill {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* ── Wide layouts (screens 35-36) ─────────────────────────────
   Under 760px nothing here applies and the phone app is untouched.
   760 to 1100px: two panes (list 360px + thread). Above 1100px the
   248px folder rail joins, search moves inline, compose docks. */

.rail,
.rail-search,
.detail-empty {
  display: none;
}

@media (min-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: 100dvh;
    overflow: hidden;
  }

  .app > .screen {
    grid-column: 1 / -1;
    grid-row: 1;
    overflow-y: auto;
    height: 100dvh;
  }

  .app > .screen--inbox {
    grid-column: 1;
    border-right: 1px solid var(--separator);
    background: var(--bg);
  }

  .app > .screen--detail {
    grid-column: 2;
    background: var(--surface);
  }

  /* Selected thread row: flat press fill, ring recolors, dot hides */
  li[aria-current="true"] .row {
    background: var(--press);
  }
  li[aria-current="true"] .row__srcbadge {
    box-shadow: 0 0 0 2px var(--press);
  }
  li[aria-current="true"] .row[data-unread="true"]::after {
    display: none;
  }

  /* Full-width screens center their content column */
  .screen--settings .settings,
  .screen--addresses > *,
  .searchpage > *,
  .screen--onboarding .onb,
  .connlost__center {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }

  /* The thread pane empty state (no frame in the spec; quiet graphite) */
  .detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 70dvh;
    color: var(--faint);
  }
  .detail-empty[hidden] {
    display: none !important;
  }
  .detail-empty__disc {
    width: 64px;
    height: 64px;
    border-radius: 999px;
    background: var(--press);
    display: grid;
    place-items: center;
    color: var(--muted);
  }
  .detail-empty__hint {
    font-size: 13px;
    color: var(--faint);
  }
}

@media (min-width: 1100px) {
  .app {
    grid-template-columns: 248px 380px 1fr;
  }

  .app > .rail {
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 1;
    height: 100dvh;
    overflow-y: auto;
    padding: 20px 14px 16px;
    background: var(--surface);
    border-right: 1px solid var(--separator);
  }

  .app > .screen {
    grid-column: 2 / -1;
  }
  .app > .screen--inbox {
    grid-column: 2;
  }
  .app > .screen--detail {
    grid-column: 3;
  }

  /* Rail anatomy (screen 36) */
  .rail__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
  }
  .rail__mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--accent-solid);
    color: var(--on-accent);
    display: grid;
    place-items: center;
  }
  .rail__wordmark {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }
  .rail__compose {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    margin: 18px 0 8px;
    border: 0;
    border-radius: 100px;
    background: var(--accent-solid);
    color: var(--on-accent);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }
  .rail__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
    padding: 12px 8px 4px;
  }
  .rail__label--folders {
    padding-top: 14px;
  }
  .rail__inbox {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }
  .rail__inbox[aria-current="true"] {
    background: var(--separator);
  }
  .rail__inbox-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
  }
  .rail__inbox:first-child .rail__inbox-name {
    font-family: inherit;
    font-size: 13px;
  }
  .rail__dot {
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--text);
  }
  .rail__dot--gmail {
    background: var(--gmail);
  }
  .rail__folder {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
  }
  .rail__folder[aria-current="true"] {
    color: var(--text);
    font-weight: 600;
  }
  .rail__folder > span:nth-child(2) {
    flex: 1 1 auto;
  }
  .rail__count {
    font-size: 12px;
    color: var(--text-3);
  }
  .rail__inbox .rail__count {
    font-weight: 700;
    color: var(--text);
  }
  .rail__count--outbox:not(:empty) {
    color: var(--danger);
    font-weight: 600;
  }
  .rail__storage {
    margin-top: auto;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--separator);
    border-radius: 12px;
  }
  .rail__storage-head {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
  }
  .rail__storage-head span:last-child {
    font-weight: 400;
    color: var(--text-3);
  }
  .rail__storage-track {
    margin-top: 8px;
    height: 5px;
    border-radius: 100px;
    background: var(--press);
    overflow: hidden;
  }
  .rail__storage-fill {
    height: 100%;
    border-radius: 100px;
    background: var(--accent-solid);
  }
  .rail__profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 0;
  }
  .rail__avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--press);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
  }
  .rail__who {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .rail__name {
    font-size: 13px;
    font-weight: 600;
  }
  .rail__addr {
    font-size: 11px;
    color: var(--faint);
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .rail__gear {
    border: 0;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    padding: 6px;
  }

  /* List-pane header: inline search replaces the title block */
  [data-layout="rail"] .header-title,
  [data-layout="rail"] .address-pill,
  [data-layout="rail"] [data-role="search-open"],
  [data-layout="rail"] [data-role="settings-open"] {
    display: none;
  }
  [data-layout="rail"] .rail-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 100px;
    background: var(--press);
    color: var(--faint);
  }
  [data-layout="rail"] .rail-search__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    outline: none;
  }
  [data-layout="rail"] .rail-search__input::placeholder {
    color: var(--faint);
    font-size: 14px;
  }
  [data-layout="rail"] .rail-search__kbd {
    font-size: 11px;
    color: var(--faint);
    border: 1px solid var(--separator);
    border-radius: 5px;
    padding: 1px 6px;
  }

  /* Desktop has no FAB (rail owns New message) */
  [data-layout="rail"] .fab {
    display: none !important;
  }

  /* Docked compose card (screen 36) */
  [data-layout="rail"] .screen--compose {
    grid-column: 3;
    position: fixed;
    left: auto;
    top: auto;
    right: 26px;
    bottom: 22px;
    width: 380px;
    height: auto;
    min-height: 0;
    max-height: min(72dvh, 640px);
    overflow-y: auto;
    border: 1px solid var(--separator);
    border-radius: 16px;
    background: var(--bg);
    box-shadow: 0 24px 60px rgba(23, 24, 26, 0.22);
    z-index: 40;
  }
  [data-color-scheme="dark"] [data-layout="rail"] .screen--compose {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  }
}

/* The compose close cell exists only on wide layouts */
.compose__close {
  display: none;
}
@media (min-width: 760px) {
  [data-layout="split"] .compose__close,
  [data-layout="rail"] .compose__close {
    display: inline-flex;
  }
}

/* Docked compose interior (screen 36): the desktop thread pane has no
   inline reply bar (tablet keeps it), and the card runs compact: small
   Send pill left, autosave state at the card's bottom right. */
@media (min-width: 1100px) {
  [data-layout="rail"] .detail__actions:has(.replybar) {
    display: none;
  }
  [data-layout="rail"] .screen--compose .compose {
    position: relative;
    padding: 14px 16px 14px;
    max-width: none;
  }
  [data-layout="rail"] .screen--compose .compose__body {
    min-height: 72px;
  }
  [data-layout="rail"] .screen--compose .compose__fallback {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
    padding: 10px 0 0;
    border-top: 1px solid var(--hairline-2);
  }
  [data-layout="rail"] .screen--compose .compose__fallback .btn--wide {
    width: auto;
    min-height: 34px;
    padding: 0 18px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 100px;
  }
  [data-layout="rail"] .screen--compose .compose__footnote {
    margin-bottom: 0;
  }
  [data-layout="rail"] .screen--compose .compose__footnote-save {
    position: absolute;
    right: 16px;
    bottom: 22px;
    font-size: 11px;
    color: var(--faint);
  }
}

/* Sheets on wide layouts: the phone bottom sheet spanning a desktop
   viewport reads as a broken page; panels become centered dialogs. */
@media (min-width: 760px) {
  .sheet__panel {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(440px, calc(100vw - 48px));
    border-radius: 18px;
    padding: 14px 18px 20px;
    max-height: 82vh;
    box-shadow: 0 24px 60px rgba(23, 24, 26, 0.28);
    animation: dialogIn 0.18s ease-out both;
  }
  .sheet__handle {
    display: none;
  }
  @keyframes dialogIn {
    from {
      transform: translate(-50%, -48%);
      opacity: 0;
    }
    to {
      transform: translate(-50%, -50%);
      opacity: 1;
    }
  }
  [data-color-scheme="dark"] .sheet__panel {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

/* Wide layouts: pane-scoped chrome corrections from the screenshot
   review. Multi-select bars belong to the list pane, not the viewport;
   the folder title returns on desktop for non-inbox folders; onboarding
   loses its phone footer-pinning; the tablet FAB clears the reply bar. */
@media (min-width: 760px) {
  .msel-bottom {
    left: 0;
    right: auto;
    width: 360px;
    border-right: 1px solid var(--separator);
  }
  [data-layout="split"] .detail__actions {
    padding-right: 88px;
  }
  .screen--onboarding .onb [data-role] ~ .onb__footer,
  .screen--onboarding .onb .onb__footer {
    margin-top: 32px;
    padding-top: 0;
  }
  .screen--onboarding [data-role="onb-editor"]:not([hidden]) {
    flex: 0 0 auto;
  }
  .screen--onboarding [data-role="onb-editor"]:not([hidden]) ~ .onb__footer {
    margin-top: 24px;
  }
}
@media (min-width: 1100px) {
  .msel-bottom {
    left: 248px;
    width: 380px;
  }
  [data-layout="rail"][data-folder]:not([data-folder="inbox"]) .header-title {
    display: inline-flex;
    pointer-events: none;
  }
  [data-layout="rail"][data-folder]:not([data-folder="inbox"]) .header-title .header-title__chev {
    display: none;
  }
  .rail__storage-fill[data-tone="danger"] {
    background: var(--danger);
  }
}

.searchpage__idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 64px 32px;
  text-align: center;
  color: var(--faint);
}
.searchpage__idle-disc {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--press);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.searchpage__idle-copy {
  font-size: 13px;
  max-width: 260px;
}

/* The chips row carries its own focus affordance; a bare outline on the
   invisible inline input reads as a stray rectangle. */
.rchips__input:focus-visible {
  outline: none;
}
