/* ===== Meraki — Apple Mail (dark) + theme variants ===== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Geist', 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: #ececef;
  color: #1a1a1a;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button, .sb-item, .mitem, .mob-tb-btn, .mob-back, .mob-fab, .tb-btn, .tb-apply, .sb-apply, .sb-bookcall {
  touch-action: manipulation;
}

button { font-family: inherit; cursor: pointer; }

/* ============ THEME: APPLE MAIL (dark) ============ */
.theme-apple {
  --bg: #1c1c1e;
  --chrome: #2c2c2e;
  --chrome-2: #232325;
  --list-bg: #1c1c1e;
  --detail-bg: #1c1c1e;
  --selected: rgba(0, 217, 107, 0.14);
  --selected-bar: #00d96b;
  --accent: #00d96b;
  --accent-soft: rgba(0, 217, 107, 0.16);
  --text: #ededed;
  --text-2: #a0a0a4;
  --text-3: #6a6a6e;
  --border: rgba(255, 255, 255, 0.06);
  --border-2: rgba(255, 255, 255, 0.10);
  --hover: rgba(255, 255, 255, 0.04);
  --shadow: 0 30px 80px rgba(0,0,0,0.6), 0 2px 10px rgba(0,0,0,0.4);
  --radius: 12px;
  --font: 'Geist', 'SF Pro Text', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --traffic-r: #ff5f57; --traffic-y: #febc2e; --traffic-g: #28c840;
}

/* ============ THEME: APPLE MAIL (light) ============ */
.theme-light {
  --bg: #ffffff;
  --chrome: #f5f5f7;
  --chrome-2: #ebebed;
  --list-bg: #ffffff;
  --detail-bg: #ffffff;
  --selected: rgba(0, 160, 80, 0.10);
  --selected-bar: #00a050;
  --accent: #00a050;
  --accent-soft: rgba(0, 160, 80, 0.12);
  --text: #1a1a1a;
  --text-2: #5a5a60;
  --text-3: #9a9aa0;
  --border: rgba(0, 0, 0, 0.07);
  --border-2: rgba(0, 0, 0, 0.10);
  --hover: rgba(0, 0, 0, 0.04);
  --shadow: 0 30px 80px rgba(0,0,0,0.18), 0 2px 10px rgba(0,0,0,0.06);
  --radius: 12px;
  --font: 'Geist', 'SF Pro Text', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --traffic-r: #ff5f57; --traffic-y: #febc2e; --traffic-g: #28c840;
}
.theme-light .applycta button,
.theme-light .sb-apply,
.theme-light .compose-foot .send,
.theme-light .subform button { color: #ffffff; }
.theme-light .stage {
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(0,160,80,0.05), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(0,160,80,0.04), transparent 50%),
    #e8e8eb;
}

/* ============ THEME: SUPERHUMAN ============ */
.theme-superhuman {
  --bg: #0d0d12;
  --chrome: #14141b;
  --chrome-2: #0f0f15;
  --list-bg: #0d0d12;
  --detail-bg: #0a0a10;
  --selected: rgba(124, 92, 255, 0.16);
  --selected-bar: #7c5cff;
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.18);
  --text: #e6e6ec;
  --text-2: #8a8a9a;
  --text-3: #5a5a6a;
  --border: rgba(255, 255, 255, 0.05);
  --border-2: rgba(255, 255, 255, 0.10);
  --hover: rgba(255, 255, 255, 0.03);
  --shadow: 0 40px 100px rgba(0,0,0,0.7);
  --radius: 6px;
  --font: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --traffic-r: #ff5f57; --traffic-y: #febc2e; --traffic-g: #28c840;
}

/* ============ THEME: RETRO (early Mac Mail / OS X 10.4-ish) ============ */
.theme-retro {
  --bg: #ece9d8;
  --chrome: linear-gradient(#f4f1e3, #d9d4ba);
  --chrome-2: #e8e3cb;
  --list-bg: #f5f3e8;
  --detail-bg: #fffef9;
  --selected: #fff5b8;
  --selected-bar: #c08c00;
  --accent: #8b6b00;
  --accent-soft: #fff0a8;
  --text: #1a1810;
  --text-2: #6a6450;
  --text-3: #948c70;
  --border: #b8b09a;
  --border-2: #968d75;
  --hover: rgba(0,0,0,0.04);
  --shadow: 0 10px 30px rgba(0,0,0,0.25);
  --radius: 4px;
  --font: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --traffic-r: #ff5f57; --traffic-y: #febc2e; --traffic-g: #28c840;
}
.theme-retro body { background: #c4b89a; }

/* ============ APP SHELL ============ */
.stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  /* Default stage = soft light grey with faint green halos.
     Window feels embedded on a continuous surface instead of marooned in a dark void. */
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(0,160,80,0.06), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(0,160,80,0.05), transparent 50%),
    #ececef;
}
/* Dark stage only when explicitly in dark theme (toggled via sun/moon in titlebar).
   Selector uses `.stage.theme-apple` (no space) because the theme class lives on
   the .stage element itself — `.theme-apple .stage` wouldn't match. */
