/* inflite Mail. In keeping with the site's other apps (the account page, InFlight, Weather, Fitness): the account
   page's sky (night in dark mode, dawn in light) with its three slow lights, iOS 27's Liquid Glass over it (clear panes on
   the sky, the stronger blurred glass for what floats), the site's blue, and its motion. Light or Dark follows the
   account's Appearance (data-theme, set by theme.js and app.js), or the device when it's Automatic. */

:root {
    color-scheme: dark;
    --sky-a: #121a3c; --sky-b: #0a0f26; --sky-c: #05060e; --sky-top: #1b2860;
    --aura-1: rgba(80, 120, 255, 0.55); --aura-2: rgba(160, 90, 255, 0.4); --aura-3: rgba(40, 190, 230, 0.32);
    --text: #f5f6fb; --text-2: rgba(235, 238, 250, 0.72); --text-3: rgba(235, 238, 250, 0.56);
    --glass: rgba(34, 40, 66, 0.5); --glass-strong: rgba(28, 33, 56, 0.86); --glass-ctl: rgba(255, 255, 255, 0.1); --sheet: rgba(24, 28, 50, 0.94);
    --line: rgba(255, 255, 255, 0.1); --press: rgba(255, 255, 255, 0.07); --field: rgba(0, 0, 0, 0.24);
    --tint: #5aa9ff; --tint-deep: #2a6ae6; --tint-text: #8cc2ff; --danger: #ff6a5f; --good: #4fdc8e; --warn: #ffbd4a; --flag: #ffa53a;
    --edge: inset 0 1px 0.5px rgba(255, 255, 255, 0.42), inset 0 -1px 0.5px rgba(255, 255, 255, 0.08), inset 0 0 22px rgba(255, 255, 255, 0.03);
    --lift: 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 22px 44px -18px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.16);
    --sheen: radial-gradient(140% 90% at 12% -20%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 46%);
    --dim: rgba(0, 0, 0, 0.5);
    --mail-text: #f5f6fb; --mail-link: #8cc2ff; --mail-quote: rgba(235, 238, 250, 0.62); --mail-rule: rgba(235, 238, 250, 0.28);
  --blur: blur(28px) saturate(180%);

  /* Mail's own names for them */
  --red: var(--danger);
  --orange: var(--flag);
  --green: var(--good);
  --purple: #9b7bff;
  --bg: var(--sky-c);
  --bg-fill: var(--glass-ctl);
  --bg-fill-2: color-mix(in srgb, var(--glass-ctl), var(--text) 8%);
  --label: var(--text);
  --label-2: var(--text-2);
  --label-3: var(--text-3);
  --sep: var(--line);
  --glass-bg: var(--glass-strong);
  --glass-bg-strong: var(--glass-strong);
  --glass-shadow: var(--lift);
  --glass-inner: var(--edge);
  --glass-blur: var(--blur);
  --menu-bg: var(--sheet);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --kb: 0px;
  --nav-h: 54px;

  /* the motion every app on the site shares: glide (things put in place, and sheets), out (settling in), and a soft
     spring (about 2% past, for a press let go) */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: linear(0, 0.019, 0.067, 0.135, 0.214, 0.3, 0.388, 0.473, 0.553, 0.628, 0.695, 0.755, 0.807, 0.852, 0.89, 0.921, 0.947, 0.968, 0.984, 0.996, 1.005, 1.012, 1.016, 1.018, 1.02, 1.02, 1.019, 1.018, 1.017, 1.015, 1.013, 1.012, 1.01, 1.008, 1.007, 1.006, 1.005, 1.004, 1.003, 1);
  --spring-bouncy: var(--spring);
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: cubic-bezier(0.2, 1.1, 0.4, 1);
  }
}

/* light: by the device's setting (Automatic), or chosen for the account (data-theme) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --sky-a: #e9eefc; --sky-b: #f3f0fb; --sky-c: #f7f8fc; --sky-top: #dde3fb;
    --aura-1: rgba(110, 150, 255, 0.42); --aura-2: rgba(200, 150, 255, 0.36); --aura-3: rgba(90, 210, 240, 0.3);
    --text: #0d1020; --text-2: rgba(20, 24, 44, 0.66); --text-3: rgba(20, 24, 44, 0.62);
    --glass: rgba(255, 255, 255, 0.58); --glass-strong: rgba(250, 251, 255, 0.9); --glass-ctl: rgba(20, 30, 60, 0.06); --sheet: rgba(246, 247, 252, 0.95);
    --line: rgba(20, 24, 44, 0.09); --press: rgba(20, 24, 44, 0.05); --field: rgba(20, 30, 60, 0.06);
    --tint: #2f7af0; --tint-deep: #1f5fd8; --tint-text: #1f63d6; --danger: #d12a1f; --good: #1f9d55; --warn: #945600; --flag: #f08a00;
    --edge: inset 0 1px 0.5px rgba(255, 255, 255, 0.95), inset 0 -1px 0.5px rgba(255, 255, 255, 0.4), inset 0 0 22px rgba(255, 255, 255, 0.3);
    --lift: 0 0 0 0.5px rgba(20, 30, 60, 0.08), 0 22px 44px -20px rgba(40, 50, 100, 0.28), 0 2px 6px rgba(40, 50, 100, 0.06);
    --sheen: radial-gradient(140% 90% at 12% -20%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 46%);
    --dim: rgba(10, 14, 30, 0.32);
    --mail-text: #0d1020; --mail-link: #1f63d6; --mail-quote: rgba(20, 24, 44, 0.62); --mail-rule: rgba(20, 24, 44, 0.22);
  }
}

:root[data-theme="light"] {
    color-scheme: light;
    --sky-a: #e9eefc; --sky-b: #f3f0fb; --sky-c: #f7f8fc; --sky-top: #dde3fb;
    --aura-1: rgba(110, 150, 255, 0.42); --aura-2: rgba(200, 150, 255, 0.36); --aura-3: rgba(90, 210, 240, 0.3);
    --text: #0d1020; --text-2: rgba(20, 24, 44, 0.66); --text-3: rgba(20, 24, 44, 0.62);
    --glass: rgba(255, 255, 255, 0.58); --glass-strong: rgba(250, 251, 255, 0.9); --glass-ctl: rgba(20, 30, 60, 0.06); --sheet: rgba(246, 247, 252, 0.95);
    --line: rgba(20, 24, 44, 0.09); --press: rgba(20, 24, 44, 0.05); --field: rgba(20, 30, 60, 0.06);
    --tint: #2f7af0; --tint-deep: #1f5fd8; --tint-text: #1f63d6; --danger: #d12a1f; --good: #1f9d55; --warn: #945600; --flag: #f08a00;
    --edge: inset 0 1px 0.5px rgba(255, 255, 255, 0.95), inset 0 -1px 0.5px rgba(255, 255, 255, 0.4), inset 0 0 22px rgba(255, 255, 255, 0.3);
    --lift: 0 0 0 0.5px rgba(20, 30, 60, 0.08), 0 22px 44px -20px rgba(40, 50, 100, 0.28), 0 2px 6px rgba(40, 50, 100, 0.06);
    --sheen: radial-gradient(140% 90% at 12% -20%, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 46%);
    --dim: rgba(10, 14, 30, 0.32);
    --mail-text: #0d1020; --mail-link: #1f63d6; --mail-quote: rgba(20, 24, 44, 0.62); --mail-rule: rgba(20, 24, 44, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--sky-top);
  color: var(--label);
  font: 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* No zooming the app, as a native one doesn't: no pinch, no double-tap (scrolling still works both ways) */
