/* Split out of mail/index.html — edit here, then run: node infra/scripts/page-assets-bump.cjs */
/* Self-hosted Open Sans (same files app.css uses). Mail deliberately does not
   load app.css: the tenant shell normalises .btn/.card/.badge/input with
   !important, which fights this app's own design system. */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/open-sans-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/fonts/open-sans-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Open Sans';
  font-style: italic;
  font-weight: 300 400;
  font-display: swap;
  src: url('/fonts/open-sans-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  /* OS chrome (status bar / notch / home indicator). The tab bar already
     sat on --nm-safe-bottom; the top chrome did not, so the greeting and
     burger drew under the status bar on edge-to-edge Android. */
  --nm-safe-top: env(safe-area-inset-top, 0px);
  --nm-safe-right: env(safe-area-inset-right, 0px);
  --nm-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nm-safe-left: env(safe-area-inset-left, 0px);
  --nm-vv-height: 100dvh;
  --font-sans: "Open Sans", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  /* Colored CTAs like attorneys/inventory brand-primary — not redesign ink/paper. */
  /* Type weights follow app.css: KPI numbers light and tight like the
     inventory .kpi-value contract, UI titles 600. Never 800 on these. */
  --nm-fw-kpi: 300;
  --nm-kpi-tracking: -0.025em;
  --nm-fw-ui: 600;
  /* TYPE TRIAL 2026-09-13: +10% on Mail UI type (Open Sans 300–800).
     Revert: set --nm-type-scale to 1 (this is the only knob). */
  --nm-type-scale: 1.10;
  --nm-primary: #1075eb;
  --nm-primary-hover: #0a378d;
  --nm-primary-soft: rgba(16, 117, 235, 0.12);
  --nm-primary-rgb: 16, 117, 235;
  --accent: var(--nm-primary);
  --accent-soft: var(--nm-primary-soft);
  /* Surfaces = app.css warm canvas (content #F5F3EF, paper/sidebar #FCFBF8). */
  --nm-side: #FCFBF8;
  --nm-side-deep: #FCFBF8;
  --nm-side-ink: oklch(22% 0.012 260);
  --nm-side-ink-2: oklch(38% 0.012 260);
  --nm-side-muted: oklch(58% 0.010 260);
  --nm-side-hover: oklch(93.5% 0.008 90);
  --nm-side-line: oklch(89% 0.006 90);
  --nm-side-field: #F5F3EF;
  --nm-side-chip: oklch(93.5% 0.008 90);
  --nm-ink: oklch(32% 0.012 260);
  --nm-heading: oklch(22% 0.012 260);
  --nm-muted: oklch(58% 0.010 260);
  --nm-line: oklch(89% 0.006 90);
  --nm-bg: #F5F3EF;
  /* Surfaces are named rather than written as #fff in sixty places, so the
     dark theme is a change of palette and not a change of every rule. */
  --nm-paper: #FCFBF8;
  --nm-paper-2: oklch(93.5% 0.008 90);
  --nm-faint: oklch(75% 0.008 260);
  --nm-ok-bg: #e8f8f0;
  --nm-ok-line: #bbf7d0;
  --nm-ok-ink: #15803d;
  --nm-warn-bg: #fef3c7;
  --nm-warn-line: #fde68a;
  --nm-warn-ink: #92400e;
  --nm-err-bg: #fef2f2;
  --nm-err-line: #fecaca;
  --nm-err-ink: #991b1b;
  --nm-danger: #f7525a;
  --nm-shadow: 0 1px 2px oklch(22% 0.012 260 / 0.05), 0 1px 3px oklch(22% 0.012 260 / 0.04);
  --nm-side-w: 248px;
  color-scheme: light;
}

/* Explicit choice wins (More / Settings toggle, same nzura-theme key as the
   rest of Nzura). Until the person picks, the boot script mirrors the phone. */
/* Dark surfaces match Ads Manager / platform chrome: page #010919, cards #091222.
   Primary stays bright teal so CTAs stay colored (attorneys pattern). */
html[data-theme="dark"],
html.dark {
  --nm-primary: #1075eb;
  --nm-primary-hover: #3b8ff5;
  --nm-primary-soft: rgba(59, 143, 245, 0.18);
  --nm-primary-rgb: 59, 143, 245;
  --nm-side: #010919;
  --nm-side-deep: #010919;
  --nm-side-ink: #fff;
  --nm-side-ink-2: rgba(255, 255, 255, 0.76);
  --nm-side-muted: rgba(255, 255, 255, 0.5);
  --nm-side-hover: rgba(255, 255, 255, 0.08);
  --nm-side-line: rgba(255, 255, 255, 0.06);
  --nm-side-field: rgba(255, 255, 255, 0.08);
  --nm-side-chip: rgba(255, 255, 255, 0.16);
  --nm-ink: oklch(96% 0.005 90);
  --nm-heading: oklch(96% 0.005 90);
  --nm-muted: oklch(64% 0.010 260);
  --nm-line: oklch(30% 0.012 260);
  --nm-bg: #010919;
  --nm-paper: #091222;
  --nm-paper-2: #13223c;
  --nm-faint: oklch(46% 0.012 260);
  --nm-ok-bg: rgba(46, 232, 154, 0.12);
  --nm-ok-line: rgba(46, 232, 154, 0.28);
  --nm-ok-ink: #2ee89a;
  --nm-warn-bg: rgba(240, 181, 66, 0.15);
  --nm-warn-line: rgba(240, 181, 66, 0.28);
  --nm-warn-ink: #f0b542;
  --nm-err-bg: rgba(255, 107, 114, 0.15);
  --nm-err-line: rgba(255, 107, 114, 0.28);
  --nm-err-ink: #ff6b72;
  --nm-danger: #ff6b72;
  --nm-shadow: 0 1px 2px rgba(20, 20, 30, 0.04);
  color-scheme: dark;
}
/* The chevron is baked into a data URI, so it needs its own light stroke. */
html[data-theme="dark"] .field select,
html[data-theme="dark"] select.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a3b3' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  color: var(--nm-ink); background: var(--nm-bg);
  font-family: var(--font-sans, "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif);
  font-size: calc(0.9rem * var(--nm-type-scale, 1));
  -webkit-font-smoothing: antialiased;
}
#root { height: 100%; min-height: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Element-level baseline so a control added outside a .field wrapper still
   looks like the rest of the app instead of the browser's square default. */
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  border: 1px solid var(--nm-line); border-radius: 10px; padding: 0.55rem 0.7rem;
  background: var(--nm-paper); min-height: 2.35rem;
}
/* Same trap as the border: a control outside .field kept the browser's black
   focus ring, which reads as a square black box among the rounded fields. */
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus {
  outline: none; box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.18);
}
.compose-line input:focus { border-color: var(--nm-primary); }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px solid transparent; border-radius: 10px; padding: 0.55rem 0.95rem;
  font-weight: 700; font-size: 0.85rem; cursor: pointer;
  background: var(--nm-primary); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--nm-primary-hover); }