.stage.theme-apple {
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(0,217,107,0.06), transparent 60%),
    radial-gradient(900px 500px at 90% 100%, rgba(0,217,107,0.05), transparent 50%),
    #050505;
}
.theme-superhuman .stage {
  background:
    radial-gradient(1200px 600px at 50% 0%, rgba(124,92,255,0.08), transparent 60%),
    #03030a;
}
.theme-retro .stage {
  background:
    repeating-linear-gradient(45deg, #b3a78a 0 2px, #c4b89a 2px 4px);
}

.window {
  width: 100%; height: 100%;
  /* Caps raised so the window fills properly on large/4K monitors.
     On a MacBook viewport (<=~1440 wide) the `width: 100%` already wins,
     so nothing changes there visually. On a 2560+ monitor the window now
     grows to a substantial size instead of floating tiny in a black void. */
  max-width: 2000px; max-height: 1280px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid var(--border-2);
  color: var(--text);
  font-family: var(--font);
  position: relative;
}

/* ============ TITLE BAR ============ */
.titlebar {
  height: 44px;
  background: var(--chrome);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
  gap: 12px;
}
.theme-retro .titlebar { background: var(--chrome); border-bottom: 1px solid var(--border-2); }

.traffic { display: flex; gap: 8px; align-items: center; padding-left: 4px; }
.traffic .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--traffic-r);
  display: inline-block;
}
.traffic .dot:nth-child(2) { background: var(--traffic-y); }
.traffic .dot:nth-child(3) { background: var(--traffic-g); }