html,
body {
  touch-action: pan-x pan-y;
}

input,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

svg.i {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- Liquid Glass material ---------- */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--sheen), var(--glass-bg);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--edge), var(--lift);
  border-radius: 999px;
}

/* Specular highlight that follows the finger. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    120px circle at var(--px, 50%) var(--py, 50%),
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0) 70%
  );
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
  mix-blend-mode: soft-light;
  z-index: 1;
}

.glass.lit::after {
  opacity: 1;
  transition-duration: 0.1s;
}

.glass.tinted {
  background: var(--sheen), linear-gradient(180deg, color-mix(in srgb, var(--tint) 92%, white), var(--tint-deep));
  color: #fff;
}

.glass.strong {
  background: var(--sheen), var(--glass-strong);
}

/* ---------- The sky: the account page's, with its three slow lights (night in dark mode, dawn in light) ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(120% 80% at 50% -10%, var(--sky-a), var(--sky-b) 52%, var(--sky-c)) var(--sky-top);
}

/* (each light soft at its edge by its own gradient rather than a blur, and moved on in small steps, as the site's are,
   so the glass over them isn't redrawn every frame) */
.aura {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  opacity: 0.9;
  will-change: transform;
}

.a1 {
  top: -32vmax;
  left: -22vmax;
  background: radial-gradient(circle closest-side, color-mix(in srgb, var(--aura-1) 73%, transparent), color-mix(in srgb, var(--aura-1) 49%, transparent) 40%, color-mix(in srgb, var(--aura-1) 12%, transparent) 80%, transparent);
  animation: drift1 38s steps(38) infinite alternate, aura-in 0.9s ease-out backwards;
}

.a2 {
  top: 10vmax;
  right: -34vmax;
  background: radial-gradient(circle closest-side, color-mix(in srgb, var(--aura-2) 73%, transparent), color-mix(in srgb, var(--aura-2) 49%, transparent) 40%, color-mix(in srgb, var(--aura-2) 12%, transparent) 80%, transparent);
  animation: drift2 46s steps(46) infinite alternate, aura-in 0.9s ease-out backwards;
}

.a3 {
  bottom: -40vmax;
  left: 4vmax;
  background: radial-gradient(circle closest-side, color-mix(in srgb, var(--aura-3) 73%, transparent), color-mix(in srgb, var(--aura-3) 49%, transparent) 40%, color-mix(in srgb, var(--aura-3) 12%, transparent) 80%, transparent);
  animation: drift3 54s steps(54) infinite alternate, aura-in 0.9s ease-out backwards;
}

body.sheet-open .aura {
  animation-play-state: paused;
}

@keyframes aura-in {
  from {
    opacity: 0;
  }
}

@keyframes drift1 {
  to {
    transform: translate(14vmax, 10vmax) scale(1.12);
  }
}

@keyframes drift2 {
  to {
    transform: translate(-16vmax, 8vmax) scale(0.9);
  }
}

@keyframes drift3 {
  to {
    transform: translate(10vmax, -12vmax) scale(1.08);
  }
}

/* Glass buttons swell and brighten under the finger, then settle on a spring. */
.gbtn,
.gcap > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  transition: transform 0.55s var(--spring-bouncy), opacity 0.3s, filter 0.3s;
}

.gbtn {
  border-radius: 999px;
  padding: 0 11px;
}

.gbtn:active,
.gbtn.pressed {
  transform: scale(1.12);
  filter: brightness(1.08);
  transition-duration: 0.18s;
  transition-timing-function: var(--ease-out);
}

.gbtn:disabled,
.gcap > button:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.gcap {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  border-radius: 999px;
}

.gcap > button {
  padding: 0 10px;
  border-radius: 999px;
}

.gcap > button:active {
  transform: scale(1.18);
  transition-duration: 0.18s;
}

.gbtn.text {
  padding: 0 16px;
  font-weight: 600;
}

.tint-text {
  color: var(--tint);
}

/* ---------- App frame ---------- */

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: transparent;
  transition: transform 0.5s var(--ease), border-radius 0.5s var(--ease);
  transform-origin: 50% 100%;
}

/* (dimmed behind the sheet by a veil rather than a filter, which would make all the glass in it redraw) */
#app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1000;
  border-radius: inherit;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

body.sheet-open.phone #app {
  transform: translateY(calc(var(--sat) * 0.5)) scale(0.93);
  border-radius: 40px;
}

body.sheet-open.phone #app::after {
  opacity: 0.15;
}

.pane {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
  contain: layout paint;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: calc(var(--sat) + var(--nav-h));
  padding-bottom: calc(var(--sab) + 96px);
  padding-left: var(--sal);
  padding-right: var(--sar);
}

/* ---------- Navigation bar with soft scroll-edge blur ---------- */

.navbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--sat) + var(--nav-h));
  padding: var(--sat) calc(12px + var(--sar)) 0 calc(12px + var(--sal));
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.navbar > * {
  pointer-events: auto;
}

.navbar::before,
.navbar::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: 0;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

/* (the bar itself, blurred; then a soft fade under it, unblurred, so the blur has no hard edge) */
.navbar::before {
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--sky-b) 94%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
}