.btn.ghost { background: var(--nm-paper); color: var(--nm-ink); border-color: var(--nm-line); }
.btn.ghost:hover { background: var(--nm-paper-2); }
.btn.danger { background: var(--nm-err-ink); border-color: var(--nm-err-ink); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.link { background: transparent; color: var(--nm-primary); border-color: transparent; padding: 0.3rem 0.2rem; }
.btn.link:hover { background: transparent; text-decoration: underline; }
.btn.sm { padding: 0.4rem 0.7rem; font-size: 0.78rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.is-busy:disabled { opacity: 1; cursor: wait; }
.auth-spin {
  width: 1rem; height: 1rem; border-radius: 50%; flex: none;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: nm-spin 0.75s linear infinite;
}
.icon-btn {
  width: 2.1rem; height: 2.1rem; border-radius: 9px; border: 1px solid var(--nm-line);
  background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--nm-muted);
}
.icon-btn:hover { color: var(--nm-primary); border-color: var(--nm-primary-soft); }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.7rem; }
.field.tight { margin-bottom: 0; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--nm-ink); }
.field input, .field select, .field textarea {
  border: 1px solid var(--nm-line); border-radius: 10px; padding: 0.6rem 0.75rem;
  background: var(--nm-paper); width: 100%; min-height: 2.5rem;
}
.field input::placeholder, .field textarea::placeholder { color: var(--nm-muted); }
.field select, select.select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 2.3rem;
  background-color: var(--nm-paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus {
  outline: none; border-color: var(--nm-primary); box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.18);
}
.field .hint { font-size: 0.75rem; color: var(--nm-muted); }
.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%; border: 1px solid var(--nm-line); border-radius: 10px;
  padding: 0.6rem 0.75rem 0.6rem 2.3rem; background: var(--nm-paper); min-height: 2.5rem;
}
.search .icon { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); color: var(--nm-muted); }
.pass-row { display: flex; align-items: stretch; gap: 0.5rem; width: 100%; }
.pass-row input { flex: 1; }
.pass-row .password-wrap { flex: 1 1 auto; min-width: 12rem; width: 100%; }
/* Same eye / eye-off as nzura.co.tz/login — not a monkey covering its face. */
.password-wrap { position: relative; display: block; }
.field .password-wrap input, .password-wrap input {
  width: 100%; min-height: 3.15rem; font-size: 1.05rem;
  padding: 0.8rem 2.85rem 0.8rem 0.95rem;
  border: 1.5px solid var(--nm-muted); border-radius: 12px;
  background: var(--nm-paper-2);
}
.field .password-wrap input[type="password"] { letter-spacing: 0.16em; }
.field .password-wrap input[type="password"]::placeholder,
.password-wrap input[type="password"]::placeholder {
  letter-spacing: 0; font-size: 0.95rem; color: var(--nm-muted);
}
.field .password-wrap input:focus, .password-wrap input:focus {
  outline: none; border-color: var(--nm-primary); background: var(--nm-paper);
  box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.18);
}
.reveal-pass .password-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--nm-paper);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pw-toggle {
  position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  width: 2.4rem; height: 2.4rem; border: 0; padding: 0; border-radius: 9px;
  background: transparent; color: var(--nm-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; line-height: 0;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--nm-ink); background: var(--nm-paper); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
@media (max-width: 480px) {
  .pass-row { flex-wrap: wrap; }
  .pass-row .btn { flex: 1 1 100%; }
}

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100%; min-height: 100dvh; display: grid; place-items: center;
  padding: max(1.25rem, var(--nm-safe-top)) 1.25rem max(1.25rem, var(--nm-safe-bottom));
  overflow: auto;
  background: radial-gradient(1100px 520px at 20% -10%, var(--nm-primary-soft) 0%, transparent 60%), var(--nm-bg);
}
.auth-wrap[data-step="password"] {
  --nm-primary: #0d9488;
  --nm-primary-hover: #0f766e;
  --nm-primary-soft: rgba(13, 148, 136, 0.16);
  --nm-primary-rgb: 13, 148, 136;
}
.auth-wrap[data-step="sender"] {
  --nm-primary: #15803d;
  --nm-primary-hover: #166534;
  --nm-primary-soft: rgba(21, 128, 61, 0.16);
  --nm-primary-rgb: 21, 128, 61;
}
html[data-theme="dark"] .auth-wrap[data-step="password"],
html.dark .auth-wrap[data-step="password"] {
  --nm-primary: #2dd4bf;
  --nm-primary-hover: #5eead4;
  --nm-primary-soft: rgba(45, 212, 191, 0.22);
  --nm-primary-rgb: 45, 212, 191;
}
html[data-theme="dark"] .auth-wrap[data-step="sender"],
html.dark .auth-wrap[data-step="sender"] {
  --nm-primary: #2ee89a;
  --nm-primary-hover: #5ef0b3;
  --nm-primary-soft: rgba(46, 232, 154, 0.22);
  --nm-primary-rgb: 46, 232, 154;
}
.auth-stage { width: min(100%, 430px); }
.auth-brand { text-align: center; margin-bottom: 1.35rem; }
.auth-brand .logo {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 0.7rem; max-width: 100%;
}
/* Pin the SVG box: iPhone Safari otherwise paints the 940-wide viewBox over the title. */
.logo-mark {
  height: 2.6rem; width: calc(2.6rem * 940 / 540); overflow: hidden;
  display: grid; place-items: center; flex: 0 0 auto;
}
.logo-mark.lg { height: 3.6rem; width: calc(3.6rem * 940 / 540); }
.logo-mark .brand-logo { height: 100%; width: 100%; display: block; }
.auth-brand h1 { margin: 0; font-size: 1.85rem; font-weight: 300; letter-spacing: -0.025em; line-height: 1.15; }
.auth-brand p { margin: 0.7rem 0 0; color: var(--nm-muted); font-size: 0.92rem; }
.auth-install { margin-top: 0.85rem; }
.auth-install .btn { width: 100%; justify-content: center; gap: 0.45rem; }
@media (max-width: 480px) {
  .auth-brand .logo { flex-direction: column; gap: 0.4rem; }
  .auth-brand h1 { font-size: 1.5rem; }
  .auth-brand p { margin-top: 0.45rem; }
}
.auth-card {
  background: var(--nm-paper); border: 1px solid var(--nm-line); border-radius: 16px;
  box-shadow: var(--nm-shadow); overflow: hidden; position: relative;
  border-top: 4px solid var(--nm-primary);
}
.auth-progress {
  display: none; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  overflow: hidden; background: var(--nm-line);
}
.auth-card.is-busy .auth-progress { display: block; }
.auth-progress > span {
  display: block; height: 100%; width: 32%; border-radius: inherit; background: var(--nm-primary);
  animation: send-bar 1.05s ease-in-out infinite;
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--nm-line); }
.auth-tab {
  border: 0; background: transparent; padding: 0.85rem 0.5rem; font-weight: 700; font-size: 0.88rem;
  color: var(--nm-muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.auth-tab.active { color: var(--nm-primary); border-bottom-color: var(--nm-primary); }
.auth-tab:disabled { opacity: 0.55; cursor: not-allowed; }
.auth-body { padding: 1.15rem 1.2rem 1.3rem; }
.auth-foot { margin: 1rem 0 0; text-align: center; font-size: 0.8rem; color: var(--nm-muted); }
.auth-tools { display: flex; justify-content: center; align-items: center; gap: 1.1rem; }
.auth-tools .btn.link { display: inline-flex; align-items: center; gap: 0.35rem; }
.otp-row { display: flex; gap: 0.4rem; justify-content: center; margin: 0.5rem 0 1rem; }
.otp-row input {
  width: 2.6rem; height: 3rem; text-align: center; font-size: 1.25rem; font-weight: 800;
  border: 1px solid var(--nm-line); border-radius: 12px; background: var(--nm-paper);
}
.otp-row.is-busy input {
  animation: otp-digit-pulse 1s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes otp-digit-pulse {
  0%, 100% { border-color: var(--nm-line); }
  50% { border-color: var(--nm-primary); box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.18); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-spin, .auth-progress > span, .otp-row.is-busy input { animation: none; }
  .auth-spin { opacity: 0.85; }
}
.otp-alt { text-align: center; margin: 0 0 0.9rem; }
.otp-alt button { border: 0; background: transparent; color: var(--nm-primary); font-weight: 700; font-size: 0.8rem; cursor: pointer; text-decoration: underline; }
.otp-alt button:disabled { opacity: 0.55; cursor: default; text-decoration: none; }

/* ---------- Alerts ---------- */
.alert {
  padding: 0.7rem 0.85rem; border-radius: 10px; margin-bottom: 0.85rem; font-size: 0.85rem;
  display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
}
/* Auto margin applies per flex line, so the fix stays thumb-side after wrapping. */
.alert-actions { display: flex; gap: 0.35rem; align-items: center; margin-left: auto; flex: none; }
.alert .btn { flex: none; }
.alert-x {
  flex: none; border: 0; background: transparent; cursor: pointer;
  color: inherit; opacity: 0.7; display: grid; place-items: center;
  padding: 0.2rem; border-radius: 6px; line-height: 1;
}
.alert.ok .alert-x { margin-left: auto; }
.alert.err .alert-x { margin-left: 0.15rem; }
.alert-x:hover { opacity: 1; background: rgba(15, 23, 42, 0.07); }
.alert.err { background: var(--nm-err-bg); border: 1px solid var(--nm-err-line); color: var(--nm-err-ink); }
.alert.ok { background: var(--nm-ok-bg); border: 1px solid var(--nm-ok-line); color: var(--nm-ok-ink); }

/* ---------- App shell ---------- */
.app {
  display: grid; grid-template-columns: var(--nm-side-w) 1fr;
  height: 100%; height: 100dvh; min-height: 0; overflow: hidden;
}
.side {
  background: linear-gradient(180deg, var(--nm-side) 0%, var(--nm-side-deep) 100%);
  border-right: 1px solid var(--nm-side-line);
  color: var(--nm-side-ink); display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100%; height: 100dvh; overflow: hidden;
}
.side-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: calc(1rem + var(--nm-safe-top)) 1rem 0.85rem;
}
.side-brand .logo-mark { height: 2.1rem; width: calc(2.1rem * 940 / 540); }
/* Inventory KPI / page-title contract: light Open Sans, soft ink — not black 700. */
.side-brand strong {
  font-size: 1.02rem; font-weight: var(--nm-fw-kpi); letter-spacing: var(--nm-kpi-tracking);
  color: var(--nm-side-ink-2);
}
.side-scroll { flex: 1; overflow-y: auto; padding: 0 0.6rem 0.6rem; }
.side-scroll::-webkit-scrollbar { width: 6px; }
.side-scroll::-webkit-scrollbar-thumb { background: var(--nm-side-chip); border-radius: 999px; }
.side-sec {
  padding: 0.9rem 0.65rem 0.35rem; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--nm-side-muted);
  display: flex; align-items: center; justify-content: space-between; gap: 0.4rem;
}
.side-link {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.6rem 0.7rem; border: 0; border-radius: 10px; margin-bottom: 0.12rem;
  background: transparent; color: var(--nm-side-ink-2);
  font-size: 0.87rem; font-weight: 600; cursor: pointer;
}
.side-link:hover { background: var(--nm-side-hover); color: var(--nm-side-ink); }
.side-link.active { background: var(--nm-primary); color: #fff; }
/* Coloured nav icons, hard hex like attorneys so a theme cannot gray them. */
.side-link[data-nav="dashboard"] .icon { color: #22b378; }
.side-link[data-nav="email"] .icon { color: #1075eb; }
.side-link[data-nav="accounts"] .icon { color: #7c3aed; }
.side-link[data-nav="services"] .icon { color: #0e7490; }
.side-link[data-nav="invoices"] .icon { color: #dc9d28; }
.side-link[data-nav="settings"] .icon { color: #f7525a; }
html[data-theme="dark"] .side-link[data-nav="dashboard"] .icon,
html.dark .side-link[data-nav="dashboard"] .icon { color: #2ee89a; }
html[data-theme="dark"] .side-link[data-nav="email"] .icon,
html.dark .side-link[data-nav="email"] .icon { color: #3b8ff5; }
html[data-theme="dark"] .side-link[data-nav="accounts"] .icon,
html.dark .side-link[data-nav="accounts"] .icon { color: #a78bfa; }
html[data-theme="dark"] .side-link[data-nav="services"] .icon,
html.dark .side-link[data-nav="services"] .icon { color: #22d3ee; }
html[data-theme="dark"] .side-link[data-nav="invoices"] .icon,
html.dark .side-link[data-nav="invoices"] .icon { color: #f0b542; }
html[data-theme="dark"] .side-link[data-nav="settings"] .icon,
html.dark .side-link[data-nav="settings"] .icon { color: #ff6b72; }
/* Mail folders and accounts, keyed by role (data-kind) not by server name.
   Direct child only: the collapsed account row also holds a back arrow and
   a chevron that must stay quiet. */
.side-link[data-kind="mailbox"] > .icon { color: #7c3aed; }
.side-link[data-kind="inbox"] .icon { color: #1075eb; }
.side-link[data-kind="send"] .icon { color: #22b378; }
.side-link[data-kind="draft"] .icon { color: #dc9d28; }
.side-link[data-kind="archive"] .icon { color: #7c3aed; }
.side-link[data-kind="spam"] .icon { color: #f7525a; }
.side-link[data-kind="trash"] .icon { color: #b45309; }
.side-link[data-kind="folder"] .icon { color: #0e7490; }
.side-link[data-kind="plus"] .icon { color: #1075eb; }
html[data-theme="dark"] .side-link[data-kind="inbox"] .icon, html.dark .side-link[data-kind="inbox"] .icon,
html[data-theme="dark"] .side-link[data-kind="plus"] .icon, html.dark .side-link[data-kind="plus"] .icon { color: #3b8ff5; }
html[data-theme="dark"] .side-link[data-kind="send"] .icon, html.dark .side-link[data-kind="send"] .icon { color: #2ee89a; }
html[data-theme="dark"] .side-link[data-kind="draft"] .icon, html.dark .side-link[data-kind="draft"] .icon { color: #f0b542; }
html[data-theme="dark"] .side-link[data-kind="archive"] .icon, html.dark .side-link[data-kind="archive"] .icon,
html[data-theme="dark"] .side-link[data-kind="mailbox"] > .icon, html.dark .side-link[data-kind="mailbox"] > .icon { color: #a78bfa; }
html[data-theme="dark"] .side-link[data-kind="spam"] .icon, html.dark .side-link[data-kind="spam"] .icon { color: #ff6b72; }
html[data-theme="dark"] .side-link[data-kind="trash"] .icon, html.dark .side-link[data-kind="trash"] .icon { color: #f59e0b; }
html[data-theme="dark"] .side-link[data-kind="folder"] .icon, html.dark .side-link[data-kind="folder"] .icon { color: #22d3ee; }
.side-link.active .icon { color: #fff; }
.side-link .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Rail counts are quiet mono text, never a pill (app.css .nav-badge rule). */
.side-link .count {
  flex: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: calc(10px * var(--nm-type-scale, 1)); font-weight: 500; color: var(--nm-side-muted);
}
.side-link.active .count { color: #fff; opacity: 0.6; }
.side-link.mini { font-size: 0.82rem; font-weight: 500; color: var(--nm-side-ink-2); }
.side-link.mini.active { font-weight: 700; color: #fff; }
.side-find { position: relative; padding: 0 0.65rem 0.55rem; }
.side-find .icon { position: absolute; left: 1.2rem; top: 0.55rem; opacity: 0.5; pointer-events: none; }
.side-find input {
  width: 100%; padding: 0.45rem 0.6rem 0.45rem 2.15rem; border-radius: 9px; font: inherit;
  font-size: 0.82rem; color: var(--nm-side-ink);
  border: 1px solid var(--nm-side-line); background: var(--nm-side-field);
}
.side-find input::placeholder { color: var(--nm-side-muted); }
.side-find input:focus { outline: none; border-color: var(--nm-primary); background: var(--nm-side-field); }
.side-hidden { display: none !important; }
/* .side-link{display:flex} beats UA [hidden]; same trap as the Viewing picker. */
.side-link[hidden], .side-link.is-filtered,
.side-box-empty[hidden], .side-box-empty.is-filtered { display: none !important; }
.side-box-find { position: relative; padding: 0.2rem 0.15rem 0.5rem; }
.side-box-find .icon { position: absolute; left: 0.7rem; top: 0.62rem; opacity: 0.5; pointer-events: none; }
.side-box-find input {
  width: 100%; padding: 0.45rem 0.6rem 0.45rem 2.15rem; border-radius: 9px; font: inherit;
  font-size: 0.82rem; color: var(--nm-side-ink); min-height: 2.2rem;
  border: 1px solid var(--nm-side-line); background: var(--nm-side-field);
}
.side-box-find input::placeholder { color: var(--nm-side-muted); }
.side-box-find input:focus { outline: none; border-color: var(--nm-primary); background: var(--nm-side-field); }
.side-wrap:not(.open) > .side-box-find { display: none; }
.side-scroll.finding .side-box-find { display: none; }
.side-box-empty { padding: 0.45rem 0.2rem 0.35rem; font-size: 0.8rem; color: var(--nm-side-muted); }
.side-parent .side-chev { flex: none; opacity: 0.55; transition: transform 0.18s ease; }
.side-wrap.open > .side-parent .side-chev { transform: rotate(90deg); opacity: 0.95; }
/* Collapsed by default and capped when open, so a long address list scrolls
   inside itself instead of pushing every other row out of the rail. */
.side-sub {
  display: none; max-height: 40vh; overflow-y: auto;
  margin: 0.1rem 0 0.2rem 0.4rem; padding-left: 0.5rem;
  border-left: 1px solid var(--nm-side-line);
}
.side-wrap.open > .side-sub { display: block; }
.side-sub::-webkit-scrollbar { width: 6px; }
.side-sub::-webkit-scrollbar-thumb { background: var(--nm-side-chip); border-radius: 999px; }
/* An open list gets the whole rail, the way the tenant sidebar's module drill
   does. The toggle sits at the bottom of the rail, so leaving the other groups
   in place would open the list below the fold and look like nothing happened. */
.side-scroll.drilled > .side-group:not(.drill-here) { display: none; }
.side-scroll.drilled .side-sub { max-height: none; }
/* With the rest of the rail out of the way, the toggle row is also the way
   back, so it says so. */
.side-back { display: none; }
.side-scroll.drilled .drill-here .side-back { display: inline-flex; flex: none; opacity: 0.7; }
/* The direct-child icon is the envelope; the back and chevron ones are nested. */
.side-scroll.drilled .drill-here .side-parent > .icon { display: none; }
/* While filtering, a collapsed group still has to be able to show its hits,
   and the toggle row is a control rather than somewhere to go. */
.side-scroll.finding .side-sub { display: block; max-height: none; }
.side-scroll.finding .side-parent { display: none; }
.side-scroll.finding.drilled > .side-group { display: block; }
.side-empty { padding: 0.55rem 0.7rem; font-size: 0.8rem; color: var(--nm-side-muted); }
.side-user {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.65rem;
  padding: 0.8rem 0.9rem calc(0.8rem + var(--nm-safe-bottom));
  border-top: 1px solid var(--nm-side-line);
}
.side-who-row { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who strong {
  display: block; font-size: 0.82rem; font-weight: var(--nm-fw-kpi); letter-spacing: var(--nm-kpi-tracking);
  color: var(--nm-side-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user .who span { display: block; font-size: 0.72rem; color: var(--nm-side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-logout {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; min-height: 2.45rem; padding: 0.45rem 0.7rem;
  border: 1px solid var(--nm-err-line); border-radius: 10px;
  background: var(--nm-err-bg); color: var(--nm-err-ink);
  font: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer;
}
.side-logout:hover { filter: brightness(1.06); }
.avatar {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.78rem; flex: 0 0 auto; background: var(--nm-primary);
  background-size: cover; background-position: center; overflow: hidden; position: relative;
}
.avatar.has-img { color: transparent; text-shadow: none; }
.avatar.has-img img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
}
.avatar.has-img .avatar-letter { display: none; }
.avatar.sm { width: 1.75rem; height: 1.75rem; font-size: 0.7rem; }
.body-col {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  height: 100%; overflow: hidden; background: var(--nm-bg);
}
.topbar {
  display: flex; align-items: center; gap: 0.6rem; justify-content: space-between;
  /* Same contract as .mtabs: chrome background may paint into the OS inset,
     but the controls sit below the status bar / notch. */
  padding: calc(0.65rem + var(--nm-safe-top)) 1.1rem 0.65rem;
  background: var(--nm-paper); border-bottom: 1px solid var(--nm-line);
  position: sticky; top: 0; z-index: 15; flex: none;
}
.topbar .who-chip {
  display: flex; align-items: center; gap: 0.55rem; min-width: 0;
  border: 0; background: transparent; padding: 0; font: inherit; color: inherit; cursor: pointer;
}
.top-actions { display: flex; align-items: center; gap: 0.45rem; flex: none; margin-left: auto; }
.top-spacer { flex: 1; }
.topbar .who-chip .who { min-width: 0; text-align: right; }
.topbar .who-chip strong {
  display: block; font-size: 0.82rem; font-weight: var(--nm-fw-kpi); letter-spacing: var(--nm-kpi-tracking);
  color: var(--nm-ink);
}
.topbar .who-chip span { display: block; font-size: 0.72rem; color: var(--nm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.burger { display: none; }
.content {
  padding: 1.15rem; flex: 1; min-width: 0; min-height: 0;
  overflow: auto; -webkit-overflow-scrolling: touch;
}
/* Reading: chrome stays put; one scrollport under it; one L/R column edge.
   Inbox / compose keep .content overflow:auto — only .is-reading is a flex column. */
.content.is-reading {
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
  padding-left: 0; padding-right: 0;
}
.content.is-reading > .alert {
  flex: none;
  margin-left: 1.15rem; margin-right: 1.15rem;
}
.page-head { display: flex; align-items: flex-start; gap: 0.75rem; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head-main {
  display: flex; align-items: center; gap: 0.65rem; min-width: 0; flex: 1 1 12rem;
  flex-wrap: nowrap;
}
.page-head-titles { min-width: 0; flex: 1 1 auto; }
.page-head h2 { margin: 0; font-size: 1.55rem; font-weight: 300; letter-spacing: -0.025em; line-height: 1.08; color: var(--nm-heading); }
.page-head p { margin: 0.25rem 0 0; color: var(--nm-muted); font-size: 0.87rem; }
/* Shared Back pill — page heads (.page-back) and reader chrome (.read-back).
   Not icon-btn: those stay transparent circles. */
button.nm-back,
.read-chrome button.read-back {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.28rem;
  height: 2.75rem; min-height: 2.75rem;
  padding: 0 0.8rem 0 0.65rem;
  border: 0; border-radius: 999px;
  background: var(--nm-primary); color: #fff;
  font: inherit; font-size: 0.8rem; font-weight: 700; line-height: 1;
  letter-spacing: 0.01em; white-space: nowrap; cursor: pointer;
  box-shadow: 0 2px 8px rgba(var(--nm-primary-rgb), 0.42);
}
button.nm-back:hover,
.read-chrome button.read-back:hover {
  color: #fff;
  background: color-mix(in srgb, var(--nm-primary) 78%, #fff);
  box-shadow: 0 3px 10px rgba(var(--nm-primary-rgb), 0.5);
}
button.nm-back:focus-visible,
.read-chrome button.read-back:focus-visible {
  outline: none; color: #fff;
  box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.3),
    0 2px 8px rgba(var(--nm-primary-rgb), 0.42);
}
button.nm-back .icon,
.read-chrome button.read-back .icon {
  width: 1.15rem; height: 1.15rem; stroke-width: 2.2;
}
.mail-head .page-back { margin-right: 0.15rem; }
/* Auto margins apply per flex line, so actions stay thumb-side (right) even
   after the row wraps on a phone — never stranded at the left edge. */
.page-head .actions,
.mail-head .actions {
  display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap;
  margin-left: auto; justify-content: flex-end;
}
.btn.inbox-jump {
  position: relative;
  gap: 0.4rem;
}
.btn.inbox-jump .inbox-count {
  min-width: 1.2rem; padding: 0 0.35rem; border-radius: 999px;
  background: var(--nm-danger); color: #fff;
  font-size: 0.68rem; font-weight: 800; line-height: 1.2rem; text-align: center;
}

/* ---------- Cards ---------- */
.card { background: var(--nm-paper); border: 1px solid var(--nm-line); border-radius: 14px; box-shadow: var(--nm-shadow); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--nm-line);
}
.card-head h3 { margin: 0; font-size: 0.98rem; font-weight: var(--nm-fw-ui); }
.read-chrome {
  position: sticky; top: 0; z-index: 8;
  flex: none;
  display: flex; align-items: center; gap: 0.1rem;
  padding-top: calc(0.3rem + var(--nm-safe-top));
  padding-right: 0.25rem; padding-bottom: 0.3rem; padding-left: 0.15rem;
  background: var(--nm-paper);
  user-select: none; -webkit-user-select: none;
}
.read-chrome .icon-btn {
  width: 2.5rem; height: 2.5rem; border: 0; background: transparent;
  color: var(--nm-ink); border-radius: 999px;
}
.read-chrome .icon-btn.is-pair {
  width: auto; min-width: 2.5rem; padding: 0 0.3rem;
  display: inline-flex; align-items: center; gap: 0;
}
.read-chrome-end { margin-left: auto; display: flex; align-items: center; gap: 0.05rem; }
.read-more-wrap { position: relative; }
.read-more-pop {
  position: absolute; right: 0; top: 100%; z-index: 9; min-width: 11rem;
  padding: 0.35rem; border: 1px solid var(--nm-line); border-radius: 12px;
  background: var(--nm-paper); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
.read-more-pop button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 0.65rem 0.7rem; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 650; color: var(--nm-ink);
}
.read-more-pop button:hover { background: var(--nm-paper-2); }
.app.is-reading ~ .fab-dock {
  display: flex;
}
.card-head .select { max-width: 16rem; min-width: 0; min-height: 2.2rem; padding-top: 0.35rem; padding-bottom: 0.35rem; font-size: 0.84rem; }
.card-body { padding: 1rem; }
.card-body.flush { padding: 0; }
.icon-tile {
  width: 2.5rem; height: 2.5rem; border-radius: 11px; display: grid; place-items: center;
  background: var(--nm-primary-soft); color: var(--nm-primary); flex: 0 0 auto;
}
.icon-tile.solid { background: var(--nm-primary); color: #fff; }
.icon-tile.amber { background: var(--nm-warn-bg); color: var(--nm-warn-ink); }
.icon-tile.green { background: var(--nm-ok-bg); color: var(--nm-ok-ink); }
.stat-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 0.9rem; }
.stat-card { padding: 1rem; display: grid; gap: 0.35rem; }
.stat-card .top { display: flex; align-items: center; gap: 0.6rem; }
.stat-card .label { font-size: 0.82rem; color: var(--nm-muted); font-weight: 600; }
/* Dashboard KPIs: each card keeps its own hue (same map as the rail). */
.stat-card[data-kind="mail"] .icon-tile { background: rgba(16, 117, 235, 0.12); color: #1075eb; }
.stat-card[data-kind="server"] .icon-tile { background: rgba(14, 116, 144, 0.12); color: #0e7490; }
.stat-card[data-kind="globe"] .icon-tile { background: rgba(34, 179, 120, 0.12); color: #22b378; }
.stat-card[data-kind="invoice"] .icon-tile { background: rgba(220, 157, 40, 0.14); color: #dc9d28; }
html[data-theme="dark"] .stat-card[data-kind="mail"] .icon-tile,
html.dark .stat-card[data-kind="mail"] .icon-tile { background: rgba(59, 143, 245, 0.18); color: #3b8ff5; }
html[data-theme="dark"] .stat-card[data-kind="server"] .icon-tile,
html.dark .stat-card[data-kind="server"] .icon-tile { background: rgba(34, 211, 238, 0.16); color: #22d3ee; }
html[data-theme="dark"] .stat-card[data-kind="globe"] .icon-tile,
html.dark .stat-card[data-kind="globe"] .icon-tile { background: rgba(46, 232, 154, 0.14); color: #2ee89a; }
html[data-theme="dark"] .stat-card[data-kind="invoice"] .icon-tile,
html.dark .stat-card[data-kind="invoice"] .icon-tile { background: rgba(240, 181, 66, 0.16); color: #f0b542; }
.stat-card .value {
  font-size: 1.75rem; font-weight: var(--nm-fw-kpi); letter-spacing: var(--nm-kpi-tracking);
  line-height: 1.1; color: var(--nm-heading); font-feature-settings: 'tnum';
}
.two-col { display: grid; gap: 0.85rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1080px) { .two-col { grid-template-columns: 1.65fr 1fr; } }
.quick-tiles { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quick-tile { padding: 1.2rem 1rem; text-align: center; display: grid; gap: 0.5rem; justify-items: center; }
.quick-tile h4 { margin: 0.2rem 0 0; font-size: 1rem; font-weight: var(--nm-fw-ui); }
.quick-tile p { margin: 0; font-size: 0.82rem; color: var(--nm-muted); line-height: 1.45; }
.cp-mark { font-weight: 900; font-size: 1.5rem; color: #ff6c2c; letter-spacing: -0.06em; }
.qa-btn {
  display: flex; align-items: center; gap: 0.65rem; width: 100%; text-align: left;
  padding: 0.6rem 0.7rem; border: 1px solid var(--nm-line); border-radius: 11px;
  background: var(--nm-paper); cursor: pointer; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.5rem;
}
.qa-btn:last-child { margin-bottom: 0; }
.qa-btn:hover { border-color: var(--nm-primary-soft); background: var(--nm-paper-2); }
.qa-btn .icon-tile { width: 2rem; height: 2rem; border-radius: 9px; }
.tile-row {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left;
  padding: 0.75rem 0.85rem; border: 1px solid var(--nm-line); border-radius: 12px;
  background: var(--nm-paper); cursor: pointer; margin-bottom: 0.55rem;
}
.tile-row:hover { border-color: var(--nm-primary-soft); background: var(--nm-paper-2); }
.tile-row .txt { min-width: 0; flex: 1; }
.tile-row > .icon:last-child { color: var(--nm-muted); }
.tile-row strong { display: block; font-size: 0.88rem; }
.tile-row span { display: block; font-size: 0.78rem; color: var(--nm-muted); margin-top: 0.1rem; }
.settings-sec { font-size: 0.88rem; font-weight: var(--nm-fw-ui); margin: 0 0 0.6rem; }
.settings-sec + .tile-row { margin-top: 0; }
.settings-group + .settings-group { margin-top: 1rem; }
.settings-notify-status { margin: -0.25rem 0 0.55rem; font-size: 0.8rem; color: var(--nm-muted); }
.settings-find { position: relative; margin: 0 0 0.65rem; }
.settings-find .icon {
  position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
  color: var(--nm-muted); pointer-events: none;
}
.settings-find input {
  width: 100%; border: 1px solid var(--nm-line); border-radius: 10px;
  padding: 0.6rem 0.75rem 0.6rem 2.3rem; background: var(--nm-paper);
  min-height: 2.5rem; font: inherit; color: inherit;
}
.settings-find input::placeholder { color: var(--nm-muted); }
.settings-find input:focus {
  outline: none; border-color: var(--nm-primary);
  box-shadow: 0 0 0 3px rgba(var(--nm-primary-rgb), 0.18);
}
.settings-cluster {
  border: 1px solid var(--nm-line); border-radius: 11px;
  padding: 0.15rem 0.45rem 0.3rem; margin-bottom: 0.45rem;
  background: var(--nm-paper-2);
}
.settings-cluster > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center;
  gap: 0.45rem; padding: 0.45rem 0.15rem;
  font-size: 0.82rem; font-weight: 700;
}
.settings-cluster > summary::-webkit-details-marker { display: none; }
.settings-cluster > summary .icon {
  flex: none; transform: rotate(-90deg); transition: transform 0.15s ease;
}
.settings-cluster[open] > summary .icon { transform: rotate(0deg); }
.settings-cluster > summary > span:first-of-type { flex: 1; min-width: 0; }
.settings-cluster-count { font-size: 0.72rem; font-weight: 600; color: var(--nm-muted); }
.settings-mb-row {
  display: flex; align-items: center; gap: 0.2rem; width: 100%;
  padding: 0.45rem 0.5rem; border: 1px solid var(--nm-line); border-radius: 10px;
  background: var(--nm-paper); margin-bottom: 0.35rem;
}
.settings-mb-row .settings-mb-main {
  display: flex; align-items: center; gap: 0.55rem; flex: 1; min-width: 0;
  border: 0; background: transparent; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.settings-mb-row .grow { min-width: 0; flex: 1; }
.settings-mb-row .grow strong {
  display: block; font-size: 0.86rem; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-mb-row .grow strong .badge { display: inline-flex; margin-left: 0.3rem; vertical-align: middle; }
.settings-mb-row .grow > span {
  display: block; font-size: 0.75rem; color: var(--nm-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-mb-row .as-pin {
  border: 0; background: transparent; color: var(--nm-muted); cursor: pointer;
  padding: 0.25rem; display: grid; place-items: center; border-radius: 8px; flex: none;
}
.settings-mb-row .as-pin.on { color: var(--nm-primary); }
.settings-mb-row .as-pin:hover { background: var(--nm-faint); color: var(--nm-primary); }

/* ---------- Lists / tables ---------- */
.list-row {
  display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--nm-line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { font-size: 0.88rem; font-weight: 700; display: block; }
.list-row .meta { font-size: 0.78rem; color: var(--nm-muted); margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; }
.list-row .when { font-size: 0.75rem; color: var(--nm-muted); white-space: nowrap; }
.list-row .recent-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.55rem;
  overflow: hidden;
}
.list-row .recent-from {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-row .recent-box {
  flex: 0 1 auto; max-width: 48%; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right; font-size: 0.68rem; font-weight: 700; color: var(--nm-muted);
}
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 520px; }
table.tbl th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--nm-muted); font-weight: 700; padding: 0.65rem 1rem;
  background: var(--nm-paper-2); border-bottom: 1px solid var(--nm-line); white-space: nowrap;
}
table.tbl td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--nm-line); font-size: 0.86rem; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--nm-paper-2); }
table.tbl td.right, table.tbl th.right { text-align: right; }

/* Mailbox accounts — card list (no horizontal table scroll on phone). */
.mbx-list {
  display: flex; flex-direction: column; gap: 0.45rem;
  padding: 0.55rem 0.65rem 0.7rem;
}
.mbx-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--nm-line);
  border-radius: 12px;
  background: var(--nm-paper);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mbx-card-head {
  display: flex; align-items: center; gap: 0.55rem; min-width: 0;
}
.mbx-card-titles { flex: 1 1 auto; min-width: 0; }
.mbx-card-titles .name {
  font-size: 0.84rem; font-weight: 800; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mbx-card-titles .sub {
  font-size: 0.68rem; color: var(--nm-muted); font-weight: 600; margin-top: 0.05rem;
}
.mbx-card-head .badge { flex: none; margin-left: auto; font-size: 0.68rem; padding: 0.15rem 0.45rem; }
.mbx-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0;
  padding: 0.28rem 0;
  border-top: 1px solid var(--nm-line); border-bottom: 1px solid var(--nm-line);
  font-size: 0.7rem; color: var(--nm-muted); font-weight: 600;
}
.mbx-card-meta .mi {
  display: inline-flex; align-items: center; gap: 0.28rem; min-width: 0;
  max-width: 100%; padding: 0 0.45rem;
}
.mbx-card-meta .mi + .mi { border-left: 1px solid var(--nm-line); }
.mbx-card-meta .mi span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.mbx-card-meta .mi .icon { width: 12px; height: 12px; flex: none; }
.mbx-card-meta .mi.sender .icon { color: #b45309; }
.mbx-card-meta .mi.sender.ok .icon { color: #15803d; }
.mbx-card-meta .mi.user .icon { color: #7c3aed; }
.mbx-card .acts {
  display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center;
}
.mbx-card .acts .btn {
  gap: 0.25rem; padding: 0.28rem 0.5rem; font-size: 0.72rem; min-height: 1.75rem;
}
.mbx-card .acts .btn .icon { width: 13px; height: 13px; }
.mbx-card .acts .btn .ic-default { color: var(--nm-primary); }
.mbx-card .acts .btn .ic-sender { color: #b45309; }
.mbx-card .acts .btn .ic-inbox { color: #0e7490; }
.mbx-card .acts .btn .ic-pass { color: #be123c; }
.mbx-card .acts .btn .ic-webmail { color: #15803d; }
.mbx-card .acts .btn .ic-sig { color: #6d28d9; }
html[data-theme="dark"] .mbx-card { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
html[data-theme="dark"] .mbx-card-meta .mi.sender .icon { color: #fbbf24; }
html[data-theme="dark"] .mbx-card-meta .mi.sender.ok .icon { color: #6ee7a7; }
html[data-theme="dark"] .mbx-card-meta .mi.user .icon { color: #a78bfa; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-default { color: #5b8cf8; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-sender { color: #fbbf24; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-inbox { color: #2dd4bf; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-pass { color: #fb7185; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-webmail { color: #6ee7a7; }
html[data-theme="dark"] .mbx-card .acts .btn .ic-sig { color: #c4b5fd; }
@media (max-width: 760px) {
  .accounts-page .page-head { margin-bottom: 0.45rem; }
  .accounts-page .page-head p { display: none; }
  .accounts-page .toolbar {
    flex-direction: column; align-items: stretch; gap: 0.4rem; padding: 0.55rem 0.65rem;
  }
  .accounts-page .toolbar select,
  .accounts-page .toolbar .select { max-width: none; width: 100%; }
  .accounts-page .toolbar .search { width: 100%; }
  .accounts-page .mbx-list { padding: 0.4rem; gap: 0.35rem; }
  .accounts-page .mbx-card { padding: 0.5rem 0.55rem; gap: 0.3rem; border-radius: 10px; }
  .accounts-page .mbx-card-titles .name { font-size: 0.8rem; white-space: normal; word-break: break-all; }
  .accounts-page .mbx-card .acts {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.25rem;
  }
  .accounts-page .mbx-card .acts .btn {
    flex-direction: column; justify-content: center; align-items: center;
    width: 100%; min-height: 2.45rem; padding: 0.25rem 0.15rem;
    font-size: 0.6rem; font-weight: 700; gap: 0.1rem; border-radius: 8px;
  }
  .accounts-page .mbx-card .acts .btn .icon { width: 14px; height: 14px; }
  .accounts-page .mbx-card .acts .btn .mbx-act-label {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}
/* Neutral badge is soft info on the primary, per app.css: never grey with
   bold muted ink and a border (the hated dark pill). ok/warn stay semantic. */
.badge {
  display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.12rem 0.45rem; border-radius: 999px;
  font-size: 0.65rem; font-weight: 600; white-space: nowrap; line-height: 1.4;
  background: var(--nm-primary-soft); color: var(--nm-primary); border: 0;
  font-feature-settings: 'tnum';
}
.badge.ok { background: var(--nm-ok-bg); color: var(--nm-ok-ink); }
.badge.warn { background: var(--nm-warn-bg); color: var(--nm-warn-ink); }
.toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; padding: 0.75rem 1rem; border-bottom: 1px solid var(--nm-line); }
.toolbar select { max-width: 180px; }
.subtabs { display: flex; gap: 1.2rem; border-bottom: 1px solid var(--nm-line); margin-bottom: 1rem; }
.subtab {
  border: 0; background: transparent; padding: 0.55rem 0; cursor: pointer;
  font-size: 0.87rem; font-weight: 700; color: var(--nm-muted); border-bottom: 2px solid transparent;
}
.subtab.active { color: var(--nm-primary); border-bottom-color: var(--nm-primary); }
/* The count says which half has anything in it before you click. */
.subtab-count {
  margin-left: 0.35rem; padding: 0.05rem 0.4rem; border-radius: 999px;
  background: var(--nm-line); color: var(--nm-muted); font-size: 0.72rem; font-weight: 700;
}
.subtab.active .subtab-count { background: var(--nm-primary-soft); color: var(--nm-primary); }
/* Compact hosting/domain cards — same rhythm as attorneys .att-entity-card. */
.svc-list {
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.65rem 0.75rem 0.75rem;
}
.svc-card {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  background: var(--nm-paper);
  border: 1px solid var(--nm-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.svc-card-head {
  display: flex; align-items: center; gap: 0.55rem; min-width: 0;
}
.svc-mark {
  flex: none; width: 2rem; height: 2rem; border-radius: 9px;
  display: grid; place-items: center; color: #fff;
}
.svc-mark .icon { width: 14px; height: 14px; }
.svc-mark.host { background: var(--nm-primary); }
.svc-mark.domain { background: #0e7490; }
.svc-card-titles { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.02rem; }
.svc-card-titles .name {
  font-size: 0.86rem; font-weight: 800; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.svc-card-titles .sub {
  font-size: 0.7rem; color: var(--nm-muted); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.svc-card-head .badge { flex: none; margin-left: auto; font-size: 0.68rem; padding: 0.15rem 0.45rem; }
.svc-card-meta {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 0;
  min-width: 0; overflow: hidden;
  padding: 0.32rem 0;
  border-top: 1px solid var(--nm-line); border-bottom: 1px solid var(--nm-line);
  font-size: 0.7rem; color: var(--nm-muted); font-weight: 600;
}
.svc-card-meta:empty { display: none; }
.svc-card-meta .mi {
  display: inline-flex; align-items: center; gap: 0.28rem; min-width: 0;
  max-width: 100%; padding: 0 0.5rem; flex: 1 1 0;
}
.svc-card-meta .mi:first-child { padding-left: 0.1rem; }
.svc-card-meta .mi:last-child { padding-right: 0.1rem; }
.svc-card-meta .mi + .mi { border-left: 1px solid var(--nm-line); }
.svc-card-meta .mi span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.svc-card-meta .mi .icon { width: 12px; height: 12px; flex: none; }
.svc-card-meta .mi.domain .icon { color: #0e7490; }
.svc-card-meta .mi.id .icon { color: #7c3aed; }
.svc-card-meta .mi.due .icon { color: #b45309; }
.svc-card-meta .mi.expires .icon { color: #be123c; }
.svc-card .acts {
  display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center;
}
.svc-card .acts .btn {
  gap: 0.25rem; padding: 0.28rem 0.5rem; font-size: 0.72rem; min-height: 1.75rem;
}
.svc-card .acts .btn .icon { width: 13px; height: 13px; }
.svc-card .acts .btn .ic-cpanel { color: #f97316; }
.svc-card .acts .btn .ic-webmail { color: var(--nm-primary); }
.svc-card .acts .btn .ic-mailboxes { color: #0e7490; }
.svc-card .acts .btn .ic-renew { color: #15803d; }
.svc-card .acts .btn .ic-manage { color: #7c3aed; }
html[data-theme="dark"] .svc-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
html[data-theme="dark"] .svc-mark.host { background: #3b8ff5; }
html[data-theme="dark"] .svc-mark.domain { background: #0f8aa3; }
html[data-theme="dark"] .svc-card-meta .mi.domain .icon { color: #2dd4bf; }
html[data-theme="dark"] .svc-card-meta .mi.id .icon { color: #a78bfa; }
html[data-theme="dark"] .svc-card-meta .mi.due .icon { color: #fbbf24; }
html[data-theme="dark"] .svc-card-meta .mi.expires .icon { color: #fb7185; }
html[data-theme="dark"] .svc-card .acts .btn .ic-cpanel { color: #fb923c; }
html[data-theme="dark"] .svc-card .acts .btn .ic-webmail { color: #5b8cf8; }
html[data-theme="dark"] .svc-card .acts .btn .ic-mailboxes { color: #2dd4bf; }
html[data-theme="dark"] .svc-card .acts .btn .ic-renew { color: #6ee7a7; }
html[data-theme="dark"] .svc-card .acts .btn .ic-manage { color: #a78bfa; }

/* Services tab — keep the page itself dense on phone (9 packages must scroll less). */
.services-page .page-head { margin-bottom: 0.65rem; gap: 0.5rem; }
.services-page .page-head .btn .buy-label-short { display: none; }
.services-page .subtabs { margin-bottom: 0.65rem; gap: 0.85rem; }
.services-page .card > .card-head { padding: 0.55rem 0.75rem; }
.services-page .svc-list { padding: 0.45rem 0.55rem 0.55rem; gap: 0.4rem; }
@media (max-width: 760px) {
  .services-page .page-head {
    flex-wrap: nowrap; align-items: center; margin-bottom: 0.45rem; gap: 0.4rem;
  }
  .services-page .page-head h2 { font-size: 1.1rem; }
  /* Hosting/Domains counts already live on the subtabs. */
  .services-page .page-head p { display: none; }
  .services-page .page-head .actions { flex: none; }
  .services-page .page-head .btn {
    padding: 0.35rem 0.55rem; min-height: 2rem; font-size: 0.75rem;
  }
  .services-page .page-head .btn .buy-label-full { display: none; }
  .services-page .page-head .btn .buy-label-short { display: inline; }
  .services-page .subtabs { margin-bottom: 0.45rem; gap: 0.65rem; }
  .services-page .card > .card-head { display: none; }
  .services-page .svc-list { padding: 0.4rem; gap: 0.35rem; }
  .services-page .svc-card {
    gap: 0.3rem; padding: 0.5rem 0.55rem; border-radius: 10px;
  }
  .services-page .svc-mark { width: 1.75rem; height: 1.75rem; border-radius: 8px; }
  .services-page .svc-mark .icon { width: 12px; height: 12px; }
  .services-page .svc-card-titles .name { font-size: 0.82rem; }
  .services-page .svc-card-titles .sub { font-size: 0.66rem; }
  .services-page .svc-card-meta { padding: 0.22rem 0; font-size: 0.66rem; }
  /* Four equal action tiles — one row, short labels, colored icons. */
  .services-page .svc-card .acts {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.25rem;
  }
  .services-page .svc-card .acts .btn {
    flex-direction: column; justify-content: center; align-items: center;
    width: 100%; min-height: 2.55rem; padding: 0.28rem 0.15rem;
    font-size: 0.62rem; font-weight: 700; gap: 0.12rem; border-radius: 8px;
  }
  .services-page .svc-card .acts .btn .icon { width: 15px; height: 15px; }
  .services-page .svc-card .acts .btn .svc-act-label {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .services-page .svc-card.domain-card .acts { grid-template-columns: 1fr; }
  .services-page .svc-card.domain-card .acts .btn { flex-direction: row; min-height: 2rem; }
}
.empty { padding: 2.1rem 1.1rem; text-align: center; color: var(--nm-muted); }
.empty strong { display: block; color: var(--nm-ink); font-size: 0.98rem; margin-bottom: 0.35rem; }
.empty p { margin: 0 0 0.9rem; font-size: 0.86rem; line-height: 1.5; }

/* Inbox fetch placeholder — static "Loading…" looked frozen on slow IMAP. */
.mail-skel { padding: 0 0 0.35rem; }
.mail-skel-status {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  padding: 0.7rem 0.85rem 0.35rem; color: var(--nm-primary);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em;
}
.mail-skel-spin {
  width: 1rem; height: 1rem; border-radius: 50%; flex: none;
  border: 2px solid color-mix(in srgb, var(--nm-primary) 28%, transparent);
  border-top-color: var(--nm-primary);
  animation: nm-spin 0.75s linear infinite;
}
.mail-skel-row {
  display: grid; grid-template-columns: 2.35rem 1fr; gap: 0.7rem; align-items: start;
  padding: 0.85rem 0.85rem; border-bottom: 1px solid var(--nm-line);
  animation: nm-skel-in 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.mail-skel-row:last-child { border-bottom: 0; }
.mail-skel-av {
  width: 2.35rem; height: 2.35rem; border-radius: 50%;
  background: linear-gradient(90deg,
    var(--nm-paper-2) 0%,
    color-mix(in srgb, var(--nm-primary) 12%, var(--nm-paper-2)) 45%,
    var(--nm-paper-2) 100%);
  background-size: 200% 100%;
  animation: nm-shimmer 1.15s ease-in-out infinite;
}
.mail-skel-main { display: grid; gap: 0.42rem; padding-top: 0.12rem; min-width: 0; }
.mail-skel-line {
  display: block; height: 0.62rem; border-radius: 999px; max-width: 100%;
  background: linear-gradient(90deg,
    var(--nm-paper-2) 0%,
    color-mix(in srgb, var(--nm-ink) 8%, var(--nm-paper-2)) 45%,
    var(--nm-paper-2) 100%);
  background-size: 200% 100%;
  animation: nm-shimmer 1.15s ease-in-out infinite;
}
.mail-skel-line.w60 { width: 58%; }
.mail-skel-line.w85 { width: 84%; }
.mail-skel-line.w45 { width: 42%; }
.mail-skel-row:nth-child(odd) .mail-skel-av,
.mail-skel-row:nth-child(odd) .mail-skel-line { animation-delay: 0.18s; }
@keyframes nm-spin { to { transform: rotate(360deg); } }
@keyframes nm-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes nm-skel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mail-skel-spin,
  .mail-skel-av,
  .mail-skel-line,
  .mail-skel-row { animation: none; }
  .mail-skel-spin { border-top-color: color-mix(in srgb, var(--nm-primary) 55%, transparent); opacity: 0.85; }
  .mail-skel-av,
  .mail-skel-line { background: var(--nm-paper-2); }
}

/* ---------- Mail ---------- */
.mail-head { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; margin-bottom: 0.85rem; flex-wrap: wrap; }
.mail-head h2 { margin: 0; font-size: 1.3rem; font-weight: 300; letter-spacing: -0.025em; }
.mail-head > h2 { flex: 1 1 auto; min-width: 0; }
.mail-search { margin-bottom: 0.85rem; display: flex; gap: 0.5rem; }
/* No column headings: a row is sender + subject + snippet + attachments
   stacked, at every width, so From/Subject/Date would label nothing. */
/* Sender, subject, snippet, date, attachments and the star all belong on the
   row: the point of a list is deciding what to open without opening it. */
.mail-list-toolbar {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--nm-line); background: var(--nm-paper-2);
}
.mail-list-toolbar .sel-all {
  display: inline-flex; align-items: center; gap: 0.45rem; border: 0; background: transparent;
  color: var(--nm-muted); font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; padding: 0;
}
.mail-list-toolbar .sel-all input { width: 1rem; height: 1rem; accent-color: var(--nm-primary); cursor: pointer; }
.mail-bulk-bar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--nm-line);
  background: var(--nm-primary-soft); color: var(--nm-ink);
}
.mail-bulk-bar .count { font-size: 0.82rem; font-weight: var(--nm-fw-ui); margin-right: 0.25rem; }
.mail-bulk-bar .btn { padding: 0.35rem 0.65rem; font-size: 0.76rem; }
.mail-swipe {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--nm-line); background: var(--nm-paper);
  touch-action: pan-y;
}
.mail-swipe:last-child { border-bottom: 0; }
.mail-swipe .swipe-reveal {
  position: absolute; inset: 0 auto 0 0; width: 5.5rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.2rem; color: #fff; font-size: 0.72rem; font-weight: 800;
  pointer-events: none; opacity: 0; transition: opacity 0.12s ease;
}
.mail-swipe .swipe-reveal .icon { width: 20px; height: 20px; }
.mail-swipe .swipe-reveal.right { left: 0; right: auto; background: #2563eb; }
.mail-swipe .swipe-reveal.left { left: auto; right: 0; background: #16a34a; }
.mail-swipe.swiping .swipe-reveal.visible { opacity: 1; }
.mail-row {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: 1.4rem 2.2rem minmax(0, 1fr) auto 1.9rem; gap: 0.55rem;
  align-items: start; padding: 0.7rem 0.85rem;
  cursor: pointer; background: var(--nm-paper); text-align: left;
  transition: transform 0.12s ease;
  will-change: transform;
}
.mail-swipe:last-child .mail-row { border-bottom: 0; }
.mail-row:hover { background: var(--nm-paper-2); }
.mail-row.active { background: var(--nm-primary-soft); }
.mail-row.selected { background: var(--nm-primary-soft); }
.mail-row .mail-check {
  display: grid; place-items: center; align-self: center; padding: 0; margin: 0;
  border: 0; background: transparent; cursor: pointer; color: var(--nm-muted);
  opacity: 0; pointer-events: none;
}
.mail-row .mail-check input {
  width: 1.05rem; height: 1.05rem; accent-color: var(--nm-primary); cursor: pointer; pointer-events: none;
}
.mail-row .mail-av { padding-top: 0.1rem; }
.mail-row .mail-main { min-width: 0; display: grid; gap: 0.1rem; }
.mail-row .mail-actions {
  display: none; align-items: center; gap: 0.15rem; align-self: center; flex: none;
}
.mail-row .mail-actions .icon-btn {
  width: 1.85rem; height: 1.85rem; border-radius: 8px; color: var(--nm-muted);
}
.mail-row .line { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.mail-row .who {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.86rem; color: var(--nm-ink);
}
.mail-row .thread-count {
  flex: none; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem;
  border-radius: 999px; background: var(--nm-primary-soft); color: var(--nm-primary);
  font-size: 0.68rem; font-weight: 800; line-height: 1.25rem; text-align: center;
}
.mail-row .subj-row { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.mail-row .subj-row .subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .when { font-size: 0.74rem; color: var(--nm-muted); white-space: nowrap; flex: none; }
.mail-row .subj {
  font-size: 0.85rem; color: var(--nm-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-row .snip { font-size: 0.8rem; color: var(--nm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .udot { width: 7px; height: 7px; border-radius: 50%; background: var(--nm-primary); flex: none; }
.mail-row.unread .who, .mail-row.unread .subj { font-weight: 700; }
.mail-row.unread .when { color: var(--nm-primary); font-weight: 700; }
/* Selection mode (select-all or long-press): every row shows its check. */
.mail-selecting .mail-row .mail-check,
.mail-row.selected .mail-check { opacity: 1; pointer-events: auto; }
@media (max-width: 760px) {
  /* Checks stay gone until selection mode — no empty checkbox column. */
  .mail-row { grid-template-columns: 2.2rem minmax(0, 1fr) 1.9rem; }
  .mail-row .mail-check { display: none; }
  .mail-selecting .mail-row { grid-template-columns: 1.4rem 2.2rem minmax(0, 1fr) 1.9rem; }
  .mail-selecting .mail-row .mail-check,
  .mail-row.selected .mail-check { display: grid; opacity: 1; pointer-events: auto; }
  .mail-row .mail-actions { display: none !important; }
}
@media (hover: hover) and (min-width: 961px) {
  .mail-row:hover .mail-check { opacity: 1; pointer-events: auto; }
  .mail-row:hover .mail-actions { display: inline-flex; }
  .mail-row:hover .when { display: none; }
}
.att-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }
.att-chip {
  display: inline-flex; align-items: center; gap: 0.3rem; max-width: 100%;
  padding: 0.18rem 0.45rem 0.18rem 0.3rem; border: 1px solid var(--nm-line); border-radius: 999px;
  background: var(--nm-paper); font-size: 0.72rem; color: var(--nm-ink); min-width: 0;
}
.att-chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-chip .kind {
  flex: none; padding: 0.02rem 0.24rem; border-radius: 4px; font-size: 0.6rem; font-weight: 800;
  letter-spacing: 0.02em; color: #fff; background: #64748b;
}
.att-chip .kind.pdf { background: #dc2626; }
.att-chip .kind.doc { background: #2563eb; }
.att-chip .kind.xls { background: #15803d; }
.att-chip .kind.img { background: #7c3aed; }
.att-chip .kind.zip { background: #b45309; }
.read-atts {
  margin: 0.65rem 0 0.85rem; padding: 0.7rem 0.8rem; border: 1px solid var(--nm-line);
  border-radius: 12px; background: var(--nm-paper-2);
}
.read-atts-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  margin-bottom: 0.5rem; font-size: 0.78rem; font-weight: 700; color: var(--nm-ink);
}
.read-atts-list { display: flex; flex-direction: column; gap: 0.4rem; }
.read-att {
  display: flex; align-items: center; gap: 0.45rem; min-width: 0;
}
.read-att .att-chip { flex: 1; min-width: 0; }
.read-att-actions { display: inline-flex; gap: 0.25rem; flex: none; }
.read-att-actions button {
  border: 1px solid var(--nm-line); background: var(--nm-paper); border-radius: 8px;
  padding: 0.28rem 0.45rem; cursor: pointer; color: var(--nm-ink);
  display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.72rem;
}
.read-att-actions button:hover { background: var(--nm-primary-soft); }
.star-btn {
  border: 0; background: transparent; cursor: pointer; color: var(--nm-faint); padding: 0.2rem;
  display: grid; place-items: center; border-radius: 8px; align-self: center;
}
.star-btn:hover { color: #94a3b8; background: rgba(15, 23, 42, 0.05); }
.star-btn.on { color: #f59e0b; }
.star-btn.on .icon { fill: currentColor; }
.att-preview {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column;
  background: var(--nm-bg);
}
.att-preview-head {
  display: flex; align-items: center; gap: 0.6rem; flex: none;
  padding: calc(0.55rem + var(--nm-safe-top, 0px)) 0.75rem 0.55rem;
  border-bottom: 1px solid var(--nm-line); background: var(--nm-paper);
}
.att-preview-head strong {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.9rem;
}
.att-preview-stage {
  flex: 1; min-height: 0; overflow: auto; background: var(--nm-bg);
  touch-action: none; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.att-preview-stage.is-zoomed { overflow: hidden; }
.att-zoom-tools {
  position: absolute;
  right: 0.85rem;
  bottom: calc(0.85rem + var(--nm-safe-bottom, 0px));
  z-index: 2;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.att-zoom-tools[hidden] { display: none !important; }
.att-zoom-btn {
  width: 2.65rem; height: 2.65rem; border: 0; border-radius: 999px;
  background: var(--nm-primary); color: #fff;
  font-size: 1.35rem; font-weight: 700; line-height: 1;
  box-shadow: 0 6px 16px rgba(var(--nm-primary-rgb), 0.38);
  cursor: pointer;
}
.att-zoom-btn:hover { filter: brightness(1.08); }
.att-preview-status {
  margin: 2.5rem 1.25rem; text-align: center; color: var(--nm-faint); font-size: 0.9rem;
}

/* In-viewer open feedback (mav-*). Not the standing .mail-dl-sheet / .file-pulse. */
.mav-opening {
  min-height: min(22rem, 70vh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.15rem; padding: 2.2rem 1.35rem; box-sizing: border-box;
  width: 100%; transform: translateZ(0);
}
.mav-opening-motion {
  position: relative; width: 5.6rem; height: 5.6rem;
  display: grid; place-items: center;
}
.mav-opening-ring {
  position: absolute; inset: 0;
  border: 3px solid color-mix(in srgb, var(--nm-primary) 28%, var(--nm-line));
  border-top-color: var(--nm-primary);
  border-radius: 50%;
  animation: mav-open-spin 0.8s linear infinite;
}
.mav-opening-doc {
  position: relative; width: 1.85rem; height: 2.35rem;
  border-radius: 3px 8px 3px 3px;
  background: var(--nm-paper);
  border: 2px solid var(--nm-primary);
  box-shadow: 5px 3px 0 color-mix(in srgb, var(--nm-primary) 22%, transparent);
  animation: mav-open-doc 1.15s ease-in-out infinite;
}
.mav-opening-fold {
  position: absolute; top: -2px; right: -2px;
  width: 0.7rem; height: 0.7rem;
  background: var(--nm-primary);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.mav-opening-caption {
  margin: 0; max-width: 18rem; text-align: center;
  color: var(--nm-ink); font-size: 1.08rem; font-weight: var(--nm-fw-ui);
  line-height: 1.35;
}
.mav-opening-bar {
  width: min(16rem, 72vw); height: 0.38rem; border-radius: 999px;
  overflow: hidden; background: var(--nm-line);
}
.mav-opening-bar > span {
  display: block; height: 100%; width: 34%; border-radius: inherit;
  background: var(--nm-primary);
  animation: mav-open-bar 1.05s ease-in-out infinite;
}
.mav-opening-bar.is-known > span { animation: none; }
.mav-opening.is-err .mav-opening-ring {
  animation: none; border-color: var(--nm-line); border-top-color: var(--nm-line);
}
.mav-opening.is-err .mav-opening-doc { animation: none; }
.mav-opening-retry { margin-top: 0.15rem; }
@keyframes mav-open-spin { to { transform: rotate(360deg); } }
@keyframes mav-open-doc {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-0.45rem) rotate(6deg); }
}
@keyframes mav-open-bar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
  .mav-opening-ring, .mav-opening-doc, .mav-opening-bar > span { animation: none !important; }
  .mav-opening-ring { border-color: var(--nm-primary); }
  .mav-opening-bar > span { width: 70%; }
}
.att-preview-image {
  display: block; max-width: 100%; height: auto; margin: 0 auto;
}
.att-preview-text {
  margin: 0; padding: 1rem 1.1rem; white-space: pre-wrap; word-break: break-word;
  font: 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--nm-ink);
}
.att-preview-pages {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px;
  transform-origin: 0 0;
}
.att-preview-pages canvas {
  display: block;
  background: white;
  object-fit: contain;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18);
}
.att-preview-head .att-preview-acts {
  display: flex; gap: 0.35rem; flex: none;
}
/* Standing download status — never a top toast under the Android status bar. */
.mail-dl-sheet {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(5.75rem + var(--nm-safe-bottom, env(safe-area-inset-bottom, 0px)));
  z-index: 92;
  pointer-events: none;
  transform: translateZ(0);
}
.app.is-reading ~ #mailAttachDlHost .mail-dl-sheet {
  bottom: calc(8.6rem + var(--nm-safe-bottom, env(safe-area-inset-bottom, 0px)));
}
.mail-dl-sheet.is-overlay,
.att-preview-dl {
  position: relative;
  left: auto; right: auto; bottom: auto;
  width: auto;
  margin: 0;
  padding: 0.65rem 0.75rem 0;
  z-index: 4;
  flex: none;
  pointer-events: auto;
}
.mail-dl-card {
  pointer-events: auto;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  background: var(--nm-paper);
  border: 1px solid var(--nm-line);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  animation: send-pop 0.42s cubic-bezier(0.34, 1.45, 0.5, 1);
}
.mail-dl-mark {
  flex: none;
  width: 2.1rem; height: 2.1rem;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--nm-primary-soft);
  color: var(--nm-primary);
}
.mail-dl-sheet[data-phase="ok"] .mail-dl-mark {
  background: var(--nm-ok-bg);
  color: var(--nm-ok-ink);
}
.mail-dl-sheet[data-phase="err"] .mail-dl-mark {
  background: var(--nm-err-bg);
  color: var(--nm-err-ink);
}
.mail-dl-copy { flex: 1; min-width: 0; }
.mail-dl-title {
  display: block;
  font-size: 0.88rem;
  font-weight: var(--nm-fw-ui);
  color: var(--nm-ink);
}
.mail-dl-name {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--nm-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.mail-dl-path {
  margin: 0.25rem 0 0;
  font-size: 0.76rem;
  color: var(--nm-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.mail-dl-bar {
  margin-top: 0.55rem;
  height: 4px;
  border-radius: 999px;
  background: var(--nm-line);
  overflow: hidden;
}
.mail-dl-bar > span {
  display: block; height: 100%; width: 32%; border-radius: inherit;
  background: var(--nm-primary);
  animation: send-bar 1.05s ease-in-out infinite;
}
.mail-dl-sheet[data-phase="opening"] .mail-dl-mark {
  background: var(--nm-primary-soft);
  color: var(--nm-primary);
}
.mail-dl-acts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex: none;
}
.mail-dl-acts .btn { white-space: nowrap; }
.mail-dl-acts .icon-btn {
  width: 1.8rem; height: 1.8rem; padding: 0;
  border: 0; background: transparent; color: var(--nm-faint);
  border-radius: 8px; cursor: pointer;
  display: grid; place-items: center;
}
.mail-dl-acts .icon-btn:hover { background: var(--nm-paper-2); color: var(--nm-ink); }
@media (prefers-reduced-motion: reduce) {
  .mail-dl-bar > span { animation: none; width: 100%; opacity: 0.7; }
  .mail-dl-card { animation: none; }
}
/* Filter the list down the way a chat app does — the counts show which
   filters would even return anything before they are tapped. */
.chips-row { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0 0 0.7rem; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; flex: none; cursor: pointer;
  padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--nm-line);
  background: var(--nm-paper); color: var(--nm-ink); font-size: 0.8rem; font-weight: 700;
}
.filter-chip .n { font-size: 0.72rem; font-weight: 800; color: var(--nm-muted); }
.filter-chip .pip { width: 7px; height: 7px; border-radius: 50%; }
.filter-chip.on { background: var(--nm-primary); border-color: var(--nm-primary); color: #fff; }
.filter-chip.on .n { color: rgba(255, 255, 255, 0.85); }
.read-head {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.35rem 1rem 1.05rem; border-bottom: 1px solid var(--nm-line);
}
.read-head-main {
  flex: 1; min-width: 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.55rem;
}
.read-head .subj {
  margin: 0; font-size: 1.4rem; font-weight: var(--nm-fw-ui);
  overflow-wrap: anywhere; word-break: break-word; line-height: 1.3;
}
.read-head .star-btn { flex: none; margin-top: 0.12rem; }
.read-folder-chip {
  flex: none; display: inline-flex; align-items: center;
  padding: 0.12rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--nm-line); background: var(--nm-paper-2);
  color: var(--nm-muted); font-size: 0.68rem; font-weight: 750;
  letter-spacing: 0.02em; white-space: nowrap;
}
/* Sender block vs body: avatar + bold From, muted To, air before the message. */
.read-party { margin: 0; }
.read-party-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.read-party-row > .avatar { width: 2.4rem; height: 2.4rem; font-size: 0.95rem; flex: none; }
.read-party-text { flex: 1; min-width: 0; }
.read-party-from {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.65rem;
  flex-wrap: wrap;
}
.read-party-name {
  font-size: 0.98rem; font-weight: 750; color: var(--nm-ink);
  overflow-wrap: anywhere; word-break: break-word;
}
.read-party-time {
  flex: none; font-size: 0.78rem; font-weight: 600; color: var(--nm-muted);
  white-space: nowrap;
}
.read-unsub {
  border: 0; background: transparent; padding: 0; margin: 0;
  cursor: pointer; font: inherit; font-size: 0.78rem; font-weight: 700;
  color: var(--nm-primary); white-space: nowrap;
}
.read-unsub:hover { color: var(--nm-primary-hover); }
.read-party-addr {
  display: block; margin-top: 0.35rem; font-size: 0.78rem; color: var(--nm-muted);
  overflow-wrap: anywhere; word-break: break-word;
}
.read-party-to {
  margin-top: 0.7rem; padding-top: 0.55rem; border-top: 1px solid var(--nm-line);
  font-size: 0.8rem; font-weight: 600; color: var(--nm-muted);
  line-height: 1.45; overflow-wrap: anywhere; word-break: break-word;
}
/* Meta left, blocked-image control right — no tall yellow banner. */
.read-meta-row {
  display: flex; align-items: flex-start; gap: 0.55rem; justify-content: space-between;
}
.read-meta-row .read-party { flex: 1; min-width: 0; }
.img-notice {
  flex: 0 0 auto; align-self: flex-start; margin: 0; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit;
}
.img-notice .btn {
  margin: 0; white-space: nowrap;
  background: var(--nm-warn-bg); border-color: var(--nm-warn-line); color: var(--nm-warn-ink);
}
.img-notice .btn:hover { background: var(--nm-warn-line); }
.read-actions {
  display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: stretch;
  padding: 0.95rem 1rem 1.1rem; border-top: 0;
}
.read-action-pill {
  flex: 1 1 6.2rem; min-width: 0; min-height: 2.55rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--nm-line); background: var(--nm-paper); color: var(--nm-ink);
  font: inherit; font-size: 0.88rem; font-weight: 650; line-height: 1.2;
}
.read-action-pill .icon { width: 1.1rem; height: 1.1rem; flex: none; stroke: currentColor; }
.read-action-pill:hover {
  background: var(--nm-paper-2); color: var(--nm-ink); border-color: var(--nm-muted);
}
.read-body,
.read-well,
.read-frame,
.thread-card {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.read-body {
  padding: 1.25rem 1rem 1.1rem; line-height: 1.65; font-size: 0.95rem;
  overflow-wrap: anywhere; color: var(--nm-ink);
}
.read-body.plain-pre { white-space: pre-wrap; }
/* Attribution vs body vs nested quote: clear break + vertical bar (Gmail). */
.read-body .nz-cite-attr {
  margin: 1.4rem 0 0.55rem; padding-top: 0.95rem;
  border-top: 1px solid var(--nm-line);
  font-size: 0.8rem; font-weight: 750; color: var(--nm-muted); letter-spacing: 0.01em;
  line-height: 1.4;
}
/* Twitter-like flow lines for nested quotes inside one body. */
.read-body blockquote, .read-body .nz-cite {
  margin: 0.35rem 0 0.85rem; padding: 0.35rem 0 0.35rem 1.05rem;
  border-left: 4px solid rgba(var(--nm-primary-rgb), 0.5); color: var(--nm-muted);
  line-height: 1.5; white-space: normal;
}
.read-body blockquote blockquote, .read-body .nz-cite .nz-cite {
  margin-left: 0.2rem; padding-left: 0.95rem;
  border-left-color: rgba(var(--nm-primary-rgb), 0.36);
}
.read-body blockquote blockquote blockquote, .read-body .nz-cite .nz-cite .nz-cite {
  border-left-color: rgba(var(--nm-primary-rgb), 0.24);
}
/* Outbound cite/sig carry Gmail-safe grey. Theme wins while they sit in this app. */
.read-body .nz-cite-attr,
.compose-editor .nz-cite-attr {
  color: var(--nm-muted) !important;
  border-top-color: var(--nm-line) !important;
}
.read-body blockquote, .read-body .nz-cite,
.compose-editor blockquote, .compose-editor .nz-cite {
  color: var(--nm-muted) !important;
  border-left-color: rgba(var(--nm-primary-rgb), 0.5) !important;
}
.read-body blockquote blockquote, .read-body .nz-cite .nz-cite,
.compose-editor blockquote blockquote, .compose-editor .nz-cite .nz-cite,
.compose-editor blockquote .nz-cite, .compose-editor .nz-cite blockquote {
  border-left-color: rgba(var(--nm-primary-rgb), 0.36) !important;
}
.read-body blockquote blockquote blockquote, .read-body .nz-cite .nz-cite .nz-cite,
.compose-editor blockquote blockquote blockquote, .compose-editor .nz-cite .nz-cite .nz-cite {
  border-left-color: rgba(var(--nm-primary-rgb), 0.24) !important;
}
.compose-editor .nz-sig { color: var(--nm-ink) !important; }
.compose-editor .nz-sig .nz-sig-sep { color: var(--nm-muted) !important; }
.read-body .plain-line { white-space: pre-wrap; }
.thread-flow {
  position: relative; margin: 0.35rem 0 0; padding: 0.15rem 0.75rem 0.85rem;
  max-width: 100%; display: flex; flex-direction: column;
  height: auto; flex: 0 0 auto; align-items: stretch;
}
/* Flush L/R so main / read-view / thread-flow / thread-card share one column edge.
   Do not merge the DOM — overlap the padded borders. Inbox list is untouched. */
.content.is-reading .thread-flow {
  margin: 0;
  padding-inline: 0;
  padding-top: 0;
}
.content.is-reading .thread-card {
  margin-inline: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  box-shadow: none;
}
.content.is-reading .thread-node.current .thread-card {
  border-color: var(--nm-line);
  box-shadow: none;
}
.thread-node {
  position: relative;
  margin: 0 0 0.55rem;
  max-width: 100%;
  box-sizing: border-box;
  height: auto; flex: 0 0 auto;
}
.thread-node:last-child { margin-bottom: 0; }
.thread-node.collapsed { cursor: pointer; }
.thread-card {
  min-width: 0;
  max-width: 100%;
  height: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 14px;
  border: 1px solid var(--nm-line);
  background: var(--nm-paper);
  padding: 0.7rem 0.8rem 0.75rem;
}
.thread-card .read-well,
.thread-card .read-frame,
.thread-card .read-body {
  max-width: 100%;
}
.thread-card .read-body { padding: 0.55rem 0 0.15rem; }
.thread-card .read-well { border-top: 0; }
.thread-node.current .thread-card {
  border-color: rgba(var(--nm-primary-rgb), 0.35);
  box-shadow: 0 0 0 1px rgba(var(--nm-primary-rgb), 0.12);
}
.thread-node.collapsed .thread-card {
  padding: 0.65rem 0.75rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.thread-node.collapsed .thread-card:hover {
  border-color: rgba(var(--nm-primary-rgb), 0.35);
}
.thread-collapsed-from {
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 0;
  font-size: 0.88rem; font-weight: 750; color: var(--nm-ink);
}
.thread-collapsed-from > .avatar {
  width: 1.85rem; height: 1.85rem; font-size: 0.72rem; flex: none;
}
.thread-collapsed-name {
  min-width: 0; flex: 1; overflow-wrap: anywhere; word-break: break-word;
}
.thread-collapsed-time { flex: none; font-size: 0.72rem; font-weight: 600; color: var(--nm-faint); }
.thread-collapsed-preview {
  margin: 0.28rem 0 0 2.35rem; font-size: 0.8rem; color: var(--nm-muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere; word-break: break-word;
}
.thread-group {
  display: flex; align-items: center; gap: 0.75rem; width: 100%;
  margin: 0.05rem 0 0.55rem; padding: 0; border: 0; background: transparent;
  cursor: pointer; font: inherit; color: var(--nm-muted);
}
.thread-group::before,
.thread-group::after {
  content: ''; flex: 1; height: 1px; background: var(--nm-line);
}
.thread-group-count {
  flex: none; min-width: 1.7rem; height: 1.7rem; padding: 0 0.45rem;
  border: 1px solid var(--nm-line); border-radius: 999px;
  display: grid; place-items: center;
  font-size: 0.78rem; font-weight: 750; color: var(--nm-muted);
  background: var(--nm-paper);
}
@media (max-width: 760px) {
  .thread-flow { padding: 0.1rem 0.35rem 0.7rem; }
  .thread-card { padding: 0.65rem 0.7rem 0.7rem; }
}
.thread-quoted-toggle {
  display: inline-block; margin: 0.55rem 0 0; padding: 0.2rem 0.45rem;
  border: 0; border-radius: 999px; background: var(--nm-paper-2);
  color: var(--nm-muted); font: inherit; font-size: 0.72rem; font-weight: 700;
  cursor: pointer;
}
.thread-quoted-toggle:hover { color: var(--nm-ink); }
.read-body-pending .read-preview { color: var(--nm-muted); margin-bottom: 0.75rem; }
.read-body-pending {
  font-size: calc(15px * var(--nm-type-scale, 1));
  line-height: 1.5;
  min-height: 3rem;
}
.read-body-pending .read-pending {
  margin: 0; font-size: 0.8rem; font-weight: 700; color: var(--nm-primary);
  animation: nm-pulse 1.1s ease-in-out infinite;
}
.read-skel { display: grid; gap: 0.7rem; padding-top: 0.35rem; animation: nm-pulse 1.1s ease-in-out infinite; }
.read-skel i { display: block; height: 0.7rem; border-radius: 4px; background: var(--nm-paper-2); }
@keyframes nm-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .read-body-pending .read-pending, .read-skel { animation: none; }
}
.read-frame {
  display: block; width: 100%; max-width: 100%; min-width: 0; border: 0;
  min-height: 0; height: 4.5rem; background: var(--nm-paper); color-scheme: inherit;
  overflow: hidden;
}
.read-well.is-fitting .read-frame { visibility: hidden; }
.read-well {
  margin: 0; background: var(--nm-paper); border-top: 1px solid var(--nm-line);
  overflow: hidden; max-width: 100%; min-width: 0; height: auto;
  border-radius: 0;
}
.read-zoom-host { position: relative; overflow: hidden; height: auto; touch-action: pan-x pan-y; }
/* Flex column: chrome flex-none, letter pane scrolls. One outer radius on the card. */
.card.read-view {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; height: 100%;
  overflow: hidden; padding: 0;
}
.read-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.read-zoom-host > .read-well,
.read-zoom-host > .read-body { transform-origin: 0 0; }
.read-zoom-hit { position: absolute; inset: 0; touch-action: none; pointer-events: none; }
@media (max-width: 760px) {
  .read-view { overflow: hidden; }
  .read-head { padding: 0.2rem 0.75rem 0.85rem; }
  .read-head .subj { font-size: 1.35rem; }
  .read-party-name { font-size: 0.92rem; }
  .read-party-to { font-size: 0.74rem; }
  .read-frame {
    height: 4.5rem;
    min-height: 0;
    max-height: none;
  }
  .read-body { padding: 1rem 0.75rem; font-size: 0.9rem; }
  .read-actions { padding: 0.85rem 0.75rem 1rem; gap: 0.5rem; }
  .read-action-pill { min-height: 2.55rem; font-size: 0.86rem; }
}
html[data-theme="dark"] .read-well {
  border-top-color: var(--nm-line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  padding: max(0.75rem, var(--nm-safe-top)) 0.75rem max(0.75rem, var(--nm-safe-bottom));
}
@media (min-width: 720px) {
  .modal-backdrop {
    align-items: center;
    padding: max(1.25rem, var(--nm-safe-top)) 1.25rem max(1.25rem, var(--nm-safe-bottom));
  }
}
.modal {
  background: var(--nm-paper); border-radius: 16px; width: min(620px, 100%);
  max-height: calc(100dvh - var(--nm-safe-top) - var(--nm-safe-bottom) - 2rem);
  overflow: auto; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}
/* Compose carries a formatting bar, so it gets more room than a form modal. */
.modal.compose {
  width: min(760px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(var(--nm-vv-height, 100dvh) - var(--nm-safe-top) - var(--nm-safe-bottom) - 2rem);
}
.modal.compose .modal-head,
.modal.compose .modal-foot { flex: none; }
.modal.compose .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.modal.compose .modal-foot {
  background: var(--nm-paper);
  z-index: 3;
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
}
@keyframes nm-nudge {
  0%, 100% { transform: none; }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.modal.nudge { animation: nm-nudge 0.17s ease-in-out 2; }
@media (prefers-reduced-motion: reduce) { .modal.nudge { animation: none; } }
.modal-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.9rem 1rem; border-bottom: 1px solid var(--nm-line); }
.modal-head h3 { margin: 0; font-size: 1rem; font-weight: var(--nm-fw-ui); flex: 1; }
.modal-body { padding: 1rem; }
.modal-note { margin: -0.35rem 0 0.85rem; font-size: 0.82rem; color: var(--nm-muted); }
/* Two-way choice inside a modal (keep the password vs change it). */
.seg { display: flex; gap: 0.25rem; background: var(--nm-paper-2); border: 1px solid var(--nm-line); border-radius: 10px; padding: 0.2rem; margin-bottom: 0.85rem; }
.seg button {
  flex: 1; min-width: 0; border: 0; background: transparent; cursor: pointer;
  padding: 0.45rem 0.5rem; border-radius: 8px; font-size: 0.8rem; font-weight: 700;
  color: var(--nm-muted); line-height: 1.25;
}
.seg button.on { background: var(--nm-paper); color: var(--nm-primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.modal-foot { display: flex; gap: 0.5rem; align-items: center; padding: 0.85rem 1rem; border-top: 1px solid var(--nm-line); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
.compose-line { display: flex; align-items: center; gap: 0.5rem; padding: 0.15rem 0 0.55rem; }
.compose-line label { font-size: 0.82rem; color: var(--nm-muted); font-weight: 600; width: 4rem; flex: none; }
.compose-line input { border: 1px solid var(--nm-line); border-radius: 9px; padding: 0.5rem 0.7rem; min-height: 2.4rem; flex: 1; min-width: 0; }
.compose-line.hidden { display: none; }
.compose-recip { position: relative; flex: 1; min-width: 0; display: flex; }
.compose-recip input { width: 100%; }
.compose-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 40;
  background: var(--nm-paper, #fff); border: 1px solid var(--nm-line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); max-height: 220px; overflow: auto;
  padding: 0.25rem;
}
.compose-suggest[hidden] { display: none !important; }
.compose-suggest button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px;
  padding: 0.55rem 0.65rem; cursor: pointer; color: inherit;
}
.compose-suggest button:hover,
.compose-suggest button[aria-selected="true"] { background: var(--nm-side-hover, rgba(16, 117, 235, 0.08)); }
.compose-suggest .sg-name { font-weight: 600; font-size: 0.9rem; }
.compose-suggest .sg-email { font-size: 0.78rem; color: var(--nm-muted); }
.modal.abandon { width: min(420px, 100%); }
.from-nudge {
  margin: -0.2rem 0 0.65rem 4.5rem; padding: 0.45rem 0.65rem; border-radius: 9px;
  background: var(--nm-warn-bg); border: 1px solid var(--nm-warn-line); color: var(--nm-warn-ink);
  font-size: 0.78rem; line-height: 1.4;
}
.recip-toggles { display: flex; gap: 0.1rem; flex: none; }
.recip-toggles button {
  border: 0; background: transparent; color: var(--nm-muted); cursor: pointer;
  font-weight: 700; font-size: 0.78rem; padding: 0.3rem 0.35rem; border-radius: 7px;
}
.recip-toggles button:hover { background: var(--nm-primary-soft); color: var(--nm-primary); }
.recip-toggles button.on { color: var(--nm-primary); background: var(--nm-primary-soft); }
.compose-body { border: 1px solid var(--nm-line); border-radius: 11px; overflow: visible; }
.compose-editor {
  min-height: 200px; max-height: 45vh; overflow: auto;
  /* Extra top air so the first line is not glued to the field edge. */
  padding: 1.15rem 0.95rem 0.9rem;
  font-size: 0.9rem; line-height: 1.6; outline: none;
  color: var(--nm-ink);
}
@media (max-width: 760px) {
  /* After the 45vh rule — an earlier phone override lost to this later block. */
  .compose-editor {
    max-height: none;
    min-height: 7.5rem;
  }
}
.compose-editor:empty::before { content: attr(data-placeholder); color: var(--nm-muted); }
.compose-editor img { max-width: 100%; height: auto; }
/* "Name <email> wrote:" — distinct from the reply the user is typing and
   from the quoted thread below it. */
.compose-editor .nz-cite-attr {
  margin: 1.35rem 0 0.55rem;
  padding: 0.9rem 0 0 0;
  border-top: 1px solid var(--nm-line);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.4;
  color: var(--nm-muted);
  letter-spacing: 0.01em;
}
.compose-editor .nz-cite-attr:first-child {
  margin-top: 0.35rem; padding-top: 0; border-top: 0;
}
/* Nested thread guides: vertical bar + indent so level 1 / 2 / 3 stay obvious. */
.compose-editor blockquote,
.compose-editor .nz-cite {
  position: relative;
  margin: 0.2rem 0 0.7rem;
  padding: 0.2rem 0 0.2rem 0.95rem;
  border-left: 3px solid rgba(var(--nm-primary-rgb), 0.42);
  color: var(--nm-muted);
  line-height: 1.5;
}
.compose-editor .nz-cite-attr + blockquote,
.compose-editor .nz-cite-attr + .nz-cite {
  margin-top: 0.15rem;
}
.compose-editor blockquote blockquote,
.compose-editor .nz-cite .nz-cite,
.compose-editor blockquote .nz-cite,
.compose-editor .nz-cite blockquote {
  margin-left: 0.2rem;
  padding-left: 0.8rem;
  border-left-color: rgba(var(--nm-primary-rgb), 0.28);
}
.compose-editor blockquote blockquote blockquote,
.compose-editor .nz-cite .nz-cite .nz-cite {
  border-left-color: rgba(var(--nm-primary-rgb), 0.2);
}
.compose-editor blockquote blockquote blockquote blockquote,
.compose-editor .nz-cite .nz-cite .nz-cite .nz-cite {
  border-left-color: rgba(var(--nm-primary-rgb), 0.14);
}
.compose-editor blockquote p,
.compose-editor .nz-cite p { margin: 0 0 0.5rem; }
.compose-editor blockquote table,
.compose-editor .nz-cite table { max-width: 100%; }
.compose-editor blockquote img,
.compose-editor .nz-cite img { max-width: 100%; height: auto; }
/* Reply quotes sit on Mail paper. Sender white cards / black ink would
   otherwise stay a light slab inside dark compose. The bar stays. */
.compose-editor .nz-cite,
.compose-editor .nz-cite :is(div,table,td,th,tr,tbody,thead,tfoot,p,span,font,center,li,ul,ol,h1,h2,h3,h4,h5,h6,pre,blockquote) {
  background: transparent !important;
  background-color: transparent !important;
  color: var(--nm-muted) !important;
}
.compose-editor .nz-cite a { color: var(--nm-primary) !important; }
/* Signature block: keep rich formatting visible and separate from the body. */
.compose-editor .nz-sig {
  margin: 0.85rem 0 0.35rem;
  color: var(--nm-ink);
  font-size: 0.9rem;
  line-height: 1.5;
}
.compose-editor .nz-sig .nz-sig-sep {
  color: var(--nm-muted);
  font-weight: 500;
  margin: 0 0 0.4rem;
  user-select: none;
}
.compose-editor .nz-sig .nz-sig-body { color: inherit; }
.compose-editor .nz-sig .nz-sig-body p { margin: 0 0 0.35rem; }
.compose-editor .nz-sig .nz-sig-body p:last-child { margin-bottom: 0; }
.compose-editor .nz-sig img {
  max-width: min(100%, 280px);
  height: auto;
  display: inline-block;
  vertical-align: middle;
}

/* Formatting bar sits under the body like Gmail's, and wraps on a phone. */
.rt-bar {
  display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center;
  padding: 0.35rem 0.4rem; border-top: 1px solid var(--nm-line); background: var(--nm-paper-2);
}
.rt-bar-lead {
  display: flex; align-items: center; gap: 0.3rem;
  flex: 1 0 100%; min-width: 0;
  flex-wrap: nowrap;
}
.rt-bar-lead .nz-select,
.rt-bar-lead select { flex: 1 1 0; min-width: 0; max-width: 6.35rem; }
.rt-bar .grp { display: flex; gap: 0.1rem; align-items: center; }
.rt-bar .sep { width: 1px; height: 1.3rem; background: var(--nm-line); margin: 0 0.2rem; }
.rt-bar button {
  border: 0; background: transparent; color: var(--nm-muted); cursor: pointer;
  padding: 0.32rem 0.4rem; border-radius: 7px; font-weight: 800; font-size: 0.82rem; min-width: 1.9rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.rt-bar button:hover { background: var(--nm-primary-soft); color: var(--nm-primary); }
.rt-bar button.on { background: var(--nm-primary-soft); color: var(--nm-primary); }
.rt-bar button.rt-dictate {
  margin-left: auto;
  position: relative;
  flex: 0 0 auto;
  gap: 0.4rem;
  min-width: 0;
  padding: 0.06rem 0.12rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--nm-ink);
  font-weight: 700;
  font-size: 0.78rem;
}
.rt-bar button.rt-dictate:hover {
  background: transparent;
  color: var(--nm-ink);
}
.rt-dictate-mic {
  position: relative;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
}
.rt-dictate-rings {
  position: absolute;
  inset: -0.22rem;
  pointer-events: none;
}
.rt-dictate-rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--nm-primary) 40%, transparent);
  opacity: 0.28;
}
.rt-dictate-rings span:last-child {
  inset: -0.18rem;
  opacity: 0.16;
}
.rt-dictate-orb {
  position: relative;
  z-index: 1;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.42), transparent 42%),
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--nm-primary) 72%, #fff) 0%,
      var(--nm-primary) 42%,
      color-mix(in srgb, var(--nm-primary) 55%, #000) 100%
    );
  box-shadow:
    0 4px 10px color-mix(in srgb, var(--nm-primary) 28%, transparent),
    0 0 0 3px color-mix(in srgb, var(--nm-primary) 12%, transparent);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.rt-bar button.rt-dictate:hover .rt-dictate-orb,
.rt-bar button.rt-dictate:focus-visible .rt-dictate-orb {
  transform: scale(1.06);
  box-shadow:
    0 6px 14px color-mix(in srgb, var(--nm-primary) 36%, transparent),
    0 0 0 4px color-mix(in srgb, var(--nm-primary) 16%, transparent);
}
.rt-dictate-orb .icon { width: 0.88rem; height: 0.88rem; }
.rt-dictate-sound {
  position: absolute;
  inset: auto 0.28rem 0.22rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  height: 0.38rem;
  opacity: 0;
}
.rt-dictate-sound i {
  display: block;
  width: 2px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  transform-origin: bottom center;
  transform: scaleY(0.4);
}
.rt-dictate-sound i:nth-child(2) { height: 4px; }
.rt-dictate-sound i:nth-child(3) { height: 6px; }
.rt-dictate-sound i:nth-child(4) { height: 4px; }
.rt-dictate-lbl { white-space: nowrap; }
.rt-bar select {
  min-height: 1.9rem; padding: 0.15rem 0.35rem; font-size: 0.78rem;
  border: 1px solid var(--nm-line); border-radius: 7px; background: var(--nm-paper); max-width: 7.5rem;
}
/* Colour tools: an "A" with a bar under it, the way Gmail names the colour
   without a native colour input that looks different on every phone. */
.rt-color { position: relative; display: inline-flex; }
.rt-color > button {
  flex-direction: column; gap: 0.05rem; padding: 0.22rem 0.38rem; min-width: 1.85rem;
  line-height: 1;
}
.rt-color .letter { font-weight: 800; font-size: 0.92rem; color: var(--nm-ink); line-height: 1; }
.rt-color .letter.hi {
  background: var(--nm-warn-bg); color: var(--nm-ink); padding: 0 0.18rem; border-radius: 3px;
}
.rt-color .swatch {
  display: block; width: 1.15rem; height: 0.28rem; border-radius: 999px; margin-top: 0.08rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
}
.rt-color.open > button { background: var(--nm-primary-soft); color: var(--nm-primary); }
.rt-colors { position: relative; }
.rt-colors.open .color-pop { display: block; }
.rt-colors.open .rt-color > button { background: var(--nm-primary-soft); color: var(--nm-primary); }
.color-pop {
  /* Anchored to #rtColors; JS clamps left/right so a near-edge toolbar
     button cannot shove the palette past the viewport. */
  position: absolute; z-index: 80; bottom: calc(100% + 0.45rem); left: 0; right: auto;
  box-sizing: border-box;
  width: max-content; max-width: min(28rem, calc(100vw - 1.25rem)); max-height: min(58vh, 22rem);
  overflow: auto; background: var(--nm-paper); border: 1px solid var(--nm-line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18); padding: 0.7rem 0.75rem 0.8rem;
  display: none;
}
.rt-color.open .color-pop { display: none; }
.color-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.color-pop-col { min-width: 0; }
.color-pop-lbl {
  margin: 0 0 0.4rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em;
  color: var(--nm-muted);
}
.color-row { display: grid; grid-template-columns: repeat(8, 1.15rem); gap: 0.18rem; margin-bottom: 0.28rem; }
/* Square chips — must beat .rt-bar button padding/min-width/radius, which
   otherwise stretch every swatch into a pill (the pop lives inside #rtBar). */
.color-pop .color-swatch,
.rt-bar .color-pop .color-swatch {
  box-sizing: border-box;
  width: 1.15rem; height: 1.15rem; min-width: 1.15rem; min-height: 1.15rem;
  padding: 0; margin: 0; border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  display: block; flex: none; cursor: pointer; position: relative;
  background: transparent; color: transparent; font-size: 0; line-height: 0;
}
.color-pop .color-swatch:hover,
.rt-bar .color-pop .color-swatch:hover {
  background: transparent; color: transparent;
  outline: 2px solid var(--nm-primary); outline-offset: 1px; z-index: 1;
}
.color-swatch.on::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 0.42rem; height: 0.7rem;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-0.08rem);
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55));
}
.color-swatch.light.on::after { border-color: #111827; filter: none; }
.color-pop .color-default,
.rt-bar .color-pop .color-default {
  display: flex; align-items: center; gap: 0.4rem; width: 100%; min-width: 0;
  cursor: pointer; margin: 0.45rem 0 0; padding: 0.35rem 0.45rem; border-radius: 8px;
  border: 1px dashed var(--nm-line); background: transparent; color: var(--nm-ink);
  font: inherit; font-size: 0.74rem; font-weight: 700; text-align: left;
}
.color-pop .color-default:hover, .color-pop .color-default.on,
.rt-bar .color-pop .color-default:hover, .rt-bar .color-pop .color-default.on {
  border-color: var(--nm-primary); background: var(--nm-primary-soft); color: var(--nm-primary);
}
.color-default .preview {
  width: 1rem; height: 1rem; border-radius: 3px; border: 1px solid var(--nm-line); flex: none;
  position: relative; overflow: hidden;
}
.color-default .preview.ink { background: var(--nm-ink); }
.color-default .preview.none {
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), #dc2626 0, #dc2626 calc(50% + 1px), transparent 0),
    var(--nm-paper);
}
#rtForeSwatch.is-theme { background: var(--nm-ink); }
/* Phone: stack Background / Text, denser squares, keep the whole pop on-screen. */
@media (max-width: 560px) {
  .color-pop {
    width: min(11.5rem, calc(100vw - 1.25rem));
    max-width: calc(100vw - 1.25rem);
    max-height: min(70vh, 26rem);
    padding: 0.5rem 0.55rem 0.55rem;
    border-radius: 12px;
  }
  .color-pop-grid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .color-pop-lbl { margin: 0 0 0.28rem; font-size: 0.68rem; }
  .color-row {
    grid-template-columns: repeat(8, 0.95rem);
    gap: 0.14rem;
    margin-bottom: 0.2rem;
  }
  .color-pop .color-swatch,
  .rt-bar .color-pop .color-swatch {
    width: 0.95rem; height: 0.95rem; min-width: 0.95rem; min-height: 0.95rem;
    border-radius: 2px;
  }
  .color-pop .color-default,
  .rt-bar .color-pop .color-default {
    margin-top: 0.3rem; padding: 0.28rem 0.35rem; font-size: 0.7rem; border-radius: 6px;
  }
}
/* Sending is a moment, not a toast that appears after the window is gone. */
.send-pulse {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(8, 16, 34, 0.55); backdrop-filter: blur(6px);
  animation: send-fade-in 0.22s ease;
}
/* File Download / Open — same pop as send, on document.body so WebView iframes
   cannot composite over a bottom sheet. Safe-area padding keeps it off the status bar. */
.file-pulse {
  position: fixed; inset: 0; z-index: 93;
  display: grid; place-items: center;
  padding: calc(0.75rem + var(--nm-safe-top, env(safe-area-inset-top, 0px))) 1rem
    calc(0.75rem + var(--nm-safe-bottom, env(safe-area-inset-bottom, 0px)));
  background: rgba(8, 16, 34, 0.32); backdrop-filter: blur(5px);
  animation: send-fade-in 0.22s ease;
  pointer-events: none;
  isolation: isolate;
  transform: translateZ(0);
}
.file-pulse .send-pulse-card { pointer-events: auto; }
.send-pulse-card {
  display: grid; justify-items: center; gap: 0.85rem; width: min(18rem, 86vw);
  padding: 1.6rem 1.4rem 1.4rem; border-radius: 22px; background: var(--nm-paper);
  box-shadow: 0 24px 60px rgba(8, 16, 34, 0.35); text-align: center;
  animation: send-pop 0.42s cubic-bezier(0.34, 1.45, 0.5, 1);
}
.send-pulse-card .plane {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--nm-primary-soft); color: var(--nm-primary);
  animation: send-wiggle 1.1s ease-in-out infinite;
}
.send-pulse-card.sent .plane {
  background: var(--nm-ok-bg); color: var(--nm-ok-ink); animation: send-done 0.45s ease forwards;
}
.send-pulse-card .plane .icon { width: 1.55rem; height: 1.55rem; }
.send-pulse-card h3 { margin: 0; font-size: 1.05rem; font-weight: var(--nm-fw-ui); color: var(--nm-ink); }
.send-pulse-card p { margin: 0; font-size: 0.84rem; color: var(--nm-muted); line-height: 1.45; }
.send-pulse-card .bar {
  width: 100%; height: 0.28rem; border-radius: 999px; overflow: hidden; background: var(--nm-line);
}
.send-pulse-card .bar > span {
  display: block; height: 100%; width: 30%; border-radius: inherit; background: var(--nm-primary);
  animation: send-bar 1.05s ease-in-out infinite;
}
.send-pulse-card.sent .bar > span {
  width: 100%; animation: none; background: var(--nm-ok-ink);
}
/* Voice-first compose: listening rail is part of .compose-body, not a bolted mic. */
.compose-body { position: relative; }
.compose-dictate-rail {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  padding: 0.55rem 0.7rem; border-top: 1px solid var(--nm-line);
  background: color-mix(in srgb, var(--nm-primary-soft) 70%, var(--nm-paper));
}
.compose-dictate-rail[hidden] { display: none !important; }
.compose-body.is-listening .compose-editor {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--nm-primary) 35%, transparent);
}
.compose-dictate-meter {
  width: 2.4rem; height: 2.4rem; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at center,
      var(--nm-primary) 0 calc(var(--level, 0) * 42%),
      transparent calc(var(--level, 0) * 42%)),
    var(--nm-primary-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--nm-primary) 25%, transparent);
  transition: background 80ms linear;
}
.compose-dictate-rail .cap {
  flex: 1; min-width: 8rem; margin: 0; font-size: 0.82rem; color: var(--nm-ink); line-height: 1.35;
}
.compose-dictate-rail .rail-actions { display: flex; gap: 0.35rem; flex: none; }
#dictateCompose.is-live .rt-dictate-orb {
  animation: nm-pulse 1.1s ease-in-out infinite;
}
#dictateCompose.is-live .rt-dictate-rings span {
  opacity: 0.55;
  animation: nm-dictate-ring 2.6s ease-out infinite;
}
#dictateCompose.is-live .rt-dictate-rings span:last-child {
  animation-delay: 0.85s;
  opacity: 0.35;
}
#dictateCompose.is-live .rt-dictate-sound { opacity: 0.95; }
#dictateCompose.is-live .rt-dictate-sound i {
  animation: nm-dictate-bars 0.55s ease-in-out infinite;
}
#dictateCompose.is-live .rt-dictate-sound i:nth-child(1) { animation-delay: 0s; }
#dictateCompose.is-live .rt-dictate-sound i:nth-child(2) { animation-delay: 0.12s; }
#dictateCompose.is-live .rt-dictate-sound i:nth-child(3) { animation-delay: 0.24s; }
#dictateCompose.is-live .rt-dictate-sound i:nth-child(4) { animation-delay: 0.16s; }
#dictateCompose.is-live .rt-dictate-sound i:nth-child(5) { animation-delay: 0.08s; }
#dictateCompose.is-busy { opacity: 0.65; }
@keyframes nm-dictate-ring {
  0% { transform: scale(0.92); opacity: 0.45; }
  100% { transform: scale(1.28); opacity: 0; }
}
@keyframes nm-dictate-bars {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}
@keyframes send-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes send-pop {
  from { transform: translateY(1.2rem) scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes send-wiggle {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-0.35rem) rotate(8deg); }
}
@keyframes send-done {
  0% { transform: scale(0.7) rotate(-12deg); }
  60% { transform: scale(1.12) rotate(4deg); }
  100% { transform: none; }
}
@keyframes send-bar {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}
@media (prefers-reduced-motion: reduce) {
  .send-pulse, .file-pulse, .send-pulse-card, .send-pulse-card .plane, .send-pulse-card .bar > span {
    animation: none !important;
  }
  #dictateCompose.is-live .rt-dictate-orb,
  #dictateCompose.is-live .rt-dictate-rings span,
  #dictateCompose.is-live .rt-dictate-sound i {
    animation: none;
  }
}

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%;
  background: var(--nm-paper-2); border: 1px solid var(--nm-line); border-radius: 999px;
  padding: 0.28rem 0.35rem 0.28rem 0.6rem; font-size: 0.78rem;
}
.chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 11rem; }
.chip .size { color: var(--nm-muted); flex: none; }
.chip button {
  border: 0; background: transparent; color: var(--nm-muted); cursor: pointer;
  line-height: 1; padding: 0.15rem 0.25rem; border-radius: 999px; font-size: 0.95rem;
}
.chip button:hover { background: var(--nm-err-bg); color: var(--nm-danger); }
.compose-alert {
  margin-top: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 9px; font-size: 0.8rem;
  background: var(--nm-err-bg); border: 1px solid var(--nm-err-line); color: var(--nm-err-ink);
}
.compose-alert.hidden { display: none; }
.compose-alert { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.compose-alert .btn { margin-left: auto; flex: none; }
.mail-alert-banner {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center;
  margin: 0.75rem 1rem 0; padding: 0.75rem 0.9rem;
  border: 1px solid var(--nm-line); border-radius: 12px;
  background: color-mix(in srgb, var(--nm-primary) 8%, var(--nm-paper));
}
.mail-alert-banner[hidden] { display: none !important; }
.mail-alert-banner .mail-alert-copy { flex: 1; min-width: 12rem; }
.mail-alert-banner .mail-alert-copy strong { display: block; font-size: 0.92rem; margin-bottom: 0.15rem; }
.mail-alert-banner .mail-alert-copy span { font-size: 0.82rem; color: var(--nm-muted); line-height: 1.35; }
.mail-alert-banner .mail-alert-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.mail-alert-banner.mail-notify-coach {
  border-color: var(--nm-primary); border-width: 2px;
  padding: 0.95rem 1.05rem; margin-top: 0.9rem;
  background: color-mix(in srgb, var(--nm-primary) 16%, var(--nm-paper));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--nm-primary) 18%, transparent);
}
.mail-alert-banner.mail-notify-coach .mail-alert-copy strong { font-size: 1.02rem; }
/* A picker that needs its label visible: "which address am I in?" is not
   something a screen-reader-only label can answer for a sighted user. */
.picker { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.picker label { font-size: 0.78rem; color: var(--nm-muted); font-weight: 700; white-space: nowrap; }
.picker .select { min-height: 2.2rem; padding-top: 0.35rem; padding-bottom: 0.35rem; font-size: 0.84rem; max-width: 15rem; }
.compose-line .select { flex: 1; min-width: 0; }

/* Signature popover, anchored to its button in the footer. */
.sig-wrap { position: relative; }
#dictateFoot.is-live { color: var(--nm-primary); border-color: var(--nm-primary-soft); }
#dictateFoot.is-busy { opacity: 0.65; }
.modal.sig-builder {
  width: min(780px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(var(--nm-vv-height, 100dvh) - var(--nm-safe-top) - var(--nm-safe-bottom) - 1.25rem);
}
.modal.sig-builder .modal-head { padding: 0.5rem 0.75rem; }
.modal.sig-builder .modal-head h3 { font-size: 0.92rem; }
.modal.sig-builder .sig-head-mail {
  font-weight: 600; color: var(--nm-muted); font-size: 0.78rem;
}
.modal.sig-builder .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.55rem 0.75rem 0.65rem;
  -webkit-overflow-scrolling: touch;
}
.modal.sig-builder .modal-foot {
  flex: none;
  padding: 0.5rem 0.75rem;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
}
.modal.sig-builder .field { margin-bottom: 0; gap: 0.16rem; }
.modal.sig-builder .field label { font-size: 0.7rem; }
.modal.sig-builder .field input,
.modal.sig-builder .field select,
.modal.sig-builder .field textarea {
  min-height: 2.05rem; padding: 0.32rem 0.5rem; border-radius: 8px; font-size: 0.82rem;
}
.modal.sig-builder .cap { margin: 0 0 0.35rem; font-size: 0.72rem; }
.sig-modes {
  display: flex; gap: 0.2rem; margin: 0 0 0.5rem;
  background: var(--nm-paper-2); border: 1px solid var(--nm-line);
  border-radius: 10px; padding: 0.18rem;
}
.sig-modes button {
  flex: 1 1 0; min-width: 0; border: 0;
  background: transparent; color: var(--nm-muted); border-radius: 8px;
  padding: 0.32rem 0.28rem; font-size: 0.7rem; font-weight: 700; cursor: pointer;
}
.sig-modes button.on {
  background: var(--nm-paper); color: var(--nm-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.sig-meta {
  display: flex; align-items: end; gap: 0.5rem; margin: 0 0 0.5rem;
}
.sig-meta .field { flex: 1; min-width: 0; }
.sig-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(15rem, 0.85fr);
  gap: 0.65rem;
  align-items: start;
}
.sig-editor { min-width: 0; }
.sig-preview {
  margin: 0; padding: 0.5rem 0.6rem; border: 1px solid var(--nm-line);
  border-radius: 10px; background: var(--nm-paper-2); min-height: 0;
  position: sticky; top: 0;
}
.sig-preview-label {
  font-size: 0.68rem; font-weight: 700; color: var(--nm-muted); margin: 0 0 0.35rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sig-preview .nz-sig-disclaimer {
  margin-top: 12px; max-width: 520px; font: 11px/1.45 Arial, Helvetica, sans-serif;
  color: var(--nm-faint);
}
.sig-templates { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.28rem; margin: 0 0 0.45rem; }
.sig-templates button {
  border: 1px solid var(--nm-line); background: var(--nm-paper); border-radius: 8px;
  padding: 0.28rem 0.2rem; font-size: 0.66rem; font-weight: 700; cursor: pointer; color: var(--nm-ink);
}
.sig-templates button.on { border-color: var(--nm-primary); color: var(--nm-primary); background: var(--nm-primary-soft); }
.sig-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.5rem; margin: 0 0 0.45rem;
}
.sig-fields .wide { grid-column: 1 / -1; }
.sig-colors {
  display: flex; flex-direction: column; gap: 0.55rem;
  margin: 0.1rem 0 0.5rem; padding: 0.65rem 0.7rem 0.7rem;
  border: 1px solid var(--nm-line); border-radius: 10px; background: var(--nm-paper-2);
}
.sig-colors-head .sig-colors-title {
  font-size: 0.74rem; font-weight: 700; color: var(--nm-heading);
}
.sig-colors-head .cap { margin: 0.12rem 0 0; }
.sig-swatch {
  display: grid; grid-template-columns: 2.15rem minmax(0, 1fr);
  gap: 0.55rem; align-items: center; margin: 0; padding: 0;
  border: 0; background: transparent;
}
.sig-swatch input[type="color"] {
  width: 2.15rem; height: 2.15rem; padding: 0; min-height: 0;
  border: 1px solid var(--nm-line); border-radius: 8px; cursor: pointer;
  background: transparent; flex: none;
}
.sig-swatch-copy { min-width: 0; }
.sig-swatch-copy label {
  display: block; font-size: 0.8rem; font-weight: 700; margin: 0; color: var(--nm-ink);
}
.sig-swatch-hint {
  margin: 0.08rem 0 0; font-size: 0.7rem; font-weight: 400;
  color: var(--nm-muted); line-height: 1.35;
}
.sig-logo-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.4rem; }
.sig-plain-editor {
  min-height: 5rem; padding: 0.5rem 0.65rem; border: 1px solid var(--nm-line);
  border-radius: 9px; background: var(--nm-paper);
}
#sigPlainBar { border: 1px solid var(--nm-line); border-bottom: 0; border-radius: 9px 9px 0 0; }
#sigPlainBar + .sig-plain-editor { border-radius: 0 0 9px 9px; }
.sig-rt-color {
  display: inline-flex; align-items: center; gap: 0.2rem;
  margin: 0; font-size: 0.66rem; font-weight: 700; color: var(--nm-muted);
}
.sig-rt-color input[type="color"] {
  width: 1.45rem; height: 1.45rem; padding: 0; min-height: 0; border-radius: 5px; cursor: pointer;
}
.sig-reuse { margin: 0.35rem 0 0; }
.sig-include {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.74rem; font-weight: 600; color: var(--nm-muted); cursor: pointer;
  white-space: nowrap; padding-bottom: 0.15rem;
}
.sig-include input { width: 0.95rem; height: 0.95rem; accent-color: var(--nm-primary); }
@media (max-width: 760px) {
  .sig-layout { grid-template-columns: 1fr; }
  .sig-preview { position: static; }
  .sig-templates { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sig-menu {
  position: absolute; bottom: calc(100% + 0.4rem); left: 0; z-index: 5; width: min(20rem, 78vw);
  background: var(--nm-paper); border: 1px solid var(--nm-line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18); padding: 0.4rem; max-height: 60vh; overflow: auto;
}
.sig-menu.hidden { display: none; }
.sig-menu h4 { margin: 0.2rem 0.35rem 0.4rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--nm-muted); }
.sig-row { display: flex; align-items: center; gap: 0.3rem; padding: 0.2rem; border-radius: 8px; }
.sig-row:hover { background: var(--nm-paper-2); }
.sig-row .pick {
  flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; cursor: pointer;
  font-size: 0.83rem; font-weight: 600; color: var(--nm-ink); padding: 0.35rem 0.4rem; border-radius: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sig-row .pick:hover { color: var(--nm-primary); }
.sig-row .star, .sig-row .del {
  border: 0; background: transparent; cursor: pointer; color: var(--nm-muted);
  padding: 0.3rem; border-radius: 7px; line-height: 1; display: inline-flex;
}
.sig-row .star.on { color: #d97706; }
.sig-row .del:hover { color: var(--nm-danger); background: var(--nm-err-bg); }
.sig-menu .foot { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.35rem 0.2rem 0.15rem; border-top: 1px solid var(--nm-line); margin-top: 0.3rem; }
.sig-menu .empty { padding: 0.4rem 0.45rem 0.6rem; font-size: 0.8rem; color: var(--nm-muted); }
.compose-foot-icons { display: flex; align-items: center; gap: 0.1rem; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 0.65rem; grid-template-columns: 1fr; }
.grid-2 .full { grid-column: 1 / -1; }
@media (min-width: 620px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
/* Create-mailbox address: local + @domain always share one row so nobody
   types the whole address into the first box. */
.mb-addr {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(7.25rem, 0.95fr);
  gap: 0.5rem; align-items: end;
}
.mb-addr .field { margin: 0; min-width: 0; }
.mb-addr .nz-select { width: 100%; max-width: none; }
.mb-addr .nz-select { width: 100%; max-width: none; }

/* ---------- Mobile shell: search pill, tab bar, folder dock ---------- */
/* Compact widths (≤960) get the footer + FAB. Two navigation systems for one
   app is what makes people hunt, so below the breakpoint the rail is a drawer
   and the tab bar owns navigation: Mail, Services, Accounts and everything else. */
.mobile-search { display: none; flex: 1; min-width: 0; }
.mobile-search button {
  display: flex; align-items: center; gap: 0.55rem; width: 100%; cursor: pointer;
  padding: 0.55rem 0.85rem; border-radius: 999px; border: 1px solid var(--nm-line);
  background: var(--nm-paper-2); color: var(--nm-muted); font: inherit; font-size: 0.88rem; text-align: left;
}
.mobile-search button .icon { flex: none; }
.mobile-search button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtabs {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  align-items: flex-end; justify-content: space-around;
  background: var(--nm-paper);
  border-top: 1px solid var(--nm-line);
  padding: 0.25rem 0.15rem calc(0.3rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
}
.mtab {
  position: relative; display: grid; justify-items: center; gap: 0.1rem; padding: 0.2rem 0.05rem;
  border: 0; background: transparent; cursor: pointer; color: var(--nm-muted);
  font-size: 0.64rem; font-weight: 700; min-height: 48px; align-content: center;
  flex: 1 1 0; min-width: 0; overflow: visible;
}
/* Badge chips sit on .ic; overflow must stay visible so corner labels aren't clipped. */
.mtab .ic { position: relative; display: grid; place-items: center; padding: 0.2rem 0.7rem; border-radius: 999px; overflow: visible; }
.mtab.active { color: var(--nm-primary); }
.mtab.active .ic { background: var(--nm-primary-soft); }
/* Tab icons keep their own hue (same map as the rail); active softens that hue. */
.mtab[data-mtab="dashboard"] .icon { color: #22b378; }
.mtab[data-mtab="services"] .icon { color: #0e7490; }
.mtab[data-mtab="accounts"] .icon { color: #7c3aed; }
.mtab[data-mtab="more"] .icon { color: #f7525a; }
.mtab.active[data-mtab="dashboard"] { color: #22b378; }
.mtab.active[data-mtab="dashboard"] .ic { background: rgba(34, 179, 120, 0.14); }
.mtab.active[data-mtab="services"] { color: #0e7490; }
.mtab.active[data-mtab="services"] .ic { background: rgba(14, 116, 144, 0.14); }
.mtab.active[data-mtab="accounts"] { color: #7c3aed; }
.mtab.active[data-mtab="accounts"] .ic { background: rgba(124, 58, 237, 0.14); }
.mtab.active[data-mtab="more"] { color: #f7525a; }
.mtab.active[data-mtab="more"] .ic { background: rgba(247, 82, 90, 0.14); }
html[data-theme="dark"] .mtab[data-mtab="dashboard"] .icon, html.dark .mtab[data-mtab="dashboard"] .icon { color: #2ee89a; }
html[data-theme="dark"] .mtab[data-mtab="services"] .icon, html.dark .mtab[data-mtab="services"] .icon { color: #22d3ee; }
html[data-theme="dark"] .mtab[data-mtab="accounts"] .icon, html.dark .mtab[data-mtab="accounts"] .icon { color: #a78bfa; }
html[data-theme="dark"] .mtab[data-mtab="more"] .icon, html.dark .mtab[data-mtab="more"] .icon { color: #ff6b72; }
html[data-theme="dark"] .mtab.active[data-mtab="dashboard"], html.dark .mtab.active[data-mtab="dashboard"] { color: #2ee89a; }
html[data-theme="dark"] .mtab.active[data-mtab="services"], html.dark .mtab.active[data-mtab="services"] { color: #22d3ee; }
html[data-theme="dark"] .mtab.active[data-mtab="accounts"], html.dark .mtab.active[data-mtab="accounts"] { color: #a78bfa; }
html[data-theme="dark"] .mtab.active[data-mtab="more"], html.dark .mtab.active[data-mtab="more"] { color: #ff6b72; }
.mtab .badge-dot {
  position: absolute; top: -0.15rem; right: 0.2rem; min-width: 1.05rem; padding: 0 0.2rem;
  border-radius: 999px; background: var(--nm-danger); color: #fff; font-size: 0.62rem; font-weight: 800;
  line-height: 1.05rem; text-align: center; z-index: 1; white-space: nowrap; pointer-events: none;
}
/* Text create chips are wider than unread counts: pin the same top-right
   corner of .ic, then translate outward so the pill clears the glyph. */
.mtab .badge-dot.create {
  top: 0; right: 0; min-width: 0; padding: 0 0.28rem;
  background: #7c3aed; font-size: 0.52rem; letter-spacing: 0.02em;
  line-height: 0.95rem; box-shadow: 0 0 0 2px var(--nm-paper);
  transform: translate(48%, -58%);
}
html[data-theme="dark"] .mtab .badge-dot.create,
html.dark .mtab .badge-dot.create { background: #a78bfa; color: #1a1030; }
/* Center Mail tab lifts out of the bar like a phone dock app. */
.mtab.center {
  margin-top: -1.15rem; z-index: 1;
}
.mtab.center .ic {
  width: 3.35rem; height: 3.35rem; padding: 0; border-radius: 50%;
  background: var(--nm-primary); color: #fff;
  box-shadow: 0 8px 18px rgba(var(--nm-primary-rgb), 0.38);
}
.mtab.center .ic .icon { width: 1.35rem; height: 1.35rem; stroke: #fff; }
.mtab.center .lbl { font-weight: 800; color: var(--nm-primary); }
.mtab.center.active .ic { background: var(--nm-primary-hover); }
.mtab.center .ic { overflow: visible; }
.mtab.center .badge-dot {
  top: 0; right: 0; min-width: 1.15rem;
  transform: translate(30%, -30%);
  box-shadow: 0 0 0 2px var(--nm-paper);
  z-index: 2;
}
/* Tapping Mail while it is already the open tab lifts the folders out of it,
   the way clicking a running app in the dock reveals its windows. */
.dock-fan {
  display: none; position: fixed; left: 0.5rem; z-index: 46;
  bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
  /* Two columns so six folders fit without covering half the list. */
  grid-template-columns: 1fr 1fr; gap: 0.28rem;
  width: min(19.5rem, calc(100vw - 1rem));
  padding: 0.5rem;
  border: 1px solid var(--nm-line); border-radius: 16px;
  background: var(--nm-paper); color: var(--nm-ink);
  box-shadow: 0 18px 40px rgba(8, 16, 34, 0.45);
  isolation: isolate; transform: translateZ(0);
}
.dock-fan.open { display: grid; }
.dock-fan-item {
  display: flex; align-items: center; gap: 0.4rem; width: 100%; min-width: 0; cursor: pointer;
  padding: 0.42rem 0.55rem; border-radius: 10px; border: 1px solid var(--nm-line);
  background: var(--nm-paper-2); color: var(--nm-ink); font: inherit; font-size: 0.74rem; font-weight: 700;
  box-shadow: none;
  transform: translateY(0.75rem) scale(0.94); opacity: 1;
  transition: transform 0.22s cubic-bezier(0.34, 1.45, 0.5, 1);
  transition-delay: calc(var(--i, 0) * 24ms);
}
.dock-fan.open .dock-fan-item { transform: none; opacity: 1; }
.dock-fan-item.on { border-color: var(--nm-primary); color: var(--nm-primary); }
/* Long addresses stay readable across the full fan width. */
.dock-fan-item[data-kind="mailbox"],
.dock-fan-item[data-kind="accounts"] { grid-column: 1 / -1; }
/* Same folder hues as the rail — icon only, so the active label can stay brand blue. */
.dock-fan-item[data-kind="inbox"] .icon { color: #1075eb; }
.dock-fan-item[data-kind="send"] .icon { color: #22b378; }
.dock-fan-item[data-kind="draft"] .icon { color: #dc9d28; }
.dock-fan-item[data-kind="archive"] .icon { color: #7c3aed; }
.dock-fan-item[data-kind="spam"] .icon { color: #f7525a; }
.dock-fan-item[data-kind="trash"] .icon { color: #b45309; }
.dock-fan-item[data-kind="folder"] .icon { color: #0e7490; }
.dock-fan-item[data-kind="mailbox"] .icon { color: #7c3aed; }
.dock-fan-item[data-kind="accounts"] .icon { color: #7c3aed; }
html[data-theme="dark"] .dock-fan-item[data-kind="inbox"] .icon, html.dark .dock-fan-item[data-kind="inbox"] .icon { color: #3b8ff5; }
html[data-theme="dark"] .dock-fan-item[data-kind="send"] .icon, html.dark .dock-fan-item[data-kind="send"] .icon { color: #2ee89a; }
html[data-theme="dark"] .dock-fan-item[data-kind="draft"] .icon, html.dark .dock-fan-item[data-kind="draft"] .icon { color: #f0b542; }
html[data-theme="dark"] .dock-fan-item[data-kind="archive"] .icon, html.dark .dock-fan-item[data-kind="archive"] .icon,
html[data-theme="dark"] .dock-fan-item[data-kind="mailbox"] .icon, html.dark .dock-fan-item[data-kind="mailbox"] .icon,
html[data-theme="dark"] .dock-fan-item[data-kind="accounts"] .icon, html.dark .dock-fan-item[data-kind="accounts"] .icon { color: #a78bfa; }
html[data-theme="dark"] .dock-fan-item[data-kind="spam"] .icon, html.dark .dock-fan-item[data-kind="spam"] .icon { color: #ff6b72; }
html[data-theme="dark"] .dock-fan-item[data-kind="trash"] .icon, html.dark .dock-fan-item[data-kind="trash"] .icon { color: #f59e0b; }
html[data-theme="dark"] .dock-fan-item[data-kind="folder"] .icon, html.dark .dock-fan-item[data-kind="folder"] .icon { color: #22d3ee; }
.dock-fan-item .label {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.dock-fan-item .n {
  flex: none; padding: 0.02rem 0.32rem; border-radius: 999px;
  background: var(--nm-primary); color: #fff; font-size: 0.62rem; font-weight: 800;
}
.dock-fan-item .icon { width: 0.95rem; height: 0.95rem; flex: none; }
.dock-fan-sep {
  grid-column: 1 / -1;
  padding: 0.3rem 0.15rem 0.05rem; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--nm-muted);
}
@media (prefers-reduced-motion: reduce) {
  .dock-fan-item { transition: none; transform: none; opacity: 1; }
}
.fab {
  display: none; position: fixed; right: 0.9rem; z-index: 44;
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  align-items: center; gap: 0.45rem; padding: 0.85rem 1.15rem; border: 0; border-radius: 999px;
  background: var(--nm-primary); color: #fff; font: inherit; font-size: 0.88rem; font-weight: 800;
  white-space: nowrap;
  cursor: pointer; box-shadow: 0 10px 24px rgba(var(--nm-primary-rgb), 0.35);
}
.fab-dock {
  display: none; position: fixed; right: 0.9rem; z-index: 44;
  bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  flex-direction: column-reverse; align-items: flex-end; gap: 0.5rem;
}
.fab-dock .fab {
  position: static; display: inline-flex;
}
/* Desktop/PC: Compose + Reply live on the FAB too — not only ≤960 chrome.
   Sit above the bottom edge (no tab bar). List-header Compose hides so there
   is one primary compose control. */
@media (min-width: 961px) {
  .fab-dock {
    display: flex;
    bottom: 1.5rem;
    right: 1.5rem;
  }
  .app.is-reading ~ .fab-dock,
  .fab-dock.is-reading {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    width: auto;
    max-width: min(32rem, calc(100vw - 3rem));
  }
  .fab { display: inline-flex; }
  .mail-head #composeBtn { display: none; }
  .mail-dl-sheet:not(.is-overlay) {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    width: min(26rem, calc(100vw - 3rem));
  }
}
.fab.secondary {
  background: var(--nm-paper); color: var(--nm-primary);
  border: 1px solid var(--nm-line);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}
.fab-dock.is-reading {
  left: 0.9rem; right: 0.9rem;
  flex-direction: row; justify-content: center; align-items: stretch; gap: 0.55rem;
  flex-wrap: nowrap;
}
.fab-dock.is-reading .fab {
  flex: 0 0 auto; justify-content: center;
  min-height: 2.55rem; padding: 0.55rem 1.2rem; font-size: 0.86rem; font-weight: 800; gap: 0.4rem;
  white-space: nowrap;
}
.fab-dock.is-reading .fab .icon { width: 1.1rem; height: 1.1rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.sheet-tile {
  display: grid; justify-items: center; gap: 0.35rem; padding: 0.8rem 0.35rem; cursor: pointer;
  border: 1px solid var(--nm-line); border-radius: 14px; background: var(--nm-paper);
  color: var(--nm-ink); font: inherit; font-size: 0.74rem; font-weight: 700; text-align: center;
}
.sheet-tile.on { border-color: var(--nm-primary); background: var(--nm-primary-soft); color: var(--nm-primary); }
.sheet-tile .icon-tile { width: 2.3rem; height: 2.3rem; }
.sheet-lbl {
  margin: 0.9rem 0 0.45rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--nm-muted);
}
.sheet-lbl:first-child { margin-top: 0; }
.sheet-row {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; cursor: pointer;
  padding: 0.7rem 0.75rem; border: 1px solid var(--nm-line); border-radius: 12px;
  background: var(--nm-paper); color: var(--nm-ink); font: inherit; font-size: 0.87rem; font-weight: 700;
  margin-bottom: 0.4rem;
}
.sheet-row .label { flex: 1; min-width: 0; text-align: left; }
.sheet-row.danger { color: var(--nm-err-ink); border-color: var(--nm-err-line); }
/* Account / settings rows: icon colour follows the current state. */
.sheet-row[data-kind="lang-en"] .icon,
.tile-row[data-kind="lang-en"] .icon-tile { color: #1075eb; }
.sheet-row[data-kind="lang-sw"] .icon,
.tile-row[data-kind="lang-sw"] .icon-tile { color: #0e7490; }
.sheet-row[data-kind="theme-light"] .icon,
.tile-row[data-kind="theme-light"] .icon-tile { color: #7c3aed; }
.sheet-row[data-kind="theme-dark"] .icon,
.tile-row[data-kind="theme-dark"] .icon-tile { color: #dc9d28; }
.sheet-row[data-kind="clientarea"] .icon,
.tile-row[data-kind="clientarea"] .icon-tile { color: #22b378; }
.sheet-row[data-kind="folder"] .icon { color: #0e7490; }
.tile-row[data-kind="lang-en"] .icon-tile { background: rgba(16, 117, 235, 0.12); }
.tile-row[data-kind="lang-sw"] .icon-tile { background: rgba(14, 116, 144, 0.12); }
.tile-row[data-kind="theme-light"] .icon-tile { background: rgba(124, 58, 237, 0.12); }
.tile-row[data-kind="theme-dark"] .icon-tile { background: rgba(220, 157, 40, 0.14); }
.tile-row[data-kind="clientarea"] .icon-tile { background: rgba(34, 179, 120, 0.12); }
html[data-theme="dark"] .sheet-row[data-kind="lang-en"] .icon,
html.dark .sheet-row[data-kind="lang-en"] .icon,
html[data-theme="dark"] .tile-row[data-kind="lang-en"] .icon-tile,
html.dark .tile-row[data-kind="lang-en"] .icon-tile { color: #3b8ff5; }
html[data-theme="dark"] .sheet-row[data-kind="lang-sw"] .icon,
html.dark .sheet-row[data-kind="lang-sw"] .icon,
html[data-theme="dark"] .tile-row[data-kind="lang-sw"] .icon-tile,
html.dark .tile-row[data-kind="lang-sw"] .icon-tile { color: #22d3ee; }
html[data-theme="dark"] .sheet-row[data-kind="theme-light"] .icon,
html.dark .sheet-row[data-kind="theme-light"] .icon,
html[data-theme="dark"] .tile-row[data-kind="theme-light"] .icon-tile,
html.dark .tile-row[data-kind="theme-light"] .icon-tile { color: #a78bfa; }
html[data-theme="dark"] .sheet-row[data-kind="theme-dark"] .icon,
html.dark .sheet-row[data-kind="theme-dark"] .icon,
html[data-theme="dark"] .tile-row[data-kind="theme-dark"] .icon-tile,
html.dark .tile-row[data-kind="theme-dark"] .icon-tile { color: #f0b542; }
html[data-theme="dark"] .sheet-row[data-kind="clientarea"] .icon,
html.dark .sheet-row[data-kind="clientarea"] .icon,
html[data-theme="dark"] .tile-row[data-kind="clientarea"] .icon-tile,
html.dark .tile-row[data-kind="clientarea"] .icon-tile { color: #2ee89a; }
html[data-theme="dark"] .sheet-row[data-kind="folder"] .icon,
html.dark .sheet-row[data-kind="folder"] .icon { color: #22d3ee; }
html[data-theme="dark"] .tile-row[data-kind="lang-en"] .icon-tile,
html.dark .tile-row[data-kind="lang-en"] .icon-tile { background: rgba(59, 143, 245, 0.18); }
html[data-theme="dark"] .tile-row[data-kind="lang-sw"] .icon-tile,
html.dark .tile-row[data-kind="lang-sw"] .icon-tile { background: rgba(34, 211, 238, 0.16); }
html[data-theme="dark"] .tile-row[data-kind="theme-light"] .icon-tile,
html.dark .tile-row[data-kind="theme-light"] .icon-tile { background: rgba(167, 139, 250, 0.18); }
html[data-theme="dark"] .tile-row[data-kind="theme-dark"] .icon-tile,
html.dark .tile-row[data-kind="theme-dark"] .icon-tile { background: rgba(240, 181, 66, 0.16); }
html[data-theme="dark"] .tile-row[data-kind="clientarea"] .icon-tile,
html.dark .tile-row[data-kind="clientarea"] .icon-tile { background: rgba(46, 232, 154, 0.14); }

/* ---------- Account switcher (Gmail-style) ---------- */
.modal.accounts-sheet { width: min(380px, 100%); padding: 0; overflow: hidden; }
.accounts-sheet .modal-head { border-bottom: 0; padding: 1rem 1rem 0.35rem; }
.accounts-sheet .as-hero {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.35rem 1.1rem 1rem; text-align: center;
}
.accounts-sheet .as-hero .avatar { width: 4rem; height: 4rem; font-size: 1.35rem; }
.accounts-sheet .as-hero .as-avatar-btn,
.accounts-sheet .as-row .as-avatar-btn {
  position: relative; display: inline-grid; place-items: center; padding: 0; border: 0;
  background: transparent; cursor: pointer; border-radius: 50%; flex: none;
}
.accounts-sheet .as-hero .as-avatar-btn .avatar { pointer-events: none; }
.accounts-sheet .as-avatar-btn .as-cam {
  position: absolute; right: -0.1rem; bottom: -0.1rem;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: var(--nm-primary); color: #fff; display: grid; place-items: center;
  border: 2px solid var(--nm-paper); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}
.accounts-sheet .as-avatar-btn .as-cam .icon { width: 0.75rem; height: 0.75rem; }
.accounts-sheet .as-row .as-avatar-btn .as-cam {
  width: 1.05rem; height: 1.05rem; right: -0.15rem; bottom: -0.15rem; border-width: 1.5px;
}
.accounts-sheet .as-row .as-avatar-btn .as-cam .icon { width: 0.6rem; height: 0.6rem; }
.accounts-sheet .as-hero strong { font-size: 1.05rem; font-weight: var(--nm-fw-ui); }
.accounts-sheet .as-hero span { font-size: 0.82rem; color: var(--nm-muted); word-break: break-all; }
.accounts-sheet .as-search { padding: 0 1rem 0.75rem; }
.accounts-sheet .as-list { border-top: 1px solid var(--nm-line); max-height: min(52vh, 360px); overflow-y: auto; }
.accounts-sheet .as-row {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.7rem 1rem; border: 0; border-bottom: 1px solid var(--nm-line);
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.accounts-sheet .as-row:hover { background: var(--nm-paper-2); }
.accounts-sheet .as-row.on { background: var(--nm-primary-soft); }
.accounts-sheet .as-row .grow { flex: 1; min-width: 0; }
.accounts-sheet .as-row .grow strong { display: block; font-size: 0.88rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accounts-sheet .as-row .grow span { display: block; font-size: 0.75rem; color: var(--nm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accounts-sheet .as-row .as-pin {
  border: 0; background: transparent; color: var(--nm-muted); cursor: pointer;
  padding: 0.25rem; display: grid; place-items: center; border-radius: 8px;
}
.accounts-sheet .as-row .as-pin.on { color: var(--nm-primary); }
.accounts-sheet .as-row .as-pin:hover { background: var(--nm-faint); color: var(--nm-primary); }
.accounts-sheet .as-row.off { opacity: 0.72; }
.accounts-sheet .as-section {
  padding: 0.55rem 1rem 0.2rem; font-size: 0.72rem; font-weight: 700;
  color: var(--nm-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.accounts-sheet .as-add {
  display: flex; align-items: center; gap: 0.7rem; width: 100%; text-align: left;
  padding: 0.85rem 1rem; border: 0; border-top: 1px solid var(--nm-line);
  background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer;
}
.accounts-sheet .as-add:hover { background: var(--nm-paper-2); }
.accounts-sheet .as-add .icon-tile { width: 2.1rem; height: 2.1rem; border-radius: 50%; }
.accounts-sheet .as-meta { font-size: 0.68rem; font-weight: 700; color: var(--nm-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.server-grid { display: grid; gap: 0.65rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .server-grid { grid-template-columns: 1fr; } }

/* ---------- Responsive shell ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 16, 34, 0.45); z-index: 40; }
/* Compact shell (phone + tablet ≤960): tab bar + FAB own primary actions.
   Wider than that keeps the permanent rail. Leaving 761–960 without the
   footer orphaned Reply / Compose / nav on drawer-only tablets. */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  /* Same slide-out drawer — display:none made the
     burger a no-op on Dashboard/Settings because nav-open had nowhere to go. */
  .side {
    display: flex;
    position: fixed; inset: 0 auto 0 0; width: 82vw; max-width: var(--nm-side-w);
    z-index: 50; transform: translateX(-102%); transition: transform 0.18s ease-out;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.28);
  }
  .app.nav-open .side { transform: translateX(0); }
  .burger { display: grid; }
  .mtabs { display: flex; }
  html:has(.modal.compose) .mtabs,
  html:has(.modal.sig-builder) .mtabs { display: none; }
  .fab-dock { display: flex; }
  .fab { display: inline-flex; }
  .mobile-search { display: flex; }
  .top-spacer, .desk-only { display: none; }
  .topbar { padding: calc(0.55rem + var(--nm-safe-top)) 0.7rem 0.55rem; gap: 0.5rem; }
  .topbar .who-chip .who { display: none; }
  .content { padding: 0.75rem 0.75rem calc(8.5rem + env(safe-area-inset-bottom, 0px)); }
  .app.is-reading .topbar { display: none; }
  .app.is-reading .content,
  .content.is-reading {
    display: flex; flex-direction: column;
    overflow: hidden; min-height: 0;
    padding: 0 0 calc(9.2rem + env(safe-area-inset-bottom, 0px));
  }
  .app.is-reading ~ .fab-dock {
    bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }
  .app.is-reading .read-view {
    border: 0; border-radius: 0; box-shadow: none;
    flex: 1 1 auto; min-height: 0; overflow: hidden;
  }
  .from-nudge { margin-left: 0; }
  .compose-line { flex-wrap: wrap; }
  .compose-line label { width: auto; min-width: 3.2rem; }
  .read-head { padding: 0.2rem 0.85rem 0.75rem; }
  .read-head .subj { font-size: 1.35rem; }
  .mail-bulk { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mail-head > h2, .page-head h2 { font-size: 1.15rem; }
  .card { border-radius: 14px; }
  .mail-row { padding: 0.7rem 0.7rem; }
  /* One search field and one compose control: the top bar owns search, the
     floating button owns compose. */
  .mail-search { display: none; }
  .mail-head #composeBtn { display: none; }
  /* Folder, address and refresh on one line. A title, a full-width picker and
     a lone button on three rows pushed the first message off the screen. */
  .mail-head { gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: nowrap; align-items: center; }
  .mail-head > h2 {
    flex: 1 1 auto; min-width: 0; font-size: 1.2rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mail-head .page-back { flex: none; }
  .mail-head .actions { width: auto; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; justify-content: flex-end; }
  .mail-head .picker { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  .mail-head .picker label { display: none; }
  .mail-head .picker .select {
    max-width: 11.5rem; padding: 0.35rem 1.7rem 0.35rem 0.6rem; font-size: 0.78rem;
    border-radius: 999px; background-position: right 0.5rem center;
  }
}
@media (max-width: 560px) {
  .page-head h2, .mail-head h2 { font-size: 1.15rem; }
  .topbar .who-chip .who { display: none; }
  .stat-grid { gap: 0.6rem; grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 0.75rem; gap: 0.2rem; }
  .stat-card .top { gap: 0.45rem; }
  .stat-card .icon-tile { width: 2rem; height: 2rem; border-radius: 9px; }
  .stat-card .label { font-size: 0.74rem; }
  .stat-card .value { font-size: 1.4rem; }
  .quick-tiles { gap: 0.6rem; }
  /* Filters stack instead of crushing the search field to a few characters. */
  .toolbar { flex-direction: column; align-items: stretch; }
  .card-head { flex-wrap: wrap; }
  .card-head .select { width: 100%; max-width: none; }
  .toolbar select, .toolbar .select { max-width: none; width: 100%; }
  .mail-head .actions { width: 100%; }
  .mail-head .actions .select { flex: 1; min-width: 0; }
  .mail-head .picker { flex: 1 1 100%; }
  .mail-head .picker .select { flex: 1; max-width: none; }
}

/* Native <select> paints its open list with OS chrome: sharp corners, system
   blue. CSS cannot reach it. /nzura-select.js (the platform fix auth.js
   injects on every SaaS page; Mail has no auth.js) swaps it for a rounded
   menu. It reads the platform tokens, so they are mapped to Mail's here and
   the wrapper takes the widths Mail gave the raw <select>. */
:root {
  --text-primary: var(--nm-ink); --text-muted: var(--nm-muted);
  --input-bg: var(--nm-paper); --panel-bg: var(--nm-paper); --overlay-bg: var(--nm-paper);
  --border: var(--nm-line); --border-hover: var(--nm-faint); --surface-muted: var(--nm-paper-2);
  --brand-primary: var(--nm-primary); --brand-primary-rgb: var(--nm-primary-rgb);
  --control-height: 2.35rem;
}
.nz-select-trigger { border-radius: 10px; }
.nz-select-menu { box-shadow: 0 14px 40px oklch(22% 0.012 260 / 0.16); }
.field .nz-select, .compose-line .nz-select { display: block; width: 100%; }
.compose-line .nz-select { flex: 1; min-width: 0; }
.picker .nz-select { max-width: 15rem; min-width: 0; }
.card-head .nz-select { max-width: 16rem; min-width: 0; }
.picker .nz-select-trigger, .card-head .nz-select-trigger { min-height: 2.2rem; padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: 0.84rem; }
.toolbar .nz-select { max-width: 180px; }
.rt-bar .nz-select { max-width: 7.5rem; }
.rt-bar .nz-select-trigger { min-height: 1.9rem; padding: 0.15rem 1.6rem 0.15rem 0.45rem; font-size: 0.78rem; border-radius: 7px; }
@media (max-width: 760px) {
  .mail-head .picker .nz-select { flex: 1 1 auto; max-width: 11.5rem; }
  .mail-head .picker .nz-select-trigger { border-radius: 999px; font-size: 0.78rem; min-height: 2.2rem; padding-right: 1.7rem; }
}
@media (max-width: 960px) {
  .card-head .nz-select { width: 100%; max-width: none; }
  .toolbar .nz-select, .accounts-page .toolbar .nz-select { max-width: none; width: 100%; }
  .mail-head .actions .nz-select { flex: 1; min-width: 0; }
  .mail-head .picker .nz-select { flex: 1; max-width: none; }
}