.tb-controls { display: flex; gap: 6px; align-items: center; margin-left: 24px; }
.tb-btn {
  width: 28px; height: 24px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn svg { width: 16px; height: 16px; }

/* Title bar apply button — looks like an Apple Mail "New Email" compose action */
.tb-apply {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent);
  color: #001e0a;
  border: none;
  border-radius: 7px;
  padding: 5px 11px 5px 9px;
  height: 28px;
  font-family: inherit;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s, transform 0.08s;
}
.theme-superhuman .tb-apply { color: #fff; }
.theme-light .tb-apply { color: #fff; }
.theme-retro .tb-apply {
  background: linear-gradient(#fce98c, #d8a800);
  color: #2a1f00;
  border: 1px solid #8b6b00;
  font-weight: 600;
}
.tb-apply:hover { filter: brightness(1.07); }
.tb-apply:active { transform: scale(0.97); }
.tb-apply svg { width: 13px; height: 13px; }

.tb-center {
  display: flex; align-items: center; justify-content: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-2);
  min-width: 0;
  overflow: hidden;
}
.tb-center .crumb {
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-center .crumb-name { color: var(--text); font-weight: 500; }
.tb-center .crumb-meta { font-variant-numeric: tabular-nums; }

.tb-search {
  display: flex; align-items: center;
  background: var(--chrome-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  height: 26px;
  gap: 8px;
  width: 180px;
  margin-left: auto;
}
.tb-search input {
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  width: 100%;
}
.tb-search input::placeholder { color: var(--text-3); }
.tb-search svg { width: 12px; height: 12px; color: var(--text-3); }

/* ============ THREE-PANE BODY ============ */
.body3 { flex: 1; display: grid; grid-template-columns: 240px 360px 1fr; min-height: 0; position: relative; }

/* ===== Sidebar ===== */
.sidebar {
  background: var(--chrome);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 8px 32px;
  font-size: 13px;
}
.sidebar h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
  margin: 18px 12px 4px;
}
.sidebar h4:first-child { margin-top: 6px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--accent-soft); color: var(--text); }
.sb-item .ico { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.sb-item.active .ico { color: var(--accent); }
.sb-item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item .count { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 11px; }
.sb-item.active .count { color: var(--accent); font-weight: 500; }

.sb-apply {
  margin: 20px 8px 8px;
  background: var(--accent);
  color: #001e0a;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-weight: 500;
  font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
  width: calc(100% - 16px);
  letter-spacing: -0.005em;
  transition: filter 0.12s;
}
.sb-apply svg { width: 14px; height: 14px; }
.theme-superhuman .sb-apply { color: #fff; }
.theme-retro .sb-apply {
  background: linear-gradient(#fce98c, #d8a800);
  color: #2a1f00;
  border: 1px solid #8b6b00;
  font-weight: 600;
}
.sb-apply:hover { filter: brightness(1.06); }

.sb-bookcall {
  margin: 0 8px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-weight: 500;
  font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
  width: calc(100% - 16px);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.sb-bookcall:hover {
  background: var(--hover);
  border-color: var(--text-3);
}
.sb-bookcall svg { width: 14px; height: 14px; color: var(--text-2); }

.sb-flag { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; opacity: 0.85; }

/* ===== Message list ===== */
.mlist {
  background: var(--list-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.mlist-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--list-bg);
  z-index: 2;
}
.mlist-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.mlist-head .meta {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.mlist-head .sort {
  font-size: 11.5px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 4px;
}

.mitem {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
}
.mitem:hover { background: var(--hover); }
.mitem.selected {
  background: var(--selected);
}
.mitem.selected::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--selected-bar); border-radius: 0 2px 2px 0;
}

.mitem .udot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  opacity: 0;
}
.mitem.unread .udot { opacity: 1; }

.mitem-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px;
}
.mitem .from {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mitem.unread .from { font-weight: 600; }
.mitem:not(.unread) .from { font-weight: 500; color: var(--text); }

.mitem .when {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.mitem.selected .when { color: var(--text-2); }

.mitem .subj {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.mitem .preview {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mitem .tags {
  display: flex; gap: 4px; margin-top: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.theme-retro .tag { background: #fff0a8; color: #6b5400; border: 1px solid #d8b800; }

/* ===== Detail (email body) ===== */
.detail {
  background: var(--detail-bg);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  position: relative;
}
.detail-head {
  padding: 22px 40px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--detail-bg);
  z-index: 2;
  backdrop-filter: blur(20px);
  background-color: color-mix(in srgb, var(--detail-bg) 85%, transparent);
}
.detail-head .actions {
  display: flex; gap: 4px; margin-bottom: 14px;
}
.detail-head .actions button {
  background: transparent; border: none; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  font-family: inherit;
}
.detail-head .actions button:hover { background: var(--hover); color: var(--text); }
.detail-head .actions svg { width: 14px; height: 14px; }
.detail-head .actions .sep { width: 1px; background: var(--border); margin: 4px 4px; }

.detail-meta {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: start;
}
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d96b, #007a3d);
  color: #001e0a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.theme-superhuman .avatar { background: linear-gradient(135deg, #7c5cff, #4a2eaa); color: #fff; }
.theme-retro .avatar { background: linear-gradient(135deg, #d8a800, #8b6b00); color: #fff; border: 1px solid #6b5400; }

.detail-meta .who { min-width: 0; }
.detail-meta .who .name {
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.detail-meta .who .name .verified {
  font-size: 10px;
  color: var(--accent);
  font-weight: 500;
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.detail-meta .who .addr {
  font-size: 11.5px; color: var(--text-3);
  margin-top: 2px;
  font-family: var(--mono);
}
.detail-meta .who .to {
  font-size: 11.5px; color: var(--text-2);
  margin-top: 4px;
}
.detail-meta .when {
  font-size: 11.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.detail-meta .when .full { display: block; margin-top: 2px; }

.detail-subject {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 16px 0 0;
  line-height: 1.2;
  color: var(--text);
}

/* Body */
.detail-body {
  padding: 32px 48px 80px;
  max-width: 760px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
}
.detail-body p { margin: 0 0 1.1em; }
.detail-body p.lede {
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 1.4em;
}
.detail-body h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--text-3);
  margin: 2.4em 0 0.9em;
}
.detail-body h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 1.6em 0 0.5em;
}
.detail-body strong { color: var(--text); font-weight: 600; }
.detail-body em { font-style: italic; }
.detail-body .serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
.detail-body ul { padding-left: 0; list-style: none; margin: 0 0 1.4em; }
.detail-body ul li {
  position: relative; padding-left: 22px; margin-bottom: 0.55em;
}
.detail-body ul li::before {
  content: ''; position: absolute; left: 0; top: 0.7em;
  width: 6px; height: 1px; background: var(--text-3);
}
.detail-body ol.plain-numbered {
  padding-left: 1.4em;
  margin: 0 0 1.4em;
  list-style: decimal;
}
.detail-body ol.plain-numbered li {
  padding-left: 4px;
  margin-bottom: 0.9em;
  line-height: 1.65;
}
.detail-body ol.plain-numbered li::marker {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.detail-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }
.detail-body hr { border: none; height: 1px; background: var(--border-2); margin: 2.4em 0; }

.signature {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2em;
  line-height: 1.5;
}
.signature .sig-name { color: var(--text); font-weight: 500; }

/* Pull quote */
.pull {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-style: italic;
  padding: 0.3em 0 0.6em;
  margin: 1.5em 0;
  border-left: 2px solid var(--accent);
  padding-left: 24px;
  color: var(--text);
}

/* Data card / stats */
.statgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  overflow: hidden;
  margin: 1.6em 0 2em;
}
.theme-retro .statgrid { background: var(--border-2); }
.statcell {
  background: var(--bg);
  padding: 18px 20px;
}
.theme-retro .statcell { background: var(--detail-bg); }
.statcell .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.statcell .num {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.statcell .num .unit { font-size: 16px; color: var(--text-2); font-weight: 400; margin-left: 2px; }
.statcell .delta {
  font-size: 11.5px;
  color: var(--accent);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Process steps */
.step {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--border-2);
}
.step:last-child { border-bottom: 1px solid var(--border-2); }
.step .n {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
}
.step h4 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 10px;
}
.step h4 .dur {
  font-size: 11px; color: var(--text-3); font-weight: 400;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.step p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }

/* Service / FAQ row */
.row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border-2);
}
.row:last-child { border-bottom: 1px solid var(--border-2); }
.row dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 500;
}
.row dd {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
}

/* Testimonials */
.tstmnl {
  padding: 22px 0;
  border-top: 1px solid var(--border-2);
}
.tstmnl:last-child { border-bottom: 1px solid var(--border-2); }
.tstmnl blockquote {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--text);
}
.tstmnl .who {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.tstmnl .who .av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--text);
  background: var(--chrome);
  border: 1px solid var(--border-2);
}
.tstmnl .who .name { color: var(--text); font-weight: 500; }
.tstmnl .who .role { color: var(--text-3); }

/* Sparkline / chart */
.chart {
  margin: 1.6em 0 2em;
  padding: 20px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: linear-gradient(180deg, transparent, rgba(0,217,107,0.03));
}
.theme-retro .chart { background: #fffef9; }
.chart .ch-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.chart .ch-title { font-size: 12px; color: var(--text-2); font-weight: 500; }
.chart .ch-meta { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; }
.bar { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.bar .col {
  width: 100%;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.85;
  min-height: 4px;
}
.bar .col.before { background: var(--text-3); opacity: 0.35; }
.bar .lbl { font-size: 10px; color: var(--text-3); font-family: var(--mono); }

/* Newsletter form */
.subform {
  display: flex; gap: 8px;
  margin: 1.6em 0;
  max-width: 480px;
}
.subform input {
  flex: 1; background: var(--chrome-2); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 12px 14px;
  color: var(--text); font-family: inherit; font-size: 14px;
  outline: none;
}
.subform input:focus { border-color: var(--accent); }
.subform button {
  background: var(--accent); color: #001e0a; border: none;
  padding: 0 18px; border-radius: 8px;
  font-family: inherit; font-weight: 500; font-size: 13.5px;
}
.theme-superhuman .subform button { color: #fff; }
.theme-retro .subform button {
  background: linear-gradient(#fce98c, #d8a800);
  border: 1px solid #8b6b00; color: #2a1f00; font-weight: 600;
}
.subform button:disabled, .lead-form button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inline form error message — used by newsletter + lead-magnet inline forms */
.form-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 8px;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.4;
}

/* Apply CTA */
.applycta {
  margin: 2em 0 1em;
  padding: 22px 24px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.theme-superhuman .applycta { background: rgba(124,92,255,0.10); }
.theme-retro .applycta { background: #fff0a8; border: 1px solid #d8b800; }
.applycta .lead {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.applycta .sub { font-size: 13px; color: var(--text-2); }
.applycta button {
  background: var(--accent); color: #001e0a; border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-family: inherit; font-weight: 500; font-size: 13.5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.theme-superhuman .applycta button { color: #fff; }
.theme-retro .applycta button {
  background: linear-gradient(#fce98c, #d8a800);
  border: 1px solid #8b6b00; color: #2a1f00;
}

/* FAQ */
.faqlist {
  margin: 1em 0;
}
.faq {
  border-top: 1px solid var(--border-2);
  padding: 16px 0;
  cursor: pointer;
  user-select: none;
}
.faq:last-child { border-bottom: 1px solid var(--border-2); }
.faq summary {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; color: var(--text-3); font-weight: 300; font-size: 18px;
  transition: transform 0.2s;
}
.faq[open] summary::after { transform: rotate(45deg); }
.faq .a {
  margin-top: 10px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.6;
}

/* ============ COMPOSE / APPLY MODAL ============ */
.compose-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 20;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 0 32px 0 0;
}
.compose {
  width: 580px;
  max-width: calc(100% - 64px);
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  border: 1px solid var(--border-2);
  border-bottom: none;
  display: flex; flex-direction: column;
  max-height: calc(100% - 56px);
  box-shadow: 0 -30px 80px rgba(0,0,0,0.5);
  animation: slideup 0.28s cubic-bezier(.2,.9,.3,1.0);
}
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }
.compose-tb {
  height: 36px;
  background: var(--chrome);
  border-radius: 12px 12px 0 0;
  display: flex; align-items: center; padding: 0 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.compose-tb .title { font-size: 12px; color: var(--text-2); margin-left: 8px; }
.compose-tb .x {
  margin-left: auto;
  background: var(--chrome-2);
  border: none;
  width: 22px; height: 22px;
  border-radius: 4px;
  color: var(--text-2);
}
.compose-tb .x:hover { background: var(--hover); color: var(--text); }

.compose-form { padding: 14px 18px 16px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.compose-field {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.compose-field label { font-size: 11.5px; color: var(--text-3); width: 56px; flex-shrink: 0; }
.compose-field input, .compose-field select, .compose-field textarea {
  flex: 1;
  background: transparent; border: none;
  color: var(--text);
  font-family: inherit; font-size: 13.5px;
  outline: none;
  padding: 4px 0;
}
.compose-field textarea { resize: none; min-height: 140px; line-height: 1.5; }
.compose-field .chip {
  background: var(--accent-soft); color: var(--accent);
  padding: 2px 8px; border-radius: 10px; font-size: 11.5px;
  font-weight: 500;
}
.compose-body {
  flex: 1; overflow: auto; padding: 14px 0 0; min-height: 0;
}
.compose-body textarea {
  width: 100%; height: 140px;
  background: transparent; border: none;
  color: var(--text);
  font-family: inherit; font-size: 14px; line-height: 1.55;
  outline: none;
  resize: none;
}
.compose-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 0; margin-top: 8px;
  border-top: 1px solid var(--border);
}
.compose-foot .send {
  background: var(--accent); color: #001e0a;
  border: none; border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit; font-weight: 500; font-size: 13px;
}
.theme-superhuman .compose-foot .send { color: #fff; }
.theme-retro .compose-foot .send {
  background: linear-gradient(#fce98c, #d8a800);
  border: 1px solid #8b6b00; color: #2a1f00;
}
.compose-foot .send:hover { filter: brightness(1.06); }
.compose-foot .send:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.compose-foot .hint { font-size: 11.5px; color: var(--text-3); margin-left: auto; }

.compose-error {
  margin: 4px 18px 0;
  padding: 10px 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 8px;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.4;
}

.compose-sent {
  padding: 40px 24px;
  text-align: center;
}
.compose-sent .ico {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.compose-sent h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.compose-sent p { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }

/* Toolbar at bottom */
.statusbar {
  height: 26px;
  background: var(--chrome-2);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 14px;
  font-size: 11px;
  color: var(--text-3);
  gap: 14px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  white-space: nowrap;
}
.statusbar .shortcut { display: inline-flex; align-items: center; gap: 4px; }
.statusbar .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.statusbar .grow { flex: 1; }
.statusbar kbd {
  background: var(--chrome);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 0 5px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-2);
}

/* Retro tweaks */
.theme-retro .titlebar { color: #1a1810; }
.theme-retro .tb-btn { color: #4a4030; }
.theme-retro .tb-btn:hover { background: rgba(0,0,0,0.06); color: #1a1810; }
.theme-retro .sidebar h4 { color: #6a6450; }
.theme-retro .mitem.selected { background: #fff5b8; color: #1a1810; }
.theme-retro .mitem .preview { color: #5a5440; }
.theme-retro .detail-meta .who .verified { background: #fff0a8; color: #6b5400; }
.theme-retro .avatar { color: #fff; }

/* Superhuman density */
.theme-superhuman .mitem { padding: 9px 16px 10px; }
.theme-superhuman .mitem .from { font-size: 13px; font-weight: 600; }
.theme-superhuman .mitem .subj { font-size: 12px; }
.theme-superhuman .mitem .preview { font-size: 11.5px; }
.theme-superhuman .titlebar { font-family: var(--mono); }
.theme-superhuman .detail-body { font-size: 14.5px; }

/* Scrollbar */
.sidebar::-webkit-scrollbar, .mlist::-webkit-scrollbar, .detail::-webkit-scrollbar,
.compose-body::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .mlist::-webkit-scrollbar-thumb,
.detail::-webkit-scrollbar-thumb, .compose-body::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 4px;
}
.sidebar::-webkit-scrollbar-track, .mlist::-webkit-scrollbar-track,
.detail::-webkit-scrollbar-track, .compose-body::-webkit-scrollbar-track {
  background: transparent;
}

/* Density compact */
.density-compact .mitem { padding: 8px 18px 9px; }
.density-compact .mitem .preview { -webkit-line-clamp: 1; }
.density-compact .detail-body { font-size: 14px; }

/* Forwarded message block (used in testimonial email) */
.fwd-divider {
  height: 1px;
  background: var(--border-2);
  margin: 2em 0 1.6em;
}
.fwd-begin {
  color: var(--text-2) !important;
  font-size: 14px !important;
  margin: 0 0 1em !important;
}
.fwd-headers {
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0 0 1.6em;
  color: var(--text);
}
.fwd-headers > div {
  display: flex;
  gap: 6px;
  margin-bottom: 1px;
}
.fwd-headers .fwd-k {
  color: var(--text-3);
  min-width: 56px;
}
.fwd-headers .fwd-v { color: var(--text); }
.fwd-headers .fwd-v strong { font-weight: 600; }
.redacted {
  display: inline-block;
  background: var(--text);
  color: transparent;
  border-radius: 2px;
  padding: 0 4px;
  margin: 0 1px;
  user-select: none;
  letter-spacing: -0.04em;
  vertical-align: baseline;
  line-height: 1;
  font-size: 0.85em;
  position: relative;
  top: -0.5px;
}
.fwd-quote {
  margin: 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--border-2);
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}
.theme-light .fwd-quote { border-left-color: #ccd0d8; }
.fwd-quote p { margin: 0 0 1em; }
.fwd-quote p:last-child { margin-bottom: 0; }

/* Welcome email kicker */
.welcome-kicker {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 500;
  color: var(--text-2);
  margin: 0 0 1.6em !important;
}

/* Meraki word/definition treatment */
.meraki-def {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0.4em 0 0.4em;
  flex-wrap: wrap;
}
.meraki-def .def-pron {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}
.meraki-def .def-meta {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-variant: small-caps;
  white-space: nowrap;
}
.detail-body .def-quote {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--text-2);
  margin: 0.2em 0 1.8em;
  max-width: 560px;
}

/* Service chips */
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0.5em 0 1.6em;
}
.chip-tag {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chrome);
  border: 1px solid var(--border-2);
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.theme-light .chip-tag { background: #f5f5f7; }
.theme-retro .chip-tag { background: #fff8d8; border-color: #d8b800; color: #4a3a00; }
.theme-superhuman .chip-tag { background: rgba(124,92,255,0.10); border-color: rgba(124,92,255,0.25); color: var(--text); }

/* ============ LEAD MAGNET ============ */
/* New email arrival animation in message list */
.mitem.just-arrived {
  animation: just-arrived-flash 1.6s ease-out 1;
  position: relative;
}
.mitem.just-arrived::after {
  content: '';
  position: absolute; inset: 0;
  border-left: 3px solid var(--accent);
  border-radius: 0 2px 2px 0;
  pointer-events: none;
  animation: just-arrived-bar 1.6s ease-out 1;
}
@keyframes just-arrived-flash {
  0% {
    transform: translateY(-12px);
    opacity: 0;
    background: var(--accent-soft);
  }
  12% {
    transform: translateY(0);
    opacity: 1;
    background: var(--accent-soft);
  }
  100% { background: transparent; }
}
@keyframes just-arrived-bar {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

/* Mail toast — bottom-right corner of detail pane */
.mail-toast {
  position: absolute;
  bottom: 22px; right: 22px;
  width: 360px;
  max-width: calc(100% - 44px);
  background: var(--chrome);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 12px;
  align-items: center;
  box-shadow: 0 14px 36px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 12;
  animation: toast-in 0.42s cubic-bezier(.2,.9,.3,1) both, toast-out 0.4s ease-in 6s both;
  user-select: none;
}
.theme-light .mail-toast { box-shadow: 0 14px 36px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08); }
.mail-toast:hover { filter: brightness(1.05); }
.mail-toast .mt-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: mt-pulse 1.4s ease-in-out infinite;
}
@keyframes mt-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px transparent; }
}
.mail-toast .mt-text { min-width: 0; }
.mail-toast .mt-from {
  font-size: 13px; font-weight: 600; color: var(--text);
  letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mail-toast .mt-sub {
  font-size: 12px; color: var(--text-2);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mail-toast .mt-when {
  font-size: 11px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

@keyframes toast-in {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes toast-out {
  from { opacity: 1; }
  to { transform: translateY(20px); opacity: 0; pointer-events: none; }
}

/* Table of contents (lead magnet body) */
.toc {
  margin: 1em 0 1.8em;
  border-top: 1px solid var(--border-2);
}
.toc-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-2);
}
.toc-ch {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  padding-top: 2px;
}
.toc-t {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
  margin-bottom: 2px;
}
.toc-d {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Lead form */
.lead-form-wrap {
  margin: 1.8em 0 1em;
  padding: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 12px;
}
.theme-superhuman .lead-form-wrap { background: rgba(124,92,255,0.10); }
.theme-retro .lead-form-wrap { background: #fff0a8; border-color: #d8b800; }

.lead-form .lead-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 8px;
}
.lead-form .lead-row {
  display: flex; gap: 8px;
}
.lead-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
}
.lead-form input:focus { border-color: var(--accent); }
.lead-form button {
  background: var(--accent);
  color: #001e0a;
  border: none;
  padding: 0 18px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
}
.theme-superhuman .lead-form button { color: #fff; }
.theme-retro .lead-form button {
  background: linear-gradient(#fce98c, #d8a800);
  border: 1px solid #8b6b00; color: #2a1f00;
}
.theme-light .lead-form button { color: #fff; }
.lead-form .lead-fine {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 10px;
  line-height: 1.5;
}

.lead-success {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 0;
}
.lead-success .ls-ico {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #001e0a;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.theme-superhuman .lead-success .ls-ico,
.theme-light .lead-success .ls-ico { color: #fff; }
.theme-retro .lead-success .ls-ico {
  background: linear-gradient(#fce98c, #d8a800); color: #2a1f00;
}
.lead-success .ls-ico svg { width: 18px; height: 18px; }
.lead-success .ls-t {
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}
.lead-success .ls-d {
  font-size: 13px; color: var(--text-2);
  margin-top: 2px; line-height: 1.5;
}

/* Mobile adjustments for lead-magnet */
@media (max-width: 760px) {
  .mail-toast {
    bottom: 90px;
    right: 12px; left: 12px; width: auto;
    max-width: none;
  }
  .lead-form .lead-row { flex-direction: column; }
  .lead-form button { padding: 14px; }
  .toc-row { grid-template-columns: 32px 1fr; gap: 10px; }
  .toc-t { font-size: 14.5px; }
  .toc-d { font-size: 12.5px; }
}

/* Mobile-only / desktop-only base */
.mobile-only { display: none; }
.sb-mobile-head, .mob-back-bar, .mob-titlebar, .sb-backdrop { display: none; }

/* ===== Mobile titlebar ===== */
.mob-titlebar {
  height: 56px;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 6px;
  gap: 4px;
  flex-shrink: 0;
}
.mob-tb-btn {
  width: 44px; height: 44px;
  background: transparent; border: none;
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.mob-tb-btn:active { background: var(--hover); }
.mob-tb-btn svg { width: 22px; height: 22px; }
.mob-tb-center {
  flex: 1; text-align: center; min-width: 0;
}
.mob-tb-title {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text);
}
.mob-tb-sub {
  font-size: 11px; color: var(--text-3); margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

/* ===== Mobile sidebar header ===== */
.sb-mobile-head {
  align-items: center; justify-content: space-between;
  padding: 4px 8px 12px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.sb-mobile-head button {
  width: 32px; height: 32px;
  background: transparent; border: none;
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.sb-mobile-head button:active { background: var(--hover); }
.sb-mobile-head svg { width: 16px; height: 16px; }

/* ===== Mobile back bar in detail ===== */
.mob-back-bar {
  align-items: center; justify-content: space-between;
  height: 44px;
  margin: -6px 0 12px;
}
.mob-back {
  background: transparent; border: none;
  color: var(--accent);
  font-family: inherit; font-size: 15px; font-weight: 500;
  display: flex; align-items: center; gap: 2px;
  padding: 6px 10px 6px 0;
  border-radius: 6px;
  letter-spacing: -0.005em;
}
.mob-back svg { width: 18px; height: 18px; }
.mob-back:active { opacity: 0.6; }
.mob-actions { display: flex; gap: 2px; }
.mob-actions button {
  background: transparent; border: none;
  color: var(--text-2);
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
}
.mob-actions button:active { background: var(--hover); }
.mob-actions svg { width: 18px; height: 18px; }

/* ===== Mobile backdrop ===== */
.sb-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9;
  opacity: 0;
  animation: fade-in 0.18s forwards;
}
@keyframes fade-in { to { opacity: 1; } }

/* ===== Mobile layout @ <=760px ===== */
@media (max-width: 760px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
  }
  .mobile-only { display: flex; }
  .desk-only { display: none !important; }
  .sb-mobile-head { display: flex; }
  .mob-back-bar { display: flex; }
  .mob-titlebar { display: flex; }

  .stage { padding: 0; }
  .window {
    width: 100%; height: 100%;
    max-width: none; max-height: none;
    border-radius: 0; border: none;
    box-shadow: none;
  }

  /* Safe-area-inset support for notched / home-bar phones (iPhone X+, etc.) */
  .mob-titlebar {
    padding-top: env(safe-area-inset-top);
    height: calc(56px + env(safe-area-inset-top));
  }
  .mob-fab {
    right: calc(18px + env(safe-area-inset-right));
    bottom: calc(22px + env(safe-area-inset-bottom));
  }
  .compose-tb {
    padding-top: env(safe-area-inset-top);
    height: calc(52px + env(safe-area-inset-top));
  }
  .compose-form { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
  .detail-body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .mlist { padding-bottom: env(safe-area-inset-bottom); }

  .body3 {
    display: block;
    position: relative;
    flex: 1;
    overflow: hidden;
    min-height: 0;
  }

  .sidebar, .mlist, .detail {
    position: absolute;
    inset: 0;
    width: 100%;
    background: var(--bg);
  }
  .sidebar {
    width: 86%; max-width: 320px;
    transform: translateX(-100%);
    transition: transform 0.18s cubic-bezier(.2,.9,.3,1);
    z-index: 10;
    background: var(--chrome);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    padding-top: 18px;
  }
  .mlist { z-index: 1; }
  .detail {
    z-index: 5;
    transform: translateX(100%);
    transition: transform 0.18s cubic-bezier(.2,.9,.3,1);
  }

  /* Using `transition` (not @keyframes) — iOS Safari repaints child content
     reliably when interpolating between two known states, which avoids the
     "items invisible until tapped" compositor bug we hit with `animation`. */
  .body3.view-sidebar .sidebar { transform: translateX(0); }
  .body3.view-detail .detail { transform: translateX(0); }

  /* Sidebar mobile tweaks */
  .sb-item { padding: 10px 14px; font-size: 15px; }
  .sb-item .ico { width: 18px; height: 18px; }
  .sidebar h4 { margin: 22px 14px 4px; font-size: 11px; }
  .sb-apply { margin: 24px 12px 8px; padding: 14px 16px; font-size: 14px; width: calc(100% - 24px); }
  .sb-bookcall { margin: 0 12px; padding: 14px 16px; font-size: 14px; width: calc(100% - 24px); }
  .sb-apply svg, .sb-bookcall svg { width: 16px; height: 16px; }

  /* List mobile tweaks */
  .mlist-head { padding: 18px 18px 12px; }
  .mlist-head h3 { font-size: 22px; }
  .mlist-head .sort { font-size: 12px; }
  .mitem { padding: 14px 18px 16px; }
  .mitem .from { font-size: 15px; }
  .mitem .subj { font-size: 14px; }
  .mitem .preview {
    font-size: 13px;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .mitem.selected::before { display: none; }
  .mitem.selected { background: transparent; }
  .mitem:active { background: var(--hover); transition: background 0.05s; }
  .sb-item:active { background: var(--hover); }
  .mob-back:active { opacity: 0.5; }

  /* Detail mobile tweaks */
  .detail-head {
    padding: 12px 20px 14px;
    backdrop-filter: none;
    background-color: var(--detail-bg);
  }
  .detail-meta {
    grid-template-columns: 40px 1fr;
    gap: 12px;
  }
  .avatar { width: 40px; height: 40px; font-size: 14px; }
  .detail-meta .when {
    grid-column: 2;
    text-align: left;
    margin-top: 6px;
  }
  .detail-meta .when .full { display: none; }
  .detail-meta .who .addr { font-size: 11px; }
  .detail-meta .who .to { font-size: 11px; }
  .detail-meta .who .name { font-size: 15px; }
  .detail-subject {
    font-size: 22px;
    margin: 14px 0 0;
  }
  .detail-body {
    padding: 22px 20px 80px;
    font-size: 15px;
    line-height: 1.6;
  }
  .detail-body p.lede { font-size: 17px; }
  .detail-body h2 { font-size: 12px; }
  .detail-body h3 { font-size: 15px; }

  .pull { font-size: 24px; padding-left: 18px; }

  /* Stat grid stacks on small screens */
  .statgrid { grid-template-columns: 1fr 1fr; }
  .statgrid .statcell:first-child { grid-column: 1 / -1; }
  .statcell { padding: 16px 18px; }
  .statcell .num { font-size: 26px; }

  /* Steps + rows */
  .step { grid-template-columns: 28px 1fr; gap: 12px; padding: 16px 0; }
  .step .n { font-size: 10px; }
  .step h4 { font-size: 15px; flex-wrap: wrap; }
  .step h4 .dur { display: block; width: 100%; }
  .row { grid-template-columns: 1fr; gap: 4px; padding: 14px 0; }
  .row dd { font-size: 14px; }

  /* Testimonials */
  .tstmnl blockquote { font-size: 16px; }

  /* CTAs */
  .applycta {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 20px;
  }
  .applycta button { width: 100%; padding: 14px; font-size: 14px; }

  .subform { flex-direction: column; }
  .subform button { padding: 14px; }

  .chart { padding: 14px; }
  .bars { height: 100px; gap: 4px; }
  .bar .lbl { font-size: 9px; }

  /* Compose: fullscreen sheet */
  .compose-backdrop {
    padding: 0;
    align-items: stretch; justify-content: stretch;
    background: var(--bg);
    backdrop-filter: none;
  }
  .compose {
    width: 100%; max-width: none;
    max-height: none; height: 100%;
    border-radius: 0; border: none;
  }
  .compose-tb { height: 52px; padding: 0 6px; }
  .compose-tb .title { font-size: 14px; font-weight: 500; color: var(--text); }
  .compose-tb .x { width: 36px; height: 36px; }
  .compose-tb .x svg { width: 18px; height: 18px; }
  .compose-tb .traffic { display: none; }
  .compose-form { padding: 8px 16px 16px; }
  .compose-field { padding: 10px 0; }
  .compose-field label { width: 64px; font-size: 12px; }
  .compose-field input, .compose-field select { font-size: 16px; padding: 6px 0; }
  .compose-body textarea { font-size: 16px; height: 200px; }
  /* iOS zooms on focus for any input under 16px — bump newsletter + lead-magnet inputs too. */
  .subform input, .lead-form input { font-size: 16px; }
  .compose-foot .send {
    width: 100%; padding: 14px; font-size: 15px;
    border-radius: 10px;
  }
  .compose-foot .hint { display: none; }

  /* Hide tweaks panel on mobile entirely? No — keep but smaller */
  .twk-panel { right: 12px !important; bottom: 12px !important; }

  /* Floating compose (FAB) */
  .mob-fab {
    position: absolute;
    right: 18px;
    bottom: 22px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: #001e0a;
    border: none;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 28px rgba(0,0,0,0.35), 0 2px 6px rgba(0,0,0,0.25);
    z-index: 15;
    transition: transform 0.18s cubic-bezier(.2,.9,.3,1);
    cursor: pointer;
  }
  .mob-fab:active { transform: scale(0.94); }
  .mob-fab svg { width: 22px; height: 22px; stroke-width: 1.8; }
}

.theme-superhuman .mob-fab { color: #fff; }
.theme-retro .mob-fab {
  background: linear-gradient(#fce98c, #d8a800);
  color: #2a1f00; border: 1px solid #8b6b00;
}

/* Small responsive */
@media (max-width: 1280px) {
  .body3 { grid-template-columns: 220px 320px 1fr; }
  .detail-head { padding: 20px 32px 14px; }
  .detail-body { padding: 28px 32px 60px; font-size: 14.5px; }
  .detail-subject { font-size: 23px; }
  .statusbar .shortcut { display: none; }
  .statusbar .shortcut.keep { display: inline-flex; }
  .tb-center .crumb-meta { display: none; }
  .tb-apply-label { display: none; }
  .tb-apply { padding: 5px 8px; gap: 0; }
}
@media (max-width: 1100px) {
  .body3 { grid-template-columns: 200px 300px 1fr; }
  .tb-search { width: 140px; }
  .detail-head .actions button span { display: none; }
}
@media (min-width: 761px) and (max-width: 900px) {
  .body3 { grid-template-columns: 64px 260px 1fr; }
  .sb-item .lbl, .sidebar h4, .sb-apply, .sb-bookcall { display: none; }
  .sb-item { justify-content: center; }
  .tb-center { display: none; }
}