.navbar::after {
  top: 100%;
  height: 22px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--sky-b) 94%, transparent), transparent);
}

.pane.scrolled .navbar::before,
.pane.scrolled .navbar::after {
  opacity: 1;
}

.nav-title {
  position: absolute;
  left: 50%;
  top: calc(var(--sat) + var(--nav-h) / 2);
  transform: translate(-50%, -50%) translateY(6px);
  font-weight: 600;
  font-size: 17px;
  max-width: 50%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s, transform 0.35s var(--ease);
  pointer-events: none;
}

.nav-title small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--label-2);
}

.pane.scrolled .nav-title {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.spacer {
  flex: 1;
}

/* The title is the lens you're in, with what's unread there beside it */
.large-title {
  padding: 2px 20px 2px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.title-n {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tint-text);
  font-variant-numeric: tabular-nums;
}

.subtitle {
  padding: 0 20px 4px;
  color: var(--label-2);
  font-size: 14px;
  min-height: 1.3em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  transition: opacity 0.3s;
}

.sub-tag {
  height: 24px;
  padding: 0 6px 0 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint-text);
  font-size: 13px;
  font-weight: 600;
}

.sub-tag svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.gbtn.on {
  background: var(--tint);
  color: #fff;
  box-shadow: none;
}

/* One row of lenses: the one you're in grows to say its name; the rest are icons with a count */
.rail {
  display: flex;
  gap: 6px;
  padding: 12px 16px 8px;
}

.lens {
  position: relative;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex: 0 0 44px;
  background: var(--glass-ctl);
  box-shadow: inset 0 0 0 0.5px var(--line);
  color: var(--label-2);
  transition: background 0.3s, color 0.3s, padding 0.45s var(--spring), flex-grow 0.45s var(--spring), transform 0.4s var(--spring);
}

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

.lens > * {
  flex-shrink: 0;
}

.lens svg {
  width: 21px;
  height: 21px;
}

.lens .lbl {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 600;
  font-size: 15px;
  opacity: 0;
  transition: max-width 0.45s var(--spring), opacity 0.3s;
}

.lens .ct {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--tint);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lens[data-k="people"] {
  --lc: var(--tint-deep);
}

.lens[data-k="updates"] {
  --lc: #0f8c7d;
}

.lens[data-k="later"] {
  --lc: #7a52e8;
}

.lens[data-k="flagged"] {
  --lc: #c96a00;
}

.lens[data-k="done"] {
  --lc: #1f9d55;
}

.lens[data-k="later"] .ct {
  background: var(--purple);
}

.lens[data-k="flagged"] .ct {
  background: var(--flag);
}

.lens.on {
  flex: 1 1 auto;
  gap: 7px;
  padding: 0 14px;
  color: #fff;
  background: var(--lc);
  box-shadow: 0 6px 18px -8px var(--lc), inset 0 1px 0.5px rgba(255, 255, 255, 0.3);
}

.lens.on .lbl {
  max-width: 120px;
  opacity: 1;
}

.lens.on .ct {
  position: static;
  background: rgba(255, 255, 255, 0.25);
}

/* The stream by day */
.day {
  position: sticky;
  top: calc(var(--sat) + var(--nav-h));
  z-index: 3;
  padding: 14px 20px 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-3);
}

.swipe-hint {
  margin: 6px 16px 2px;
  padding: 8px 6px 8px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--press);
  color: var(--label-2);
  font-size: 13.5px;
  line-height: 1.3;
}

.swipe-hint > svg {
  width: 17px;
  height: 17px;
  color: var(--good);
  stroke-width: 2.4;
}

.swipe-hint span {
  flex: 1;
}

.swipe-hint button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--label-3);
}

.swipe-hint button svg {
  width: 16px;
  height: 16px;
}

/* Updates read as a digest: one line each */
.row.digest {
  padding-top: 8px;
  padding-bottom: 8px;
}

.row.digest .avatar {
  width: 34px;
  height: 34px;
  font-size: 12px;
  border-radius: 10px;
  margin: 0 5px;
}

.row.digest .subject {
  color: var(--label-2);
  font-size: 14.5px;
}

.row.digest .preview {
  -webkit-line-clamp: 1;
  font-size: 14px;
}

/* Caught up: when, and what's still around elsewhere */
.caught {
  padding: 40px 20px 24px;
  display: grid;
  justify-items: center;
  text-align: center;
}

.orb {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}

.orb .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  animation: breathe 5s ease-in-out infinite;
}

.orb .ring:nth-child(2) {
  inset: 16px;
  animation-delay: -1.6s;
}

.orb .ring:nth-child(3) {
  inset: 32px;
  animation-delay: -3.2s;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

.orb .core {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #7ff0b0, #1f9d55);
  box-shadow: 0 14px 34px -10px #1f9d55, inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.orb .core svg {
  width: 30px;
  height: 30px;
  stroke-width: 2.6;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw-check 0.6s 0.25s var(--ease) forwards;
}

@keyframes draw-check {
  to {
    stroke-dashoffset: 0;
  }
}

.caught h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.caught > p {
  margin: 6px 0 26px;
  color: var(--label-2);
  font-size: 15px;
}

.next {
  width: 100%;
  max-width: 440px;
  display: grid;
  gap: 10px;
  text-align: left;
}

.next-cap {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-3);
}

.next-card {
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 22px;
  text-align: left;
  transition: transform 0.4s var(--spring);
}

.next-card:active {
  transform: scale(0.97);
}

.next-ic {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
}

.next-ic.updates {
  background: linear-gradient(160deg, #2ec4b0, #0f8c7d);
}

.next-ic.later {
  background: linear-gradient(160deg, #b18cff, #7a52e8);
}

.next-ic.flagged {
  background: linear-gradient(160deg, #ffb54a, #d97706);
}

.next-txt {
  min-width: 0;
}

.next-txt b {
  display: block;
  font-weight: 600;
  font-size: 15.5px;
}

.next-txt small {
  display: block;
  color: var(--label-2);
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-chev {
  width: 18px;
  height: 18px;
  color: var(--label-3);
}

.next-faces {
  display: flex;
  padding: 4px 0 0 6px;
}

.avatar.xs {
  width: 24px;
  height: 24px;
  font-size: 9px;
  margin-left: -6px;
  box-shadow: 0 0 0 2px var(--sky-b);
}

.quiet {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--label-3);
}

.quiet.link {
  color: var(--tint-text);
  font-weight: 600;
}

.quiet svg {
  width: 15px;
  height: 15px;
}

/* ---------- Floating toolbar ---------- */

.toolbar {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px calc(16px + var(--sar)) max(calc(var(--sab) + 2px), 14px) calc(16px + var(--sal));
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toolbar > * {
  pointer-events: auto;
}

.toolbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -24px 0 0 0;
  background: linear-gradient(to top, color-mix(in srgb, var(--sky-c) 80%, transparent) 10%, transparent);
  -webkit-mask: linear-gradient(to top, #000 40%, transparent);
  mask: linear-gradient(to top, #000 40%, transparent);
  opacity: 0.85;
  pointer-events: none;
}

.toolbar .status {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--label-2);
  line-height: 1.25;
}

.toolbar .status b {
  display: block;
  font-weight: 500;
  color: var(--label);
}

/* Search capsule that expands in place */
.search {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--label-2);
  transition: flex 0.5s var(--spring), padding 0.5s var(--spring);
}

.search input {
  flex: 1;
  width: 0;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--label);
  height: 100%;
  font-size: 17px;
}

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

.search input::placeholder {
  color: var(--label-2);
}

.toolbar .side {
  transition: transform 0.5s var(--spring), opacity 0.3s, width 0.5s var(--spring), margin 0.5s var(--spring);
  width: 48px;
  height: 48px;
  padding: 0;
  overflow: hidden;
}

.toolbar .side.gbtn {
  min-width: 48px;
}

.toolbar.searching .side.hide-on-search {
  transform: scale(0.4);
  opacity: 0;
  width: 0;
  min-width: 0;
  margin: 0 -5px;
  pointer-events: none;
}

.toolbar .side.show-on-search {
  transform: scale(0.4);
  opacity: 0;
  width: 0;
  min-width: 0;
  margin: 0 -5px;
  pointer-events: none;
}

.toolbar.searching .side.show-on-search {
  transform: none;
  opacity: 1;
  width: 48px;
  min-width: 48px;
  margin: 0;
  pointer-events: auto;
}

/* ---------- The stream's controls: People or Updates, the views, search ---------- */

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.gbtn.profile {
  padding: 0;
  width: 44px;
}

/* People | Updates: a glass switch, its thumb sliding on the soft spring */
.seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 2px 16px 12px;
  padding: 4px;
  border-radius: 999px;
}

.seg[hidden] {
  display: none;
}

.seg-thumb {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--sheen), var(--glass-strong);
  box-shadow: var(--edge), 0 2px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.5s var(--spring);
}

.seg[data-sel="updates"] .seg-thumb {
  transform: translateX(100%);
}

.seg-btn {
  position: relative;
  z-index: 1;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.25s;
}

.seg-btn.on {
  color: var(--text);
}

.seg-n {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--tint);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* the views, and each address's lens: chips in a line that scrolls sideways */
.chips {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px 9px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 22px), transparent);
}

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

.chips[hidden],
.search-help[hidden] {
  display: none;
}

.chip {
  flex: none;
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 17px;
  background: var(--glass-ctl);
  box-shadow: inset 0 0 0 0.5px var(--line);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, transform 0.45s var(--spring);
}

.chip:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

.chip.on {
  background: var(--sheen), linear-gradient(180deg, color-mix(in srgb, var(--tint) 92%, white), var(--tint-deep));
  box-shadow: var(--edge);
  color: #fff;
}

.chip-n {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.chip.on .chip-n {
  color: rgba(255, 255, 255, 0.85);
}

.chip .at {
  opacity: 0.6;
}

.chip-sep {
  flex: none;
  width: 0.5px;
  height: 20px;
  background: var(--line);
}

/* searching: what was understood, as tokens, and the operators a tap away */
.search-help {
  padding: 0 16px 10px;
  display: grid;
  gap: 10px;
}

.tokens-row,
.ops-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qtoken {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px 0 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tint) 18%, transparent);
  color: var(--tint-text);
  font-size: 15px;
  animation: pop-in 0.45s var(--spring) both;
}

.qtoken svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.chip.op {
  height: 30px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text-2);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0;
}

/* ---------- Message list ---------- */

.rows {
  position: relative;
}

.row-wrap {
  position: relative;
  overflow: hidden;
  transition: height 0.38s var(--ease), opacity 0.3s;
}

.row-wrap.removing {
  opacity: 0;
}

.row {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 22px 42px 1fr;
  column-gap: 0;
  padding: 11px 16px 11px 4px;
  text-align: left;
  background: transparent;
  touch-action: pan-y;
}

/* (a layer of its own only while being swiped: one per row costs an iPhone a lot of memory) */
.row-wrap.swiping .row {
  will-change: transform;
}

.row::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  left: 82px;
  border-bottom: 0.5px solid var(--sep);
}

.row-wrap:last-child .row::after {
  display: none;
}

.row.selected {
  background: var(--sheen), linear-gradient(180deg, color-mix(in srgb, var(--tint) 92%, white), var(--tint-deep));
  color: #fff;
  border-radius: 14px;
}

.row.selected::after {
  display: none;
}

.row.selected .meta,
.row.selected .preview,
.row.selected .date {
  color: rgba(255, 255, 255, 0.82);
}

.row:not(.selected):active {
  background: var(--bg-fill);
}

.row .dot {
  align-self: start;
  margin-top: 7px;
  justify-self: center;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tint);
  transform: scale(0);
  transition: transform 0.45s var(--spring-bouncy);
}

.row.unread .dot {
  transform: scale(1);
}

.row.selected .dot {
  background: #fff;
}

.row .flag {
  position: absolute;
  left: 9px;
  top: 32px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--orange);
  transform: scale(0);
  transition: transform 0.45s var(--spring-bouncy);
}

.row.starred .flag {
  transform: scale(1);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, hsl(var(--h, 220) 35% 70%), hsl(var(--h, 220) 30% 52%));
  flex: none;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.lg {
  width: 44px;
  height: 44px;
  font-size: 17px;
}

.row .body {
  min-width: 0;
  padding-left: 12px;
}

.row .top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.row .from {
  flex: 0 1 auto;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .count-badge {
  flex: none;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  background: var(--glass-ctl);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}



.row .draft-tag {
  color: var(--danger);
  margin-right: 6px;
}

.row .preview .you {
  color: var(--text-3);
}

.row .date {
  flex: none;
  margin-left: auto;
  font-size: 15px;
  color: var(--label-2);
  display: flex;
  align-items: center;
  gap: 4px;
}

.row .date svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
  opacity: 0.6;
}

.row .subject {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
}

.row .subject svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.row .preview {
  font-size: 15px;
  color: var(--label-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  margin-top: 1px;
}

/* Swipe actions */
.swipe-actions {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  z-index: 0;
}

.swipe-actions .side {
  display: flex;
  align-items: stretch;
  height: 100%;
}

.swipe-actions .side {
  width: 0;
  overflow: hidden;
}

.swipe-actions button {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: flex 0.3s var(--ease);
}

.swipe-actions .a-done {
  background: linear-gradient(160deg, #4fdc8e, #1fa75a);
}

.swipe-actions .a-inbox {
  background: linear-gradient(160deg, #5aa9ff, #2a6ae6);
}

.swipe-actions .a-later {
  background: linear-gradient(160deg, #b18cff, #7a52e8);
}

.swipe-actions .a-read {
  background: var(--tint);
}

.swipe-actions .a-flag {
  background: var(--orange);
}

.swipe-actions .a-more {
  background: #8e8e93;
}

.swipe-actions .a-archive {
  background: var(--purple);
}

.swipe-actions .a-trash {
  background: var(--red);
}

.swipe-actions .side.full button:not(.lead) {
  flex: 0 0 0;
}

.empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--label-2);
  padding: 80px 32px;
  gap: 8px;
}

.empty svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.2;
  opacity: 0.5;
}

.caught-up {
  padding-top: 64px;
}

.done-badge {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--sheen), linear-gradient(160deg, #4fdc8e, #1fa75a);
  box-shadow: var(--edge), 0 14px 34px -12px rgba(31, 167, 90, 0.6);
  animation: pop-in 0.6s var(--spring) both;
}

.empty .done-badge svg {
  width: 36px;
  height: 36px;
  stroke-width: 2.6;
  opacity: 1;
}

.empty b {
  color: var(--label);
  font-size: 20px;
  font-weight: 600;
}

.load-more {
  display: grid;
  place-items: center;
  height: 64px;
}

/* Pull to refresh */
.ptr {
  height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  position: relative;
}

.ptr .spinner {
  position: absolute;
  top: -36px;
  opacity: 0;
  transition: opacity 0.2s;
}

.refreshing .ptr {
  height: 48px;
  transition: height 0.4s var(--ease);
}

.refreshing .ptr .spinner {
  position: static;
  opacity: 1;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--label-2));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Reader: a conversation, its messages as glass cards, newest first ---------- */

.conv-head {
  padding: 4px 20px 14px;
}

.conv-head .reader-subject {
  padding: 0 0 4px;
}

.conv-meta {
  font-size: 13px;
  color: var(--text-2);
}

.msgs {
  display: grid;
  gap: 10px;
  padding: 0 12px 24px;
}

.mcard {
  border-radius: 24px;
  background: var(--sheen), var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--edge), var(--lift);
  overflow: hidden;
}

.msg-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  text-align: left;
}

.mcard:not(.open) .msg-head:active {
  background: var(--press);
}

.msg-meta {
  flex: 1;
  min-width: 0;
}

.msg-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.msg-top b {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-top span {
  flex: none;
  font-size: 13px;
  color: var(--text-2);
}

.msg-sub {
  font-size: 14px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mcard.unread:not(.open) .msg-top b::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--tint);
  vertical-align: 1px;
}

.mcard .mail-body {
  padding: 2px 16px 12px;
}

.mcard .mail-frame-wrap.plain .mail-frame {
  margin: 0 -4px;
}

.mcard .mail-frame-wrap:not(.plain) {
  margin: 2px 10px 12px;
}

.mcard .quote-row {
  padding: 0 16px 12px;
}

.mcard .banner {
  margin: 0 12px 10px;
}

.mcard .attachments {
  padding: 0 12px 12px;
}

.msg-foot {
  padding: 0 16px 14px;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------- Reader ---------- */

.reader-head {
  padding: 4px 20px 14px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: start;
}

.reader-head .who {
  min-width: 0;
}

.reader-head .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-head .addr {
  font-size: 15px;
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-head .when {
  font-size: 15px;
  color: var(--label-2);
  white-space: nowrap;
}

.reader-subject {
  padding: 0 20px 14px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.reader-subject .flag-ic {
  color: var(--orange);
  fill: var(--orange);
  margin-top: 4px;
  flex: none;
}

.reader-divider {
  margin: 0 20px;
  border-top: 0.5px solid var(--sep);
}

.banner {
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg-fill);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--label-2);
}

.banner button {
  margin-left: auto;
  color: var(--tint);
  font-weight: 600;
  font-size: 14px;
  padding: 4px 2px;
}

.mail-body {
  padding: 16px 20px 24px;
  font-size: 17px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mail-body a {
  color: var(--tint);
}

.mail-body .quote {
  color: var(--label-2);
  border-left: 2px solid var(--label-3);
  padding-left: 12px;
  margin: 4px 0;
  display: block;
}

.mail-frame-wrap {
  margin: 12px 12px 24px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
}

.mail-frame-wrap.plain {
  margin: 0;
  border-radius: 0;
  background: none;
}

.mail-frame-wrap.plain .mail-frame {
  background: transparent;
}

.quote-row {
  padding: 0 20px 16px;
}

.quote-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 10px;
  border-radius: 15px;
  background: var(--bg-fill);
  color: var(--label-2);
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.4s var(--spring-bouncy), background 0.2s;
}

.quote-toggle:active {
  transform: scale(0.95);
  background: var(--bg-fill-2);
}

.quote-toggle svg {
  width: 16px;
  height: 16px;
}

.mail-body.quoted {
  padding-top: 0;
  color: var(--label-2);
  animation: content-in 0.35s var(--ease) both;
}

.reader-date {
  padding: 0 20px 20px;
  font-size: 13px;
}

.thread {
  margin: 4px 16px 24px;
  display: grid;
  gap: 8px;
}

.thread-title {
  padding: 0 4px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-2);
}

.thread-card {
  border-radius: 20px;
  background: var(--bg-fill);
  overflow: hidden;
}

.thread-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}

.thread-head .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.thread-meta {
  flex: 1;
  min-width: 0;
}

.thread-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.thread-top b {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-top span {
  font-size: 13px;
  color: var(--label-2);
}

.thread-snippet {
  font-size: 14px;
  color: var(--label-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-card.open .thread-snippet {
  display: none;
}

.thread-body {
  display: none;
}

.thread-card.open .thread-body {
  display: block;
  border-top: 0.5px solid var(--sep);
  animation: content-in 0.35s var(--ease) both;
}

.thread-body .mail-body {
  font-size: 16px;
}

.thread-body .mail-frame-wrap {
  margin: 10px;
}

.mail-frame {
  display: block;
  width: 100%;
  border: 0;
  height: 200px;
  background: #fff;
  color-scheme: light;
}

.attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 0 16px 24px;
}

.att {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--bg-fill);
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: transform 0.4s var(--spring-bouncy);
}

.att:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

.att .att-ic {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--field);
  display: grid;
  place-items: center;
  color: var(--tint);
  flex: none;
  overflow: hidden;
}

.att .att-ic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.att .att-name {
  display: flex;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.att .att-a {
  overflow: hidden;
  text-overflow: ellipsis;
}

.att .att-b {
  flex: none;
}

.att .att-size {
  font-size: 12px;
  color: var(--label-2);
}

.att > div {
  min-width: 0;
}

.detail-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--label-2);
  text-align: center;
}

.detail-empty svg {
  width: 56px;
  height: 56px;
  stroke-width: 1.1;
  opacity: 0.4;
}

.detail-empty b {
  font-size: 22px;
  font-weight: 600;
  color: var(--label-3);
}

.content-in {
  animation: content-in 0.45s var(--ease) both;
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Phone: navigation stack ---------- */

/* (the panes are clear, on the sky: the one being left fades as it steps back, so the two never show through each other) */
body.phone .pane {
  left: 0;
  right: 0;
  transition: transform 0.52s var(--ease), opacity 0.4s var(--ease);
  will-change: transform, opacity;
}

body.phone .pane[data-pos="behind"] {
  transform: translateX(-28%);
  opacity: 0;
  pointer-events: none;
}

body.phone .pane[data-pos="ahead"] {
  transform: translateX(105%);
  pointer-events: none;
}

body.phone .pane[data-pos="current"] {
  transform: none;
}

body.phone.dragging .pane {
  transition: none;
}

body.phone .pane.list {
  z-index: 2;
}

body.phone .pane.detail {
  z-index: 3;
  transition: transform 0.52s var(--ease), opacity 0.4s var(--ease), box-shadow 0.52s var(--ease);
}

/* While a conversation slides over the list (or is swiped back): solid, with an edge shadow, so the list doesn't show
   through it; the sky shows again once it has settled. */
body.phone .pane.detail::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 80% at 50% -10%, var(--sky-a), var(--sky-b) 52%, var(--sky-c)) var(--sky-top);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}

body.phone.moving .pane.detail::before,
body.phone.dragging .pane.detail::before {
  opacity: 1;
  transition: none;
}

body.phone.moving .pane.detail,
body.phone.dragging .pane.detail {
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.18);
}

body.phone .detail-empty {
  display: none;
}

/* ---------- iPad: split view ---------- */

body.pad .phone-only {
  display: none;
}

body.pad .pane.list {
  left: var(--list-left);
  width: var(--list-w);
  border-right: 0.5px solid var(--sep);
  transition: left 0.55s var(--spring);
  z-index: 2;
}

body.pad .pane.detail {
  left: calc(var(--list-left) + var(--list-w));
  right: 0;
  transition: left 0.55s var(--spring);
  z-index: 1;
}

body.pad .pane.list .row {
  margin: 0 8px;
  width: calc(100% - 16px);
  border-radius: 14px;
  padding-left: 0;
}

body.pad .pane.list .row::after {
  left: 74px;
  right: 8px;
}

body.pad .pane.detail .conv-head,
body.pad .pane.detail .msgs {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Menus ---------- */

.menu-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.menu {
  position: fixed;
  min-width: 240px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px;
  border-radius: 26px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: blur(30px) saturate(2);
  backdrop-filter: blur(30px) saturate(2);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.1), var(--glass-inner);
  transform: scale(0.3);
  opacity: 0;
  transition: transform 0.5s var(--spring), opacity 0.22s;
}

.menu.open {
  transform: none;
  opacity: 1;
}

.menu.closing {
  transform: scale(0.5);
  opacity: 0;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}

.menu-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 18px;
  text-align: left;
  font-size: 17px;
}

.menu-item .lbl {
  flex: 1;
}

.menu-item:active,
.menu-item:focus-visible {
  background: var(--bg-fill-2);
  outline: none;
}

.menu-item.destructive {
  color: var(--red);
}

.menu-item.checked .check {
  visibility: visible;
}

.menu-item .check {
  visibility: hidden;
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.menu-sep {
  height: 0.5px;
  margin: 5px 12px;
  background: var(--sep);
}

.menu-title {
  padding: 8px 14px 6px;
  font-size: 13px;
  color: var(--label-2);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  top: calc(var(--sat) + 10px);
  transform: translate(-50%, -160%) scale(0.8);
  padding: 0 8px 0 18px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  font-weight: 500;
  font-size: 15px;
  white-space: nowrap;
  transition: transform 0.6s var(--spring-bouncy), opacity 0.3s;
  opacity: 0;
}

/* On iPhone: above the bottom bar, where it covers nothing you'd tap next, and long messages wrap */
body.phone .toast {
  top: auto;
  bottom: calc(var(--sab) + 78px);
  transform: translate(-50%, 160%) scale(0.8);
  height: auto;
  min-height: 50px;
  width: max-content;
  padding: 7px 8px 7px 18px;
  border-radius: 25px;
  white-space: normal;
}

body.phone .toast.show {
  transform: translate(-50%, 0);
}

body.phone .toast .msg {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* (gone means gone: an invisible toast never catches a tap meant for what's under it) */
.toast:not(.show) {
  pointer-events: none;
}

.toast .msg {
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.toast .gbtn {
  height: 36px;
  min-width: 0;
  padding: 0 14px;
  font-weight: 600;
  color: var(--tint);
}

.toast svg {
  color: var(--tint);
}

.toast.error svg {
  color: var(--red);
}

/* ---------- Compose sheet ---------- */

.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

body.phone .sheet-scrim {
  background: transparent;
}

.sheet-scrim.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  z-index: 101;
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  overflow: hidden;
  transition: transform 0.55s var(--ease), border-radius 0.4s;
  box-shadow: var(--edge), 0 -10px 60px rgba(0, 0, 0, 0.22);
}

body.phone .sheet {
  left: 0;
  right: 0;
  top: calc(var(--sat) + 12px);
  bottom: 0;
  border-radius: 38px 38px 0 0;
  transform: translateY(105%);
  padding-bottom: var(--kb);
}

body.pad .sheet {
  left: 50%;
  top: 50%;
  width: min(700px, calc(100vw - 80px));
  height: min(780px, calc(100% - 80px - var(--kb)));
  margin-top: calc(var(--kb) / -2);
  border-radius: 34px;
  transform: translate(-50%, 120vh);
}

body.phone .sheet.open {
  transform: none;
}

body.pad .sheet.open {
  transform: translate(-50%, -50%);
}

.sheet.dragging {
  transition: none;
}

.sheet.sending {
  transition: transform 0.6s cubic-bezier(0.5, 0, 0.75, 0), opacity 0.6s;
  opacity: 0;
}

body.phone .sheet.sending {
  transform: translateY(-110%) scale(0.9);
}

body.pad .sheet.sending {
  transform: translate(-50%, -150%) scale(0.85);
}

.sheet-grabber {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 38px;
  height: 5px;
  margin-left: -19px;
  border-radius: 3px;
  background: var(--label-3);
}

body.pad .sheet-grabber {
  display: none;
}

.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 8px;
  touch-action: none;
}

.sheet-head h2 {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-head .glass {
  --glass-bg: var(--bg-fill);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.sheet-head .glass::before {
  display: none;
}

.sheet-head .glass.tinted {
  background: var(--tint);
}

.sheet-head .glass.tinted:disabled {
  background: var(--bg-fill-2);
  color: var(--label-2);
  opacity: 1;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.field {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-bottom: 0.5px solid var(--sep);
}

.field > label,
.field > .flabel {
  flex: none;
  color: var(--label-2);
  line-height: 46px;
}

.field input {
  flex: 1;
  min-width: 80px;
  height: 46px;
  border: 0;
  outline: 0;
  background: none;
  font-size: 17px;
}

.field .from-btn {
  flex: 1;
  height: 46px;
  text-align: left;
  color: var(--label);
  display: flex;
  align-items: center;
  gap: 4px;
}

.field .from-btn svg {
  width: 14px;
  height: 14px;
  color: var(--label-2);
  stroke-width: 2.4;
}

.tokens {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  min-height: 46px;
}

.tokens input {
  height: 32px;
}

.token {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  color: var(--tint);
  font-size: 15px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: pop-in 0.45s var(--spring-bouncy) both;
}

.token.focused {
  background: var(--tint);
  color: #fff;
}

.token.invalid {
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
}

@keyframes pop-in {
  from {
    transform: scale(0.5);
    opacity: 0;
  }
}

.field .add-btn {
  color: var(--tint);
  height: 46px;
  display: flex;
  align-items: center;
}

.suggestions {
  border-bottom: 0.5px solid var(--sep);
  animation: content-in 0.3s var(--ease) both;
}

.suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  text-align: left;
}

.suggestion:active,
.suggestion.hl {
  background: var(--bg-fill);
}

.suggestion .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.suggestion b {
  display: block;
  font-weight: 500;
  font-size: 16px;
}

.suggestion span {
  font-size: 14px;
  color: var(--label-2);
}

.compose-text {
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 14px 20px;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  font-size: 17px;
  line-height: 1.45;
}

.compose-quote {
  margin: 0 20px 20px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--label-3);
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.4;
  max-height: 260px;
  overflow: hidden;
  position: relative;
  -webkit-mask: linear-gradient(#000 70%, transparent);
  mask: linear-gradient(#000 70%, transparent);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.compose-quote .qh {
  margin-bottom: 6px;
  font-size: 13px;
}

.compose-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
}

.compose-atts .att {
  max-width: 220px;
  padding-right: 6px;
  animation: pop-in 0.45s var(--spring-bouncy) both;
}

.compose-atts .att button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--label-2);
  flex: none;
}

.compose-atts .att button svg {
  width: 16px;
  height: 16px;
}

.compose-accessory {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px calc(max(var(--sab), 8px) + 2px);
  border-top: 0.5px solid var(--sep);
}

body.phone .sheet.kb .compose-accessory {
  padding-bottom: 8px;
}

.compose-accessory .gbtn {
  height: 40px;
  min-width: 40px;
  color: var(--tint);
}

.compose-accessory .hint {
  flex: 1;
  text-align: right;
  font-size: 12px;
  color: var(--label-3);
  padding-right: 6px;
}

/* ---------- Signed out: the welcome, as the site's other apps have it ---------- */

/* (the mark high on the page, Sign in at its foot; Mail's scene along the bottom) */
.login {
  position: fixed;
  inset: 0;
  z-index: 150;
  overflow: hidden;
  isolation: isolate;
}

.welcome {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: var(--sat) calc(24px + var(--sar)) calc(55px + var(--sab)) calc(24px + var(--sal));
  color: var(--text);
}

.welcome > :not(.flight) {
  position: relative;
  z-index: 1;
}

.w-top {
  margin-top: calc(max(16vh, 80px) + 12px);
  display: grid;
  justify-items: center;
  gap: 12px;
}

.w-cta {
  width: 100%;
  max-width: 420px;
  display: grid;
  justify-items: center;
  gap: 12px;
}

/* the mark, out of the haze in a cool glow; the name a letter at a time; the line; then Sign in */
.wlogo {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin-bottom: -18px;
}

.wlogo::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(90, 140, 255, 0.4), rgba(150, 110, 255, 0.14) 55%, rgba(150, 110, 255, 0));
  animation: w-fade 2s ease 0.5s backwards;
}

.wlogo .mark {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 18px 40px -16px rgba(47, 107, 255, 0.75), 0 0 0 0.5px rgba(255, 255, 255, 0.2);
  animation: w-logo 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s backwards;
}

@keyframes w-logo {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: scale(0.86);
  }
  80% {
    filter: blur(0);
  }
}

.wtitle {
  margin: 0;
  font-size: 40px;
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.4px;
}

.wtitle span {
  display: inline-block;
  animation: w-letter 0.9s var(--ease-out) backwards;
}

.wtitle span:nth-child(1) {
  animation-delay: 0.55s;
}

.wtitle span:nth-child(2) {
  animation-delay: 0.61s;
}

.wtitle span:nth-child(3) {
  animation-delay: 0.67s;
}

.wtitle span:nth-child(4) {
  animation-delay: 0.73s;
}

@keyframes w-letter {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
}

.tagline {
  margin: 4px 0 0;
  max-width: 30ch;
  font-size: 16px;
  color: var(--text-2);
  text-wrap: balance;
  animation: w-fade 1.2s ease 1.3s backwards;
}

.w-cta {
  animation: w-cta 0.9s var(--ease-out) 1.8s backwards;
}

@keyframes w-cta {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes w-fade {
  from {
    opacity: 0;
  }
}

.said {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-2);
}

/* Sign in: Mail's blue, pulsing gently (two beats, a rest) */
.w-go {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6fb1ff, #2f6bff 55%, #7a4bff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 28px -10px rgba(47, 107, 255, 0.75);
  transition: transform 0.45s var(--spring), filter 0.2s;
  animation: w-beat 2.4s ease-in-out 2.6s infinite;
}

.w-go:active {
  transform: scale(0.97);
}

.w-go:disabled {
  opacity: 0.6;
  animation: none;
}

@keyframes w-beat {
  0%,
  40%,
  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 28px -10px rgba(47, 107, 255, 0.75);
  }
  8% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 34px -6px rgba(47, 107, 255, 0.95), 0 0 0 4px rgba(111, 160, 255, 0.25);
  }
  18% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 28px -10px rgba(47, 107, 255, 0.75);
  }
  26% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 34px -8px rgba(47, 107, 255, 0.85), 0 0 0 3px rgba(111, 160, 255, 0.18);
  }
}

/* Mail's scene: clouds rising out of the haze, the route drawn over them, then the plane */
:root {
  --f-far: rgba(110, 150, 255, 0.14);
  --f-mid: rgba(160, 120, 255, 0.14);
  --f-near: rgba(90, 190, 240, 0.12);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --f-far: rgba(90, 130, 240, 0.12);
    --f-mid: rgba(170, 130, 240, 0.12);
    --f-near: rgba(80, 180, 230, 0.12);
  }
}

:root[data-theme="light"] {
  --f-far: rgba(90, 130, 240, 0.12);
  --f-mid: rgba(170, 130, 240, 0.12);
  --f-near: rgba(80, 180, 230, 0.12);
}

.flight {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 46svh;
  z-index: 0;
  pointer-events: none;
}

.flight .f-far {
  fill: var(--f-far);
}

.flight .f-mid {
  fill: var(--f-mid);
}

.flight .f-near {
  fill: var(--f-near);
}

.flight .f-route {
  fill: none;
  stroke: url(#f-route);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 2 12;
  opacity: 0.8;
  animation: w-fade 1.4s ease 0.9s backwards;
}

.flight .f-paper {
  fill: #fff;
}

.flight .f-fold {
  fill: none;
  stroke: rgba(80, 110, 220, 0.45);
  stroke-width: 1.5;
}

.flight .f-plane {
  animation: w-fade 0.8s ease 2.2s backwards;
}

.flight :is(.f-far, .f-mid, .f-near) {
  animation: f-rise 1.6s var(--ease-out) backwards;
}

.flight .f-mid {
  animation-delay: 0.12s;
}

.flight .f-near {
  animation-delay: 0.24s;
}

@keyframes f-rise {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
}

/* (shown again, after signing out: no slow start) */
.welcome.again :is(.wlogo .mark, .wlogo::before, .wtitle span, .tagline, .flight *) {
  animation-delay: 0s !important;
  animation-duration: 0.5s;
}

.welcome.again .w-cta {
  animation: w-fade 0.5s ease;
}

.welcome.again .w-go {
  animation: w-beat 2.4s ease-in-out 1s infinite;
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  /* (still: shortened, an endless drift or breath would flicker) */
  .aura,
  .orb .ring,
  .w-go {
    animation: none !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .menu,
  .mcard,
  .sheet {
    background: var(--glass-strong);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

:focus-visible {
  outline: 2px solid var(--tint);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* (the capsule shows where typing goes, as its field has no ring of its own) */
.search:has(input:focus-visible) {
  box-shadow: var(--edge), 0 0 0 2px var(--tint);
}

/* Tap targets at least 44pt, as iOS has them, without making the controls look bigger */
.chip,
.seg-btn {
  position: relative;
}

.chip::before,
.seg-btn::before {
  content: "";
  position: absolute;
  inset: -5px -3px;
}

/* (scrolled sideways by focus or script, never: it only clips) */
#app {
  overflow: clip;
}

.chip-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: -6px;
}

.chip-back svg {
  width: 16px;
  height: 16px;
}

/* Later: when a conversation comes back */
.menu-item .hint {
  font-size: 15px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.row .date.later {
  color: var(--purple);
}

.row .date.later svg {
  opacity: 1;
}

.later-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 8px 8px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--purple) 14%, transparent);
  color: var(--purple);
  font-size: 14px;
  font-weight: 500;
}

.later-note svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.later-note span {
  flex: 1;
}

.later-note button {
  padding: 5px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--purple) 16%, transparent);
  font-size: 13px;
  font-weight: 600;
}

.menu-layer.center {
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.18);
}

.menu.picker {
  position: relative;
  width: min(320px, 100%);
  padding: 8px 12px 12px;
  display: grid;
  gap: 10px;
}

.picker .when {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: var(--bg-fill-2);
  color: inherit;
  font: inherit;
  font-size: 17px;
  color-scheme: light dark;
}

.picker-btns {
  display: flex;
  gap: 8px;
}

.pbtn {
  flex: 1;
  min-height: 44px;
  border-radius: 22px;
  background: var(--bg-fill-2);
  font-size: 17px;
  font-weight: 500;
}

.pbtn.primary {
  background: var(--tint);
  color: #fff;
  font-weight: 600;
}

/* (long labels wrap inside the menu, never past it; the times beside Later's choices stay on one line) */
.menu-item .lbl {
  min-width: 0;
  padding: 11px 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.menu-item .hint,
.menu-item svg {
  flex: none;
}

/* (the search operators in one row that scrolls sideways, rather than several pushing the results down) */
.ops-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px;
}

.ops-row::-webkit-scrollbar {
  display: none;
}

.ops-row > * {
  flex: none;
}

.conv-head:focus {
  outline: none;
}
