:root {
  /* Pro audio chassis — dark slate body, wood only as accent on top bezel.
     Reference: UA Apollo / Neve console with wooden side cheeks. */
  --navy: #15171a;        /* deepest body */
  --navy-light: #1c1f23;  /* layer 1 */
  --navy-card: #22262c;   /* card surface — clearly distinct from body */
  --navy-mid: #2a2f36;    /* card hover / elevated */
  --gold: #ffa726;        /* full-strength amber LED (no more muted) */
  --gold-dim: #b87811;
  --gold-glow: rgba(255,167,38,0.28);
  /* Wood accents reserved for header bezel only */
  --wood: #7a5536;
  --wood-light: #9a6c45;
  --wood-edge: #2d1d10;
  /* Brushed-metal */
  --metal: #b8b2a8;
  --metal-dim: #6a6660;
  --metal-shadow: rgba(0,0,0,0.50);
  /* Status LEDs — high-saturation, like real LED indicators */
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #ef4444;
  --teal: #10A37F; --blue: #4285F4; --orange: #ff8c42;
  --gray: #9aa0a8;        /* neutral cool gray */
  --gray-dim: #5a5f66;
  --white: #f0eee8;       /* warm white (against dark chassis) */
  /* 16pt grid */
  --pad: 16px;
  --pad-tight: 12px;
  --pad-loose: 20px;
  /* Continuous-curve squircle (large corners read as superellipse) */
  --r-bubble: 22px;
  --r-card: 18px;
  --r-pill: 999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* Spring curves — R5: less overshoot per SF feedback (was 0.34, 1.56) */
  --spring: cubic-bezier(0.4, 1.18, 0.5, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* iOS keyboard offset (set by visualViewport listener) */
  --kb-h: 0px;
  /* Heights — used for absolute stack at top */
  --header-h: 64px;
  --tabbar-h: 52px;
  --composer-h: 60px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
html { background: var(--navy); height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
  /* R6: Inter font features — refined cijfers, stylistic alternates */
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  /* R2: deeper black radial — premium instrument feel (CB-tuned) */
  /* 2026 refresh: clean deep-neutral canvas, no film-grain/wood skeuomorphism.
     A single soft gold aura up top keeps the brand warmth without the dated texture. */
  background:
    radial-gradient(ellipse 100% 54% at 50% -8%, rgba(255,167,38,0.055) 0%, transparent 60%),
    radial-gradient(ellipse 130% 100% at 50% 24%, #16181d 0%, #0c0e11 56%, #08090b 100%);
  background-attachment: fixed;
  color: var(--white); min-height: 100%; font-size: 15px; line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  display: flex; flex-direction: column;
  /* All controls at TOP: header → tabbar → composer → content */
  padding-bottom: calc(var(--safe-bottom) + 16px);
  padding-top: calc(var(--safe-top) + var(--header-h) + var(--tabbar-h) + var(--composer-h) + 12px);
}
/* R7: tighter headers — editorial feel */
h1, h2, h3 { letter-spacing: -0.022em; }
/* R8: tabular numbers everywhere a number is shown */
.ts, .count, .receipt, [class*="count"], [class*="num"] { font-variant-numeric: tabular-nums; }

/* Header — true glass-morphism, dynamic blur, R21 hero glow bleed.
   R24 (Round 1 polish): single consolidated shadow stack (removed duplicate box-shadow that overrode the first),
   scroll-aware depth via .header.scrolled class, and a subtle frosted-glass layer over the wood for premium feel. */
.header {
  /* Fixed at the very top — this is the WOOD BEZEL (the only wood surface) */
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  padding-top: calc(var(--safe-top) + 0px);
  /* 2026 refresh: frosted-glass header (replaces the walnut/wood-grain bezel). */
  background: linear-gradient(180deg, rgba(26,28,33,0.86) 0%, rgba(16,17,21,0.70) 100%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 14px var(--pad) 12px;
  /* Refined single shadow stack — deeper on scroll via .scrolled */
  box-shadow:
    inset 0 1px 0 rgba(255,225,180,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    0 2px 10px rgba(0,0,0,0.22);
  transition: box-shadow 0.32s var(--ease-out);
  display: flex; justify-content: space-between; align-items: center;
}
.header.scrolled {
  box-shadow:
    inset 0 1px 0 rgba(255,225,180,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    0 8px 24px rgba(0,0,0,0.42),
    0 2px 6px rgba(0,0,0,0.20);
}
.header::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.35), transparent);
  pointer-events: none;
}
.header .hgrp { display: flex; flex-direction: column; gap: 2px; }
.header .hright { display: flex; align-items: center; gap: 12px; }
.header .settings-btn {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray); transition: all 0.18s var(--ease-out);
}
.header .settings-btn:hover { color: var(--gold); background: rgba(255,255,255,0.05); }
.header .settings-btn:active { transform: scale(0.92); }
.header h1 {
  font-size: 11px; font-weight: 800; color: var(--gold);
  letter-spacing: 3px; margin: 0; display: flex; align-items: center; gap: 8px;
  text-shadow: 0 0 14px rgba(212,168,67,0.25);
}
.header .header-status {
  font-size: 10px; color: var(--gray-dim); font-weight: 500;
  letter-spacing: 0.02em; transition: color 0.2s var(--ease-out);
}
.header .header-status.active { color: var(--gold); }
.header .clock { font-size: 13px; color: var(--gray); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: 0.02em; }
.connection-pill { font-size: 10px; padding: 3px 8px; border-radius: var(--r-pill);
  margin-left: 8px; background: rgba(255,255,255,0.06); color: var(--gray);
  font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 5px; }
.connection-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 6px currentColor;
}
.connection-pill.ok  { color: var(--green);  background: rgba(74,222,128,0.14); }
.connection-pill.err { color: var(--red);    background: rgba(239,68,68,0.16); }
.connection-pill.slow{ color: var(--yellow); background: rgba(251,191,36,0.14); }
.connection-pill.auth{ color: var(--yellow); background: rgba(251,191,36,0.14); }

/* ── R15+R21: Daily Summary stat strip — premium feel ── */
/* ── Live status stripe (R2 · CB) — three glowing metrics at top of Hub ── */
.status-stripe {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px 1fr;
  gap: 0;
  padding: 14px 16px;
  background:
    radial-gradient(ellipse 100% 100% at 50% 0%, rgba(255,167,38,0.06) 0%, transparent 70%),
    linear-gradient(180deg, #1f232a 0%, #181b1f 100%);
  border: 1px solid #3a3e48;
  border-top: 1.5px solid rgba(255,167,38,0.35);
  border-radius: var(--r-card);
  box-shadow:
    inset 0 1px 0 rgba(255,180,80,0.14),
    0 6px 22px rgba(0,0,0,0.28);
  margin-bottom: 12px;
}
.status-stripe .stat {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0 6px;
}
.status-stripe .stat-num {
  font-size: 22px; font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-shadow: 0 0 12px rgba(255,167,38,0.32);
  line-height: 1;
}
.status-stripe .stat-num.warn { color: #ff8c42; text-shadow: 0 0 12px rgba(255,140,66,0.40); }
.status-stripe .stat-num.idle { color: var(--gray); text-shadow: none; opacity: 0.65; }
.status-stripe .stat-label {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--gray-dim);
}
.status-stripe .stat-sep {
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.10) 30%, rgba(255,255,255,0.10) 70%, transparent);
}

/* ── Tonight's Focus card — autonomous team activity ── */
.tonight-card {
  padding: 14px 16px 12px;
  background:
    radial-gradient(circle at 0% 0%, rgba(74,222,128,0.10), transparent 60%),
    linear-gradient(180deg, rgba(255,167,38,0.06) 0%, transparent 100%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid #3a3e48;
  border-top: 2px solid rgba(255,167,38,0.40);
  border-radius: var(--r-card);
  color: var(--white);
  box-shadow:
    inset 0 1px 0 rgba(255,180,80,0.14),
    0 1px 2px rgba(0,0,0,0.20),
    0 6px 24px rgba(0,0,0,0.30);
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
/* R4: momentum strip — slow amber bar pulse at bottom edge (signals live activity) */
.tonight-card::after,
.brief-hero::after {
  content: ''; position: absolute; bottom: 0; left: 0; height: 1.5px; width: 30%;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
  opacity: 0.55;
  animation: momentumSlide 6s var(--ease-out) infinite;
}
@keyframes momentumSlide {
  0%   { left: -30%; opacity: 0; }
  10%  { opacity: 0.55; }
  90%  { opacity: 0.55; }
  100% { left: 100%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tonight-card::after, .brief-hero::after { animation: none; opacity: 0.3; left: 0; width: 50%; }
}
.tonight-head {
  display: flex; align-items: center; gap: 10px;
}
.tonight-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(212,168,67,0.6);
  animation: tonightPulse 2.2s ease-in-out infinite;
}
@keyframes tonightPulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.25); }
}
.tonight-title {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--gold);
  text-transform: uppercase;
  flex: 1;
}
.tonight-eta {
  font-size: 11px; color: var(--gray-dim);
  font-variant-numeric: tabular-nums;
}
.tonight-body { display: flex; flex-direction: column; gap: 6px; }
.tonight-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0;
  font-size: 13px; color: var(--white);
  line-height: 1.45;
}
.tonight-row .who-pill {
  flex-shrink: 0;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--gold);
  align-self: flex-start; margin-top: 2px;
}
.tonight-row .who-pill.SilverFox     { background: rgba(192,197,206,0.12); color: #d4d8e0; }
.tonight-row .who-pill.CrimsonBadger { background: rgba(168,51,68,0.18); color: #e8a0aa; }
.tonight-row .text {
  flex: 1; min-width: 0;
}
.tonight-row .subj {
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  letter-spacing: -0.01em;
}
.tonight-row .when {
  font-size: 10px; color: var(--gray-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.tonight-empty {
  color: var(--gray-dim); font-size: 12.5px; padding: 6px 0;
  text-align: center;
}
.tonight-foot {
  font-size: 9.5px; color: var(--gray-dim);
  letter-spacing: 0.06em;
  padding-top: 8px; border-top: 0.5px dashed rgba(255,255,255,0.06);
}

/* ── Today card — readable sentence-style status ── */
.today-card {
  padding: 14px 16px 12px;
  background:
    linear-gradient(180deg, rgba(255,167,38,0.07) 0%, transparent 100%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid #3a3e48;
  border-top: 1.5px solid rgba(255,167,38,0.35);
  border-radius: var(--r-card);
  color: var(--white);
  box-shadow: inset 0 1px 0 rgba(255,180,80,0.12), 0 6px 24px rgba(0,0,0,0.30);
  display: flex; flex-direction: column; gap: 8px;
}
.today-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.today-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255,167,38,0.65);
  animation: tonightPulse 2.4s ease-in-out infinite;
}
.today-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; color: var(--white);
  letter-spacing: -0.01em; line-height: 1.4;
}
.today-row .today-ic {
  color: var(--gold); flex-shrink: 0; opacity: 0.7;
}
.today-row .today-text b {
  color: var(--gold); font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-right: 2px;
}
.today-row .muted { color: var(--gray-dim); font-size: 12px; }
.today-foot {
  font-size: 10px; color: var(--gray-dim);
  letter-spacing: 0.04em; margin-top: 4px;
  padding-top: 8px; border-top: 0.5px dashed rgba(255,255,255,0.06);
}
/* Legacy classes retained for any stragglers */
.daily-summary { display: none; }
.ds-num, .ds-label { display: none; }

/* ── R15: Onboarding overlay for hidden features ── */
.onboard-overlay {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(10, 22, 40, 0.92);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px;
  text-align: center;
  animation: onboardIn 0.35s var(--ease-out);
}
.onboard-overlay.open { display: flex; }
@keyframes onboardIn { from { opacity: 0; } to { opacity: 1; } }
.onboard-title {
  font-size: 28px; font-weight: 700; color: var(--white);
  letter-spacing: -0.028em; margin-bottom: 12px; line-height: 1.15;
}
.onboard-sub {
  font-size: 15px; color: var(--gray); line-height: 1.55;
  letter-spacing: -0.01em; max-width: 420px; margin-bottom: 36px;
}
.onboard-tips {
  display: flex; flex-direction: column; gap: 16px;
  width: 100%; max-width: 420px; margin-bottom: 36px;
}
.onboard-tip {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  text-align: left;
}
.onboard-tip .ic {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(212,168,67,0.18); color: var(--gold);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.onboard-tip .text { flex: 1; }
.onboard-tip .t { font-size: 13px; font-weight: 600; color: var(--white); letter-spacing: -0.01em; }
.onboard-tip .d { font-size: 12px; color: var(--gray); margin-top: 2px; letter-spacing: -0.01em; }
.onboard-cta {
  background: linear-gradient(180deg, #e6b850 0%, #c49530 100%);
  color: var(--navy); border: none;
  padding: 13px 32px; border-radius: var(--r-pill);
  font: 700 14px inherit; letter-spacing: -0.01em; cursor: pointer;
  box-shadow: 0 6px 22px rgba(212,168,67,0.35);
}
.onboard-cta:active { transform: scale(0.96); }

/* Main scroll area */
.scroll-area { flex: 1; padding: var(--pad-tight) var(--pad) var(--pad); display: flex; flex-direction: column; gap: 14px; }

.card {
  /* Pro audio panel — dark slate with subtle amber top-edge LED line */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 25%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid #3a3e48;
  border-top: 1px solid rgba(255,167,38,0.18);
  border-radius: var(--r-card);
  padding: var(--pad);
  box-shadow:
    inset 0 1px 0 rgba(255,180,80,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.40),
    0 1px 3px rgba(0,0,0,0.30),
    0 8px 24px rgba(0,0,0,0.32),
    0 24px 56px rgba(0,0,0,0.22);
  color: var(--white);
  /* R2 (SF): hover lift — subtle desktop polish */
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
@media (hover: hover) {
  .card:hover {
    transform: translateY(-1px);
    box-shadow:
      inset 0 1px 0 rgba(255,180,80,0.14),
      inset 0 -1px 0 rgba(0,0,0,0.40),
      0 2px 4px rgba(0,0,0,0.34),
      0 12px 32px rgba(0,0,0,0.36),
      0 28px 60px rgba(0,0,0,0.24);
  }
}
.card h2, .card h3 { color: var(--white); }
.card h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.8px;
  color: var(--gray-dim); margin-bottom: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.card h2 .count {
  background: rgba(212,168,67,0.12); color: var(--gold);
  padding: 2px 9px; border-radius: var(--r-pill); font-size: 10px;
  font-weight: 700; letter-spacing: 0.04em;
}
.refresh-btn {
  background: transparent; border: 0.5px solid rgba(255,255,255,0.1);
  color: var(--gray); padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 10px; cursor: pointer; letter-spacing: 0.04em;
  transition: all 0.2s var(--ease-out);
}
.refresh-btn:active { background: rgba(255,255,255,0.06); transform: scale(0.95); }

/* Briefing — pinned hero card with strong amber-LED top edge */
.brief-hero {
  padding: 16px 18px;
  background:
    linear-gradient(180deg, rgba(255,167,38,0.12) 0%, rgba(255,167,38,0.03) 30%, transparent 100%),
    linear-gradient(180deg, #262a31 0%, #1c1f23 100%);
  border: 1px solid #3a3e48;
  border-top: 2px solid rgba(255,167,38,0.40);
  box-shadow:
    inset 0 1px 0 rgba(255,180,80,0.18),
    0 8px 28px rgba(0,0,0,0.34),
    0 0 60px rgba(255,167,38,0.04);
  position: relative;
  overflow: hidden;
  color: var(--white);
}
.brief-hero::before {
  content: ''; position: absolute; top: 0; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.5), transparent);
  pointer-events: none;
}
.brief-pin {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 1.4px;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0.85;
}
.brief-row {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 10px;
}
.brief-meta { flex: 1; min-width: 0; }
.brief-from { font-size: 11px; font-weight: 600; color: var(--gold); letter-spacing: 0.04em; margin-bottom: 2px; text-transform: uppercase; }
.brief-subj { font-size: 17px; font-weight: 700; color: var(--white); letter-spacing: -0.022em; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.briefing-body {
  font-size: 13.5px; line-height: 1.55; color: rgba(232, 236, 241, 0.85);
  max-height: 180px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  padding-left: 42px; /* align under avatar */
}
.briefing-body.empty { color: var(--gray-dim); font-style: italic; }
@media (max-width: 380px) {
  .briefing-body { padding-left: 0; }
}

/* Topic chip row */
.chips { display: flex; gap: 6px; overflow-x: auto;
  padding: 2px 0 12px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; margin: 0 calc(var(--pad) * -1) 0 calc(var(--pad) * -1);
  padding-left: var(--pad); padding-right: var(--pad);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 13px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: var(--r-pill);
  font-size: 12px; color: var(--gray); white-space: nowrap;
  cursor: pointer; font-weight: 500; letter-spacing: 0.01em;
  transition: all 0.18s var(--ease-out);
}
.chip:active { transform: scale(0.95); }
.chip.active {
  background: var(--gold); color: var(--navy);
  border-color: var(--gold); font-weight: 700;
  box-shadow: 0 4px 14px rgba(212,168,67,0.25);
}

/* Messages — iMessage-style bubbles with avatars */
#messages { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.msg {
  display: flex; gap: 8px; align-items: flex-start;
  animation: msgIn 0.4s var(--spring) backwards;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.msg .avatar {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
/* Solid agent colors with subtle inner highlight (SF: less gradient noise, more restraint) */
.avatar.CrimsonBadger { background: #c94545; }
.avatar.SilverFox     { background: #3a78e8; }
.avatar.SapphireCove  { background: #0e9272; }
.avatar.EmeraldHeron  { background: #2d8a4e; }
.avatar.GoldEagle     { background: #c49530; color: #1a1408; }
.avatar.StormyDeer    { background: #b86847; }
.avatar.unknown       { background: #4a5666; }

/* ── R18: Agent role badge under avatar (only in Threads picker) ── */
.agent-pick .role {
  font-size: 8px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gray-dim);
  margin-top: 1px; line-height: 1.2;
}
.agent-pick.active .role { color: var(--gold); }
.brief-row .role-badge {
  display: inline-block;
  background: rgba(255,255,255,0.06);
  color: var(--gray-dim);
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px; border-radius: var(--r-pill);
  margin-left: 6px; vertical-align: middle;
}
/* Avatar typing pulse — rhythmic breathing for the agent currently "thinking" */
@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 0 rgba(212,168,67,0.45); }
  50%      { box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 6px rgba(212,168,67,0); }
}
.avatar.thinking { animation: avatarPulse 1.4s ease-in-out infinite; }
/* Inline typing dots */
.typing-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 4px 0;
  animation: msgIn 0.3s var(--spring);
}
.typing-row .bubble {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 12px 14px;
  display: inline-flex; gap: 4px; align-items: center;
}
.typing-row .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray);
  animation: typingDot 1.2s ease-in-out infinite;
}
.typing-row .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-row .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30%           { opacity: 0.9;  transform: translateY(-3px); }
}

.msg .bubble-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.msg .meta { display: flex; gap: 8px; align-items: baseline; padding: 0 4px; }
.msg .from { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.msg .from.CrimsonBadger { color: #ff7a7a; }
.msg .from.SilverFox     { color: #6fa3ff; }
.msg .from.SapphireCove  { color: #3fcaa4; }
.msg .from.EmeraldHeron  { color: #5fd078; }
.msg .from.GoldEagle     { color: var(--gold); }
.msg .from.StormyDeer    { color: #e89880; }
.msg .topic {
  color: var(--gray-dim); font-size: 10px;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.04);
  font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
}
.msg .ts { color: var(--gray-dim); font-size: 11px; margin-left: auto; font-variant-numeric: tabular-nums; }

.msg .bubble {
  /* R21: subtle gradient + inset highlight (booking-flow polish) */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02) 80%);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 11px 15px;
  cursor: pointer;
  transition: background 0.18s var(--ease-out), transform 0.18s var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.msg .bubble:hover { transform: translateY(-0.5px); }
.msg .bubble:active { background: rgba(255,255,255,0.06); }
.msg .subj {
  font-size: 14px; font-weight: 600; color: var(--white);
  margin-bottom: 3px; letter-spacing: -0.01em; line-height: 1.35;
}
.msg .body {
  font-size: 13.5px; color: rgba(232, 236, 241, 0.82);
  line-height: 1.55; max-height: 72px; overflow: hidden; position: relative;
  letter-spacing: -0.005em;
}
.msg.expanded .body { max-height: none; }
/* Fade to bubble bg (slate), not navy — matches actual surface, no clash */
.msg .body::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 24px; pointer-events: none;
  background: linear-gradient(180deg, rgba(34,38,44,0) 0%, rgba(34,38,44,0.96) 90%); }
.msg.from-StormyDeer .body::after {
  /* StormyDeer bubbles tint gold — fade to the gold-tinted bubble color */
  background: linear-gradient(180deg, rgba(58,42,16,0) 0%, rgba(58,42,16,0.92) 90%);
}
.msg.expanded .body::after { display: none; }

/* Self-sent messages (from StormyDeer) align right with gold tint */
.msg.from-StormyDeer { flex-direction: row-reverse; }
.msg.from-StormyDeer .bubble-wrap { align-items: flex-end; }
.msg.from-StormyDeer .meta { flex-direction: row-reverse; }
.msg.from-StormyDeer .ts { margin-left: 0; margin-right: auto; }
.msg.from-StormyDeer .bubble {
  /* R21: deeper gold gradient for self-sent (premium feel) */
  background:
    linear-gradient(135deg, rgba(212,168,67,0.22) 0%, rgba(212,168,67,0.12) 60%, rgba(212,168,67,0.08) 100%);
  border-color: rgba(212,168,67,0.32);
  border-radius: var(--r-bubble);
  border-top-right-radius: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 1px 8px rgba(212,168,67,0.10);
}

/* R16: Receipt timestamp under self-sent messages */
.msg.from-StormyDeer .receipt {
  font-size: 10px; color: var(--gray-dim);
  letter-spacing: 0.02em; margin-top: 4px;
  text-align: right; font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── R17: Pinned messages (sticky note above feed) ── */
.pinned-block {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 0 8px;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.pinned-block:empty { display: none; }
.pinned-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(240,192,64,0.10), rgba(212,168,67,0.04));
  border: 0.5px solid rgba(240,192,64,0.28);
  border-radius: 14px;
}
.pinned-row .pin-icon {
  flex-shrink: 0; width: 18px; height: 18px;
  color: var(--yellow); margin-top: 1px;
}
.pinned-row .pin-body { flex: 1; min-width: 0; }
.pinned-row .pin-from { font-size: 11px; color: var(--gold); font-weight: 600; letter-spacing: -0.01em; }
.pinned-row .pin-subj { font-size: 13px; color: var(--white); font-weight: 600; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.pinned-row .pin-x {
  background: transparent; border: none; color: var(--gray); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 4px;
}
.pinned-row .pin-x:hover { color: var(--red); }

.msg .pin-action {
  background: transparent; border: none; color: var(--gray-dim); cursor: pointer;
  padding: 4px;
  position: absolute; top: 8px; right: 38px;
  opacity: 0; transition: opacity 0.18s var(--ease-out);
}
.msg:hover .pin-action, .msg.expanded .pin-action { opacity: 1; }
.msg .pin-action:hover { color: var(--yellow); }
.msg .pin-action.pinned { color: var(--yellow); opacity: 1; }

/* ── R17: Draft indicator pill ── */
.draft-pill {
  display: none;
  position: sticky; top: calc(var(--safe-top) + 56px);
  z-index: 80;
  margin: 0 auto 8px;
  background: rgba(15, 26, 46, 0.9);
  border: 0.5px solid rgba(212,168,67,0.3);
  color: var(--gold);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: draftIn 0.32s var(--ease-out);
}
.draft-pill.show { display: block; }
@keyframes draftIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ── R17: Reduced-motion accessibility (per SF) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .freshness.fresh { animation: none !important; box-shadow: 0 0 0 2px rgba(62,207,142,0.3) !important; }
  .avatar.busy { animation: none !important; }
  .np-dot { animation: none !important; }
  .composer button.send.flash { animation: none !important; }
}

/* Empty state — refined: gentle iconography, friendly copy, suggested action */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; color: var(--gray-dim);
  font-size: 13.5px; line-height: 1.5; gap: 14px;
  text-align: center;
  animation: emptyIn 0.4s var(--ease-out);
}
.empty-state svg {
  opacity: 0.32;
  filter: drop-shadow(0 0 18px rgba(212,168,67,0.08));
  transition: opacity 0.3s var(--ease-out);
}
.empty-state:hover svg { opacity: 0.42; }
.empty-state strong { color: var(--gray); font-weight: 500; letter-spacing: 0.01em; }
.empty-state .hint {
  font-size: 11px;
  color: var(--gold);
  background: rgba(212,168,67,0.10);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  font-weight: 500;
}
@keyframes emptyIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Skeleton loader (shimmer) */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  /* R11: richer shimmer — gold-tinted highlight, smoother gradient */
  background: linear-gradient(90deg,
    rgba(255,255,255,0.025) 0%,
    rgba(255,255,255,0.04) 30%,
    rgba(212,168,67,0.08) 50%,
    rgba(255,255,255,0.04) 70%,
    rgba(255,255,255,0.025) 100%);
  background-size: 220% 100%;
  animation: shimmer 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  border-radius: var(--r-bubble);
}
.skel-msg { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.skel-msg .skel-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skel-msg .skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skel-msg .skel-line { height: 12px; border-radius: 6px; }
.skel-msg .skel-line.short { width: 40%; }
.skel-msg .skel-line.long { width: 90%; height: 38px; border-radius: var(--r-bubble); }

/* R5+R21: Tab bar — booking-flow style glass with hairline gold accent */
.tabbar {
  /* Top-mounted nav strip — sits right under header, above composer */
  position: fixed; top: calc(var(--safe-top) + var(--header-h)); left: 0; right: 0; bottom: auto;
  height: var(--tabbar-h);
  padding-bottom: 0;
  /* Brushed-aluminum nav rail — like the metal channel-select strip on a console */
  background:
    repeating-linear-gradient(180deg,
      rgba(255,255,255,0.012) 0px, rgba(255,255,255,0.012) 1px,
      transparent 1px, transparent 3px),
    linear-gradient(180deg, #2c3038 0%, #1f2227 100%);
  border-top: 1px solid #3a3e48;
  border-bottom: 1px solid #0a0c10;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.50),
    0 2px 12px rgba(0,0,0,0.35);
  display: flex; justify-content: space-around; align-items: stretch;
  z-index: 89;
}
.tabbar::before {
  content: ''; position: absolute; top: -0.5px; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.4), transparent);
  pointer-events: none;
}
.tabbar .tab {
  flex: 1; min-width: 0; background: transparent; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--gray-dim);
  font-size: 10px; font-weight: 700; letter-spacing: 0.03em;
  font-family: inherit;
  padding: 0 2px;
  transition: color 0.18s var(--ease-out), transform 0.18s var(--spring);
}
.tabbar .tab span:last-child {
  white-space: nowrap; overflow: hidden; text-overflow: clip;
  max-width: 100%;
}
/* Phone widths — 7 tabs at <500px, keep labels but very tight */
@media (max-width: 480px) {
  .tabbar .tab { font-size: 8px; letter-spacing: 0; gap: 1px; padding: 0 1px; }
  .tabbar .tab svg { width: 18px; height: 18px; }
  /* Active indicator stays visible */
  .tabbar .tab.active::after { width: 60%; }
}
@media (max-width: 340px) {
  /* Truly tiny — drop labels */
  .tabbar .tab span:last-child { display: none; }
  .tabbar .tab svg { width: 20px; height: 20px; }
}
.tabbar .tab:active { transform: scale(0.92); }
.tabbar .tab.active {
  color: var(--gold);
  /* R4: gentle gold halo on active tab — softer than a hard glow */
  text-shadow: 0 0 18px rgba(212,168,67,0.30);
}
.tabbar .tab.active svg {
  filter: drop-shadow(0 0 8px rgba(212,168,67,0.45));
}
.tabbar .tab svg { transition: filter 0.2s var(--ease-out); }
/* Active tab indicator — wider, brighter top bar */
.tabbar .tab::after {
  content: ''; position: absolute; top: 0; bottom: auto; left: 50%;
  width: 0; height: 3px; background: var(--gold);
  border-radius: 0 0 2px 2px;
  transform: translateX(-50%);
  transition: width 0.28s var(--ease-out);
  box-shadow: 0 1px 10px rgba(212,165,114,0.65);
}
.tabbar .tab.active::after { width: 60%; }
.tabbar .tab .unread-badge {
  position: absolute; top: 4px; bottom: auto; right: 8px;
  min-width: 16px; height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 0 5px;
  display: none; align-items: center; justify-content: center;
  line-height: 1; box-shadow: 0 0 0 2px var(--navy);
  letter-spacing: -0.02em;
}
.tabbar .tab .unread-badge.show { display: flex; }

.tabbar .tab .freshness {
  position: absolute; top: 8px; right: calc(50% - 18px);
  width: 5px; height: 5px; border-radius: 50%;
  background: transparent;
  transition: background 0.4s var(--ease-out);
}
.tabbar .tab .freshness.fresh {
  background: rgba(62,207,142,0.75);
  box-shadow: 0 0 0 0 rgba(62,207,142,0.35);
  animation: freshPulse 2.4s ease-in-out infinite;
}
@keyframes freshPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62,207,142,0.3); }
  50%      { box-shadow: 0 0 0 3px rgba(62,207,142,0); }
}
.tabbar .tab { position: relative; }
.agent-pick .freshness {
  position: absolute; top: 2px; right: 0;
  width: 8px; height: 8px; border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--navy-card);
  transition: background 0.4s var(--ease-out);
}
.agent-pick { position: relative; }
.agent-pick .freshness.fresh { background: rgba(62,207,142,0.75); }

/* R6: Proactive directive cards (different from regular bubbles) */
.msg.directive .bubble {
  background: linear-gradient(135deg, rgba(212,168,67,0.10), rgba(212,168,67,0.04));
  border: 0.5px solid rgba(212,168,67,0.35);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 12px 16px;
}
.msg.directive .bubble::before {
  content: 'DIRECTIVE'; display: block;
  font-size: 9px; font-weight: 800; letter-spacing: 1.6px;
  color: var(--gold); margin-bottom: 6px;
  text-transform: uppercase;
}
.msg.brief .bubble {
  background: linear-gradient(135deg, rgba(66,133,244,0.10), rgba(66,133,244,0.04));
  border: 0.5px solid rgba(66,133,244,0.35);
  border-left: 3px solid var(--blue);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 12px 16px;
}
.msg.brief .bubble::before {
  content: 'BRIEF'; display: block;
  font-size: 9px; font-weight: 800; letter-spacing: 1.6px;
  color: var(--blue); margin-bottom: 6px;
  text-transform: uppercase;
}
.msg.venue-reply .bubble {
  background: linear-gradient(135deg, rgba(62,207,142,0.10), rgba(62,207,142,0.04));
  border: 0.5px solid rgba(62,207,142,0.35);
  border-left: 3px solid var(--green);
  border-radius: var(--r-bubble);
  border-top-left-radius: 6px;
  padding: 12px 16px;
}
.msg.venue-reply .bubble::before {
  content: '✉ VENUE REPLY'; display: block;
  font-size: 9px; font-weight: 800; letter-spacing: 1.4px;
  color: var(--green); margin-bottom: 6px;
}
.msg .actions {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 0.5px solid rgba(255,255,255,0.06);
}
.msg .action-btn {
  flex: 1; padding: 7px 12px;
  background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.08);
  color: var(--gray); font-size: 12px; font-weight: 600;
  border-radius: var(--r-pill); cursor: pointer;
  transition: all 0.18s var(--ease-out);
  font-family: inherit; letter-spacing: -0.01em;
}
.msg .action-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.msg .action-btn:active { transform: scale(0.95); }
.msg .action-btn.primary {
  background: rgba(212,168,67,0.18); color: var(--gold);
  border-color: rgba(212,168,67,0.3);
}
.msg.done .bubble { opacity: 0.45; text-decoration: line-through; }

/* R6: Toast variants for venue replies */
.toast.venue {
  border-color: rgba(62,207,142,0.45);
  color: var(--green);
}

/* ── R8: Time grouping pills between messages ── */
.time-divider {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-dim);
  padding: 6px 0;
  margin: 4px 0;
  position: relative;
  user-select: none;
}
.time-divider::before, .time-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 30%; height: 0.5px;
  background: rgba(255,255,255,0.06);
}
.time-divider::before { left: 0; }
.time-divider::after  { right: 0; }
.time-divider span { background: var(--navy); padding: 0 12px; position: relative; z-index: 1; }

/* ── R19: Day section headers (replaces per-message time-pills for cleaner IA) ── */
.day-header {
  padding: 16px 4px 6px;
  font-size: 12px; font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.06em; text-transform: uppercase;
  position: relative;
}
.day-header:first-child { padding-top: 6px; }
.day-header .day-count {
  color: var(--gray-dim); font-weight: 600;
  margin-left: 8px; letter-spacing: 0.02em;
  text-transform: none; font-variant-numeric: tabular-nums;
}

/* ── R20: "Caught up" end-of-list state ── */
.caught-up {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 28px 16px 6px;
  color: var(--gray-dim);
  user-select: none;
}
.caught-up .check-circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(212,168,67,0.20), rgba(212,168,67,0.08));
  border: 0.5px solid rgba(212,168,67,0.35);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  animation: caughtUpBreath 3.6s ease-in-out infinite;
}
@keyframes caughtUpBreath {
  0%, 100% { transform: scale(1);     box-shadow: 0 0 0 0 rgba(212,168,67,0.35); }
  50%      { transform: scale(1.045); box-shadow: 0 0 0 6px rgba(212,168,67,0); }
}
.caught-up .text {
  font-size: 13px; font-weight: 600; color: var(--gray);
  letter-spacing: -0.01em; text-align: center;
}
.caught-up .sub {
  font-size: 11px; color: var(--gray-dim);
  letter-spacing: -0.01em; text-align: center;
}

/* ── R20: Subtle motion on gold accents (8s breath cycle on pinned + active tab) ── */
@media (prefers-reduced-motion: no-preference) {
  .pinned-row {
    animation: pinBreath 8s ease-in-out infinite;
  }
  @keyframes pinBreath {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212,168,67,0); }
    50%      { box-shadow: 0 0 18px 2px rgba(212,168,67,0.10); }
  }
  .tabbar .tab.active svg {
    animation: tabBreath 8s ease-in-out infinite;
  }
  @keyframes tabBreath {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(212,168,67,0.55)); }
    50%      { filter: drop-shadow(0 0 14px rgba(212,168,67,0.80)); }
  }
}

/* ── R22: Gmail Inbox list (premium feel) ── */
.gmail-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  border: 0.5px solid rgba(255,255,255,0.05);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}
.gmail-row:hover { background: rgba(255,255,255,0.05); transform: translateY(-0.5px); }
.gmail-row:active { transform: scale(0.99); }
.gmail-row.unread {
  border-left: 3px solid var(--gold);
  background:
    linear-gradient(90deg, rgba(212,168,67,0.04), rgba(255,255,255,0.02) 30%);
}
.gmail-row .av {
  flex-shrink: 0; width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: linear-gradient(135deg, #3a4555, #283142);
  color: var(--gray);
  letter-spacing: 0.02em;
}
.gmail-row.unread .av {
  background: linear-gradient(135deg, var(--gold), #c49530);
  color: var(--navy);
}
.gmail-row .meta { flex: 1; min-width: 0; }
/* R4 (SF): per-row Reply quick-action */
.gmail-row .gmail-quick-reply {
  flex-shrink: 0;
  width: 32px; height: 32px;
  align-self: center;
  margin-left: 6px;
  background: rgba(255,167,38,0.08);
  border: 1px solid rgba(255,167,38,0.22);
  border-radius: 50%;
  color: rgba(255,167,38,0.55);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.16s var(--ease-out), background 0.16s var(--ease-out), transform 0.10s var(--spring);
}
.gmail-row:hover .gmail-quick-reply { opacity: 1; }
.gmail-row .gmail-quick-reply:hover {
  background: rgba(255,167,38,0.20);
  color: var(--gold);
  border-color: rgba(255,167,38,0.50);
}
.gmail-row .gmail-quick-reply:active { transform: scale(0.92); }
/* On phone (no hover), always show the reply button so it's discoverable */
@media (hover: none) {
  .gmail-row .gmail-quick-reply { opacity: 1; }
}
.gmail-row .top {
  display: flex; gap: 8px; align-items: baseline;
  margin-bottom: 2px;
}
.gmail-row .from {
  font-size: 13px; font-weight: 600; color: var(--white);
  letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.gmail-row.unread .from { font-weight: 700; }
.gmail-row .date {
  font-size: 11px; color: var(--gray-dim); flex-shrink: 0;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.gmail-row .subj {
  font-size: 13px; color: var(--gray);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -0.01em;
}
.gmail-row.unread .subj { color: var(--white); font-weight: 500; }
.gmail-row .snippet {
  font-size: 12px; color: var(--gray-dim);
  margin-top: 3px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* Expanded body view */
.gmail-detail {
  background: rgba(15, 26, 46, 0.85);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  white-space: pre-wrap; word-break: break-word;
  font-size: 13px; line-height: 1.55; color: rgba(232,236,241,0.85);
  font-family: -apple-system, system-ui, sans-serif;
  letter-spacing: -0.01em;
  max-height: 60vh; overflow-y: auto;
}
.gmail-detail .gmail-detail-head {
  font-size: 11px; color: var(--gray-dim);
  margin-bottom: 8px; letter-spacing: -0.01em;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  padding-bottom: 8px;
}
.gmail-detail .gmail-detail-actions {
  margin-top: 12px; padding-top: 12px;
  border-top: 0.5px solid rgba(255,255,255,0.06);
  display: flex; gap: 8px;
}
.gmail-detail .gmail-act {
  flex: 1; padding: 8px 14px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.08);
  color: var(--white); font-size: 12px; font-weight: 600;
  border-radius: var(--r-pill); cursor: pointer; font-family: inherit;
  letter-spacing: -0.01em;
}
.gmail-act.primary {
  background: linear-gradient(180deg, var(--gold), #c49530);
  color: var(--navy); border-color: transparent;
  box-shadow: 0 4px 12px rgba(212,168,67,0.25);
}
.gmail-act:active { transform: scale(0.97); }

/* ── R20: About / build signature in Settings ── */
.about-block {
  text-align: center; padding: 20px 18px 16px;
}
.about-logo {
  width: 44px; height: 44px; border-radius: 11px;
  background: linear-gradient(135deg, #e6b850 0%, #c49530 100%);
  color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; letter-spacing: 0.08em;
  margin-bottom: 10px;
  box-shadow: 0 4px 14px rgba(212,168,67,0.3);
}
.about-name { font-size: 14px; font-weight: 700; color: var(--white); letter-spacing: -0.01em; }
.about-tag  { font-size: 11px; color: var(--gray); margin-top: 2px; letter-spacing: -0.01em; }
.about-craft {
  font-size: 10px; color: var(--gray-dim); letter-spacing: 0.06em;
  text-transform: uppercase; margin-top: 14px; font-weight: 600;
}

/* ── R8: Bottom-sheet pull-to-dismiss feel ── */
.bottom-sheet { will-change: transform; }
.bottom-sheet.dragging { transition: none; }
.bottom-sheet.dismissing { animation: sheetDown 0.28s var(--ease-out) forwards; }
@keyframes sheetDown { from { transform: translateY(0); } to { transform: translateY(100%); } }
.sheet-grabber { cursor: grab; touch-action: none; padding: 8px 0; }
.sheet-grabber:active { cursor: grabbing; }

/* ── R8: Restore some vibrancy on key interactive elements (per SF) ── */
.composer button.send {
  background: linear-gradient(180deg, #f0c656 0%, #d4a843 50%, #b08828 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.32),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    0 3px 10px rgba(212,168,67,0.42),
    0 0 28px rgba(212,168,67,0.18);
}
.tabbar .tab.active svg { filter: drop-shadow(0 0 8px rgba(212,168,67,0.55)); }

/* Hide tabs in iOS keyboard-shifted state to keep composer accessible */
body.kb-open .tabbar { display: none; }

/* View switching */
/* ── View transitions: spring overshoot on tab change (iOS-style) ── */
.view-section {
  display: none;
  opacity: 0;
  transform: translateY(6px);
}
.view-section.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 1;
  transform: translateY(0);
  /* R9: spring overshoot — slight bounce-in feel */
  animation: viewIn 0.42s var(--spring);
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  60%  { opacity: 1; transform: translateY(-1px) scale(1.002); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* R10: cards inside an active view stagger-in subtly */
.view-section.active > .card,
.view-section.active > .today-card,
.view-section.active > .daily-summary {
  animation: cardIn 0.4s var(--spring);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .view-section.active,
  .view-section.active > .card,
  .view-section.active > .today-card,
  .view-section.active > .daily-summary { animation: none; }
}
/* R12: brightness pulse on success — fires when .sendBtn.flash triggers */
.composer button.send.flash {
  filter: brightness(1.4) drop-shadow(0 0 16px rgba(212,168,67,0.55));
  transition: filter 0.45s var(--ease-out);
}

/* R5: agent picker chips for Threads view */
.agent-picker { display: flex; gap: 8px; overflow-x: auto;
  margin: 0 calc(var(--pad) * -1); padding: 0 var(--pad) 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.agent-picker::-webkit-scrollbar { display: none; }
.agent-pick {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 4px 2px; cursor: pointer;
  background: transparent; border: none; font-family: inherit;
  transition: transform 0.18s var(--spring);
}
.agent-pick:active { transform: scale(0.95); }
.agent-pick .avatar { width: 48px; height: 48px; font-size: 16px; transition: box-shadow 0.2s var(--ease-out); }
.agent-pick.active .avatar {
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1),
              0 0 0 2px var(--gold), 0 0 0 4px var(--navy);
}
.agent-pick .label {
  font-size: 11px; color: var(--gray); font-weight: 600;
  letter-spacing: -0.01em; max-width: 60px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.agent-pick.active .label { color: var(--gold); }

/* Composer — glass bottom bar, iOS keyboard-aware */
.composer {
  /* Default: top-mounted (Hub/Inbox/Team/BirdEye get this) */
  position: fixed; top: calc(var(--safe-top) + var(--header-h) + var(--tabbar-h)); left: 0; right: 0; bottom: auto;
  height: var(--composer-h);
  padding: 10px var(--pad);
  display: flex; gap: 8px; align-items: center;
  z-index: 90;
  /* Composer = dark slate shelf, like input row of a console */
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, transparent 25%),
    linear-gradient(180deg, #1f2227 0%, #15171a 100%);
}
/* ── CHAT-MODE composer: bottom-mounted like real chat apps (iMessage-style) ── */
.composer.chat-mode {
  top: auto !important;
  bottom: calc(var(--safe-bottom) + var(--kb-h, 0px)) !important;
  border-top: 1px solid #0a0c10;
  border-bottom: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 -2px 14px rgba(0,0,0,0.40);
  z-index: 95;
}
body.chat-active {
  /* When chat tab active: chat view becomes a fixed-height region with INTERNAL scroll
     (iMessage / Telegram pattern). Without this, every new message inflates body
     scrollHeight unbounded — on phone Safari that path hits memory pressure and the
     page hangs / crashes once message count grows.
     Charter A1 (2026-05-21): switched 100vh → 100svh so the iOS URL bar collapse
     doesn't yank the chat region out of the viewport. */
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden !important;
  height: 100svh !important;
}
body.chat-active #chatView.active {
  position: fixed;
  top: calc(var(--safe-top) + var(--header-h) + var(--tabbar-h));
  bottom: calc(var(--safe-bottom) + var(--composer-h) + var(--kb-h, 0px));
  left: 0; right: 0;
  margin: 0;
  padding: 12px 14px 4px;
  overflow: hidden;
  display: flex !important;
  flex-direction: column;
  /* iOS Safari momentum scroll for the inner stream */
  -webkit-overflow-scrolling: touch;
  contain: layout style;
}
body.chat-active #chatView.active > h2 {
  flex-shrink: 0;
}
body.chat-active #chatView.active #chatMessages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Stick to bottom by default so newest msg is in view */
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  /* Charter A5 (2026-05-21): removed translateZ(0) — was paranoia.
     Modern Safari composites overflow:auto regions automatically; the GPU hint
     was breaking sticky descendants in the fade-overlay. */
}
/* Subtle fade at top of scroll region so newer-content-below feels alive */
body.chat-active #chatView.active #chatMessages::before {
  content: "";
  position: sticky; top: 0; left: 0; right: 0;
  height: 6px;
  margin-bottom: -6px;
  background: linear-gradient(180deg, rgba(15,16,18,0.55), transparent);
  pointer-events: none; z-index: 1;
  display: block;
}
.composer:not(.chat-mode) {
  border-top: 1px solid #0a0c10;
  border-bottom: 1px solid #0a0c10;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.40),
    0 2px 14px rgba(0,0,0,0.30);
  transition: top 0.22s var(--ease-out);
}
.composer select, .composer input {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
  color: var(--white);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: var(--r-pill);
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  min-height: 40px; letter-spacing: -0.01em;
  transition: all 0.18s var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
/* ── Universal press feedback (Apple HIG: 0.95 scale on touch) ── */
button, .chip, [role="button"], a.btn { -webkit-tap-highlight-color: transparent; }
button:not(:disabled):active:not(.no-press),
[role="button"]:not(:disabled):active:not(.no-press) {
  transform: scale(0.96);
  transition: transform 0.08s var(--ease-out);
}
/* Selection: refined accent (gold, slight transparency) */
::selection { background: rgba(212,168,67,0.32); color: var(--white); }

.composer input:focus, .composer select:focus {
  outline: none;
  border-color: rgba(212,168,67,0.55);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 0 0 3px rgba(212,168,67,0.12);
}
.composer select { flex: 0 0 110px; max-width: 110px; padding-right: 28px;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%238898aa'%3E%3Cpath d='M6 9L2 5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px;
  background-color: rgba(255,255,255,0.06);
}
.composer input { flex: 1; min-width: 0; }
.composer button.icon-btn {
  width: 40px; height: 40px; padding: 0;
  border: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.18s var(--spring), background 0.18s var(--ease-out);
}
.composer button.send {
  /* CB-tuned amber LED. R4: dim-when-empty (visible always, primary on text) per SF */
  background: linear-gradient(135deg, #cc7a29, #a35f1d);
  color: #f5ede0;
  box-shadow:
    inset 0 1px 0 rgba(255,200,140,0.28),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    0 3px 10px rgba(140,80,30,0.32);
  opacity: 0.42;
  transition: opacity 0.18s var(--ease-out), transform 0.18s var(--spring), box-shadow 0.18s var(--ease-out);
}
.composer.has-text button.send {
  opacity: 1;
  box-shadow:
    inset 0 1px 0 rgba(255,200,140,0.36),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    0 4px 14px rgba(204,122,41,0.48);
}
.composer button.send:active { transform: scale(0.88); }
.composer button.send.flash { animation: sendFlash 0.5s var(--spring); }
@keyframes sendFlash {
  0% { transform: scale(1); }
  40% { transform: scale(1.15) rotate(8deg); box-shadow: 0 6px 22px rgba(212,168,67,0.6); }
  100% { transform: scale(1) rotate(0deg); }
}
.composer button.email {
  background: rgba(16,163,127,0.30);
  color: #6ee5c0;
  border: 1px solid rgba(16,163,127,0.55);
  box-shadow: inset 0 1px 0 rgba(110,229,192,0.18);
}
.composer button.email:active { transform: scale(0.92); background: rgba(16,163,127,0.45); }
.composer button.mic {
  background: rgba(255,255,255,0.10);
  color: #e8eaf0;
  border: 1px solid rgba(255,255,255,0.45);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    inset 0 -1px 0 rgba(0,0,0,0.22);
}
.composer button.mic:active { transform: scale(0.92); }
.composer button.mic.recording {
  background: rgba(232,84,84,0.2);
  color: #ff7a7a;
  border-color: rgba(232,84,84,0.4);
  animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,84,84,0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(232,84,84,0); }
}
.composer button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Composer "shrink" while sending (CrimsonBadger Round 1) */
.composer.sending { transform: scale(0.985); transition: transform 0.2s var(--spring); }

/* Toast — refined, top-positioned */
.toast {
  position: fixed; top: calc(60px + var(--safe-top)); left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(15, 26, 46, 0.95);
  border: 0.5px solid rgba(212,168,67,0.4);
  color: var(--gold); padding: 9px 16px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  z-index: 200; opacity: 0; pointer-events: none;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--spring);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(232,84,84,0.45); color: #ff7a7a; }

/* ── R3: Premium gold (deeper shadow + subtle gradient depth, SF feedback) ── */
.composer button.send {
  background: linear-gradient(180deg, #e6b850 0%, #c49530 50%, #a07e30 100%);
  color: #1a1408;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.15),
    0 2px 8px rgba(212,168,67,0.35),
    0 0 24px rgba(212,168,67,0.15);
}

/* ── R3: Markdown formatting in message body ── */
.msg .body strong { color: rgba(232,236,241,0.92); font-weight: 600; }
.msg .body em { color: rgba(232,236,241,0.78); font-style: italic; }
.msg .body code {
  background: rgba(0,0,0,0.4); padding: 1px 6px;
  border-radius: 5px; font-family: ui-monospace, "SF Mono", monospace;
  font-size: 0.92em; color: var(--gold); border: 0.5px solid rgba(212,168,67,0.2);
}
.msg .body a { color: var(--gold); text-decoration: none; border-bottom: 0.5px solid rgba(212,168,67,0.4); }
.msg .body a:hover { border-bottom-color: var(--gold); }
.msg .body ul { padding-left: 18px; margin: 4px 0; }
.msg .body li { margin: 2px 0; }
.msg .body br + br { display: none; } /* collapse triple newlines */

/* ── R3: Reading rhythm — extra breathing space around bubbles ── */
#messages { gap: 18px; padding-top: 8px; }

/* ── R3: Bottom sheet (native iOS feel, replaces centered email modal) ── */
.sheet-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; animation: overlayIn 0.25s var(--ease-out); }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.bottom-sheet {
  width: 100%; max-width: 640px;
  background: rgba(15, 26, 46, 0.97);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 0.5px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column;
  max-height: 92dvh;
  overflow: hidden;
  backdrop-filter: saturate(180%) blur(40px);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  box-shadow: 0 -10px 60px rgba(0,0,0,0.5);
  animation: sheetUp 0.32s var(--spring);
  padding-bottom: var(--safe-bottom);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grabber {
  width: 40px; height: 4px; background: rgba(255,255,255,0.18);
  border-radius: 2px; margin: 8px auto 4px;
}
.sheet-head {
  padding: 10px 18px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.sheet-head h3 { color: var(--white); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.sheet-head button {
  background: transparent; border: none; cursor: pointer;
  font: 600 15px/1 inherit; padding: 8px 4px; letter-spacing: -0.01em;
}
.sheet-head .sheet-cancel { color: var(--gray); }
.sheet-head .sheet-send {
  color: var(--navy);
  background: linear-gradient(180deg, #e6b850 0%, #c49530 100%);
  padding: 8px 16px; border-radius: var(--r-pill);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(212,168,67,0.3);
}
.sheet-head .sheet-send:disabled { opacity: 0.4; cursor: not-allowed; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 0; -webkit-overflow-scrolling: touch; }
.sheet-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-bottom: 0.5px solid rgba(255,255,255,0.04);
}
.sheet-row label {
  color: var(--gray-dim); font-size: 13px; font-weight: 500;
  min-width: 56px; letter-spacing: -0.01em;
}
.sheet-row input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--white); font: 15px inherit; padding: 4px 0;
  letter-spacing: -0.01em;
}
.sheet-body textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--white); padding: 16px 18px; font: 15px/1.5 inherit;
  resize: none; min-height: 200px; letter-spacing: -0.01em;
}
.sheet-foot { padding: 10px 18px 16px; color: var(--gray-dim); font-size: 11px; line-height: 1.6; }
.sheet-foot b { color: var(--gray); font-weight: 600; }

/* ── R9: Settings sheet rows ── */
.settings-group {
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
}
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
}
.settings-row label {
  flex: 0 0 130px; color: var(--gray);
  font-size: 13px; font-weight: 500; letter-spacing: -0.01em;
}
.settings-row input {
  flex: 1; background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 8px 12px;
  color: var(--white); font: 14px inherit; outline: none;
}
.settings-row input:focus { border-color: rgba(212,168,67,0.4); }
.settings-hint {
  padding: 0 18px 10px; color: var(--gray-dim);
  font-size: 11px; line-height: 1.5;
}
.settings-action {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 18px;
  background: transparent; border: none; border-top: 0.5px solid rgba(255,255,255,0.04);
  color: var(--white); font: 14px inherit; cursor: pointer;
  letter-spacing: -0.01em;
  transition: background 0.18s var(--ease-out);
}
.settings-action:active { background: rgba(255,255,255,0.04); }
.settings-action:first-child { border-top: none; }
.settings-action.danger { color: var(--red); }
.settings-action.danger svg { color: var(--red); }
.settings-foot {
  padding: 18px 18px 24px;
  color: var(--gray-dim); font-size: 11px; line-height: 1.6; text-align: center;
}

/* ── R12: Contact suggestions dropdown ── */
.contact-suggestions {
  margin: 0 18px 8px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
}
.contact-suggestion {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer;
  border-top: 0.5px solid rgba(255,255,255,0.04);
  transition: background 0.15s var(--ease-out);
}
.contact-suggestion:first-child { border-top: none; }
.contact-suggestion:hover, .contact-suggestion:active { background: rgba(255,255,255,0.06); }
.contact-suggestion .ic {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(212,168,67,0.18); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.contact-suggestion .info { flex: 1; min-width: 0; }
.contact-suggestion .info .name {
  font-size: 13px; font-weight: 600; color: var(--white); letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.contact-suggestion .info .em {
  font-size: 11px; color: var(--gray); letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── R12: Attachment chips ── */
.attach-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 0; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(212,168,67,0.14);
  border: 0.5px solid rgba(212,168,67,0.3);
  color: var(--gold);
  padding: 6px 10px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: -0.01em;
  max-width: 200px;
}
.attach-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .size { color: var(--gray); font-weight: 500; }
.attach-chip .x {
  background: transparent; border: none; cursor: pointer;
  color: var(--gold); padding: 0; margin-left: 4px;
  font-size: 14px; line-height: 1;
}
.attach-chip .x:hover { color: var(--red); }
.attach-control {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; border-top: 0.5px solid rgba(255,255,255,0.04);
}
.attach-control .attach-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.1);
  color: var(--gray); cursor: pointer;
  padding: 7px 12px; border-radius: var(--r-pill);
  font: 600 12px inherit; letter-spacing: -0.01em;
}
.attach-control .attach-add:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.attach-control .attach-info { color: var(--gray-dim); font-size: 11px; }

/* ── R13: Search overlay (Cmd-K or pull-down) ── */
.search-overlay {
  position: fixed; inset: 0; z-index: 280;
  background: rgba(10, 22, 40, 0.88);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  display: none;
  flex-direction: column;
  padding: calc(var(--safe-top) + 16px) var(--pad) 0;
}
.search-overlay.open { display: flex; animation: searchIn 0.25s var(--ease-out); }
@keyframes searchIn { from { opacity: 0; } to { opacity: 1; } }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.07);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--white); font: 16px inherit; letter-spacing: -0.01em;
}
.search-close {
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.1);
  color: var(--gray);
  padding: 4px 10px; border-radius: 8px;
  font: 600 11px ui-monospace, monospace;
  cursor: pointer; letter-spacing: 0.04em; text-transform: uppercase;
}
.search-close:hover { color: var(--white); }
.search-results { flex: 1; overflow-y: auto; padding-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
.search-result {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 14px; padding: 12px 14px;
  cursor: pointer;
  transition: background 0.18s var(--ease-out);
}
.search-result:hover { background: rgba(255,255,255,0.06); }
.search-result .sr-meta {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 4px;
}
.search-result .sr-from { font-size: 11px; font-weight: 600; color: var(--gold); letter-spacing: 0.04em; text-transform: uppercase; }
.search-result .sr-ts { font-size: 11px; color: var(--gray-dim); margin-left: auto; }
.search-result .sr-subj { font-size: 13px; font-weight: 600; color: var(--white); line-height: 1.4; letter-spacing: -0.01em; }
.search-result .sr-body { font-size: 12px; color: var(--gray); line-height: 1.5; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result mark { background: rgba(212,168,67,0.3); color: var(--gold); padding: 0 2px; border-radius: 3px; }

/* ── R13: Agent busy/thinking ring on avatars ── */
.avatar.busy {
  animation: avatarBusy 1.8s ease-in-out infinite;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1),
              0 0 0 2px rgba(212,168,67,0.5), 0 0 0 4px rgba(212,168,67,0.15);
}
@keyframes avatarBusy {
  0%, 100% { box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 2px rgba(212,168,67,0.5), 0 0 0 4px rgba(212,168,67,0.15); }
  50%      { box-shadow: 0 1px 3px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1), 0 0 0 3px rgba(212,168,67,0.8), 0 0 0 8px rgba(212,168,67,0.05); }
}

/* ── R14: Swipe gesture visual feedback on bubbles ── */
.msg.swiping .bubble {
  transition: transform 0.05s linear, background 0.2s var(--ease-out);
}
.msg .swipe-hint {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; pointer-events: none;
  opacity: 0; transition: opacity 0.18s var(--ease-out);
}
.msg .swipe-hint.left  { left: -64px;  color: var(--gold); }
.msg .swipe-hint.right { right: -64px; color: var(--yellow); }
.msg.show-reply  .swipe-hint.left  { opacity: 1; }
.msg.show-star   .swipe-hint.right { opacity: 1; }
.msg.starred .bubble {
  background: linear-gradient(135deg, rgba(240,192,64,0.10), rgba(255,255,255,0.04));
  border-color: rgba(240,192,64,0.35);
}
.msg.starred .meta::after {
  content: '★'; color: var(--yellow); margin-left: 6px; font-size: 12px;
}

/* ── R14: @mention chip in composer ── */
#composeText {
  /* Ensure mentions stand out in dropdown */
}
.mention-dropdown {
  position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 60px + var(--kb-h));
  left: 16px; right: 16px;
  background: rgba(15,26,46,0.97);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  display: none;
  z-index: 95;
}
.mention-dropdown.open { display: block; animation: mentionIn 0.18s var(--ease-out); }
@keyframes mentionIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.mention-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-top: 0.5px solid rgba(255,255,255,0.04);
  transition: background 0.15s var(--ease-out);
}
.mention-item:first-child { border-top: none; }
.mention-item:hover, .mention-item.active { background: rgba(212,168,67,0.10); }
.mention-item .avatar { width: 28px; height: 28px; font-size: 11px; }
.mention-item .name { font-size: 13px; font-weight: 600; color: var(--white); letter-spacing: -0.01em; }

/* ── R13: Toned-down bounce-back (per SF — was too playful) ── */
.tabbar .tab:active { transform: scale(0.92); animation: bounceBack 0.32s var(--ease-out) 0.05s; }
.chip:active        { animation: bounceBack 0.32s var(--ease-out) 0.05s; }
.composer button.send:active { animation: bounceBack 0.32s var(--ease-out) 0.05s; }
@keyframes bounceBack {
  0%   { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* ── R10: A2HS install prompt floating card ── */
.install-prompt {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 16px; right: 16px; z-index: 150;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(15, 26, 46, 0.95);
  border: 0.5px solid rgba(212,168,67,0.35);
  border-radius: var(--r-card);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  animation: installSlide 0.4s var(--spring);
}
@keyframes installSlide { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.install-icon {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), #c49530);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.install-text { flex: 1; min-width: 0; }
.install-title { font-size: 13px; font-weight: 700; color: var(--white); letter-spacing: -0.01em; }
.install-sub { font-size: 11px; color: var(--gray); margin-top: 2px; letter-spacing: -0.01em; }
.install-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--gray); font-size: 22px; padding: 4px 8px; line-height: 1;
}
.install-close:hover { color: var(--white); }

/* ── R11: Top progress bar (AI thinking / sync) ── */
#progressBar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; z-index: 300;
  background: transparent;
  pointer-events: none;
}
#progressBar.active {
  background: linear-gradient(90deg, transparent 0%, var(--gold) 50%, transparent 100%);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: progressSlide 1.2s ease-in-out infinite;
}
@keyframes progressSlide {
  0%   { background-position: -50% 0; }
  100% { background-position: 150% 0; }
}

/* ── R11: Backend health banner ── */
.health-banner {
  position: fixed;
  top: calc(var(--safe-top) + 0px);
  left: 0; right: 0; z-index: 250;
  background: linear-gradient(180deg, rgba(232,84,84,0.95) 0%, rgba(180,60,60,0.95) 100%);
  color: #fff;
  padding: 10px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px; justify-content: center;
  box-shadow: 0 4px 16px rgba(232,84,84,0.3);
  animation: healthIn 0.3s var(--spring);
}
@keyframes healthIn { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ── R11: Now Playing bar (sits above tab bar during long ops) ── */
.now-playing {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  left: 16px; right: 16px;
  background: rgba(212,168,67,0.92);
  color: var(--navy);
  border-radius: var(--r-card);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 700; letter-spacing: -0.01em;
  z-index: 91;
  box-shadow: 0 6px 22px rgba(212,168,67,0.4);
  animation: npIn 0.32s var(--spring);
}
@keyframes npIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.np-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--navy);
  animation: npPulse 1.2s ease-in-out infinite;
}
@keyframes npPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.5; }
}

/* ── R11: TTS speaker icon on each message bubble (top-right) ── */
.msg .speak-btn {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: none; cursor: pointer;
  padding: 4px;
  color: var(--gray-dim);
  opacity: 0; transition: opacity 0.18s var(--ease-out);
  border-radius: 50%;
}
.msg .bubble { position: relative; }
.msg:hover .speak-btn, .msg.expanded .speak-btn { opacity: 1; }
.msg .speak-btn:hover { color: var(--gold); }
.msg .speak-btn.speaking { color: var(--gold); animation: ttsPulse 0.9s ease-in-out infinite; }
@keyframes ttsPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── AUTH OVERLAY (customer sign-in / sign-up) ───────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,167,38,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 90% 70% at 50% 50%, #1a1d22 0%, #0a0c10 100%);
  animation: viewIn 0.3s var(--ease-out);
}
.auth-card {
  width: 100%; max-width: 360px;
  padding: 28px 24px 22px;
  background:
    linear-gradient(180deg, rgba(255,167,38,0.07) 0%, transparent 25%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid #3a3e48;
  border-top: 2px solid rgba(255,167,38,0.40);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255,180,80,0.16),
    0 8px 32px rgba(0,0,0,0.45),
    0 24px 56px rgba(0,0,0,0.30);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo {
  font-size: 28px; font-weight: 700; letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(255,167,38,0.30);
  margin-bottom: 4px;
}
.auth-tag { font-size: 11px; color: var(--gray); letter-spacing: 0.04em; }
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 18px;
  background: rgba(0,0,0,0.30); border-radius: 10px; padding: 3px;
  border: 1px solid #2a2f36;
}
.auth-tab {
  flex: 1; padding: 8px 10px; border: none;
  background: transparent; color: var(--gray);
  font: 600 12px inherit; letter-spacing: 0.04em;
  border-radius: 8px; cursor: pointer;
  transition: all 0.16s var(--ease-out);
}
.auth-tab.active { background: rgba(255,167,38,0.14); color: var(--gold); }
.auth-row { margin-bottom: 12px; }
.auth-row label {
  display: block; font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gray-dim); margin-bottom: 5px;
}
.auth-row input {
  width: 100%; box-sizing: border-box;
  padding: 11px 12px;
  background: rgba(0,0,0,0.35);
  border: 1px solid #3a3e48;
  border-radius: 10px;
  color: var(--white); font: 500 14px inherit;
  outline: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.auth-row input:focus {
  border-color: rgba(255,167,38,0.55);
  background: rgba(0,0,0,0.50);
  box-shadow: 0 0 0 3px rgba(255,167,38,0.12);
}
.auth-row input::placeholder { color: var(--gray-dim); }
.auth-submit {
  width: 100%; margin-top: 6px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #cc7a29, #a35f1d);
  color: #f5ede0;
  border: none; border-radius: 10px;
  font: 700 14px inherit; letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,200,140,0.28),
    inset 0 -1px 0 rgba(0,0,0,0.32),
    0 4px 14px rgba(140,80,30,0.40);
  transition: transform 0.12s var(--spring);
}
.auth-submit:active { transform: scale(0.97); }
.auth-submit:disabled { opacity: 0.5; cursor: wait; }
.auth-err {
  margin-top: 10px; min-height: 16px;
  font-size: 11px; color: #ff8090; text-align: center;
}
.auth-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px dashed rgba(255,255,255,0.08);
  font-size: 10px; line-height: 1.5;
  color: var(--gray-dim); text-align: center;
}

/* ── Manager Brief card — CB's latest directive, top of Hub ──────────── */
.manager-brief {
  padding: 14px 16px 12px;
  background:
    radial-gradient(circle at 0% 0%, rgba(232,84,84,0.10), transparent 60%),
    linear-gradient(180deg, rgba(255,90,111,0.07) 0%, transparent 35%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid rgba(255,90,111,0.30);
  border-top: 2px solid rgba(255,90,111,0.55);
  border-radius: var(--r-card);
  color: var(--white);
  box-shadow:
    inset 0 1px 0 rgba(255,140,150,0.16),
    0 1px 2px rgba(0,0,0,0.20),
    0 6px 24px rgba(0,0,0,0.30);
  display: flex; flex-direction: column; gap: 8px;
  position: relative;
}
.mb-head { display: flex; align-items: center; gap: 8px; }
.mb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff5a6f;
  box-shadow: 0 0 12px rgba(255,90,111,0.65);
  animation: tonightPulse 2.2s ease-in-out infinite;
}
.mb-tag {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #ff8090;
  flex: 1;
}
.mb-when {
  font-size: 10px; color: var(--gray-dim);
  font-variant-numeric: tabular-nums;
}
.mb-priority {
  font-size: 14px; line-height: 1.45; letter-spacing: -0.01em;
  color: var(--white);
  font-weight: 500;
}
.mb-why {
  font-size: 11.5px; color: var(--gray);
  line-height: 1.4;
}
.mb-action {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 12px;
  background: rgba(255,90,111,0.14);
  border: 1px solid rgba(255,90,111,0.40);
  border-radius: 8px;
  color: #ff8090;
  font: 600 11px inherit; letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s var(--ease-out), transform 0.10s var(--spring);
}
.mb-action:hover { background: rgba(255,90,111,0.24); }
.mb-action:active { transform: scale(0.95); }

/* ── NEEDS YOUR CLICK card — Hub top, always visible (green clean, gold needs-attn) */
.needs-click {
  padding: 14px 16px 12px;
  margin-bottom: 12px;
  background:
    radial-gradient(circle at 0% 0%, rgba(34,197,94,0.10), transparent 60%),
    linear-gradient(180deg, rgba(34,197,94,0.06) 0%, transparent 35%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid rgba(34,197,94,0.30);
  border-top: 2px solid rgba(34,197,94,0.55);
  border-radius: var(--r-card);
  color: var(--white);
  box-shadow:
    inset 0 1px 0 rgba(120,200,140,0.16),
    0 1px 2px rgba(0,0,0,0.20),
    0 6px 24px rgba(0,0,0,0.30);
  transition: all 0.25s var(--ease-out);
}
.needs-click.attn {
  /* Gold-orange when 1+ items waiting */
  background:
    radial-gradient(circle at 0% 0%, rgba(212,168,67,0.14), transparent 60%),
    linear-gradient(180deg, rgba(212,168,67,0.10) 0%, transparent 35%),
    linear-gradient(180deg, #22262c 0%, #1c1f23 100%);
  border: 1px solid rgba(212,168,67,0.45);
  border-top: 2px solid rgba(212,168,67,0.70);
  box-shadow:
    inset 0 1px 0 rgba(255,210,120,0.18),
    0 1px 2px rgba(0,0,0,0.20),
    0 6px 28px rgba(212,168,67,0.18);
}
.nc-head { display: flex; align-items: center; gap: 8px; }
.nc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34,197,94,0.6);
  flex-shrink: 0;
}
.needs-click.attn .nc-dot {
  background: #d4a843;
  box-shadow: 0 0 12px rgba(212,168,67,0.7);
  animation: tonightPulse 2.2s ease-in-out infinite;
}
.nc-tag {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #88e0a0;
  flex: 1;
}
.needs-click.attn .nc-tag { color: #ffd680; }
.nc-burn {
  font-size: 10px; color: var(--gray-dim);
  font-variant-numeric: tabular-nums;
}
.nc-body {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.nc-body:empty { display: none; }
.nc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.nc-item:hover { background: rgba(255,255,255,0.07); }
.nc-item .nc-from {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
  background: rgba(212,168,67,0.18);
  color: #ffd680;
  flex-shrink: 0;
}
.nc-item .nc-subj {
  font-size: 12.5px; color: var(--white);
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nc-item .nc-arrow {
  font-size: 14px; color: var(--gold);
  flex-shrink: 0; opacity: 0.7;
}

/* ── TEAM tab: 24/7 roster ────────────────────────────────── */
.team-roster { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.team-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  border: 0.5px solid rgba(255,255,255,0.05);
  transition: background 0.18s var(--ease-out);
}
.team-row:hover { background: rgba(255,255,255,0.045); }
.team-row .av {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(212,168,67,0.6), rgba(212,168,67,0.3));
}
.team-row .av.GoldEagle     { background: linear-gradient(135deg, #d4a843, #8c6e1c); }
.team-row .av.SilverFox     { background: linear-gradient(135deg, #c0c5ce, #6a6e74); }
.team-row .av.CrimsonBadger { background: linear-gradient(135deg, #a83344, #5a1c25); }
.team-row .av.SapphireCove  { background: linear-gradient(135deg, #3b6db8, #1a3a6e); }
.team-row .av.EmeraldHeron  { background: linear-gradient(135deg, #2d8a4e, #19582f); }
.team-row .av.StormyDeer    { background: linear-gradient(135deg, #6b6e3a, #3a3c1c); }
.team-row .info { min-width: 0; }
.team-row .name { font-weight: 600; font-size: 14px; color: var(--white); }
.team-row .role { font-size: 11px; color: var(--gray); margin-top: 1px; }
.team-row .last { font-size: 11px; color: var(--gray-dim); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .last .tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(212,168,67,0.12);
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-right: 6px;
}
.team-row .stats { text-align: right; flex-shrink: 0; }
.team-row .stats .count {
  font-size: 18px; font-weight: 600;
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.team-row .stats .label { font-size: 10px; color: var(--gray-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.team-row .stats .cadence { font-size: 10px; color: var(--gray); margin-top: 2px; }
.team-row.idle { opacity: 0.6; }
.team-row.idle .av { filter: grayscale(0.5); }

.team-meta {
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 0.5px dashed rgba(255,255,255,0.08);
  font-size: 12px;
  color: var(--gray);
  line-height: 1.55;
}
.team-meta .row { display: flex; justify-content: space-between; margin: 3px 0; }
.team-meta .row .k { color: var(--gray-dim); }
.team-meta .row .v { color: var(--white); font-variant-numeric: tabular-nums; }
.team-meta .row .v.warn { color: var(--gold); }

/* ── TASKS tab ────────────────────────────────────────────── */
.task-add-row {
  display: flex; gap: 8px; margin: 8px 0 14px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.30);
  border-radius: 10px;
  border: 1px solid #3a3e48;
}
.task-add-row input {
  flex: 1;
  background: transparent; border: none; outline: none;
  font: 500 14px inherit;
  color: var(--white);
}
.task-add-row input::placeholder { color: var(--gray-dim); }
.task-add-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: #2a1808;
  border: none; cursor: pointer;
  font: 700 16px inherit;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(40,20,8,0.20);
}
.task-add-btn:active { transform: scale(0.92); }
.tasks-list { display: flex; flex-direction: column; gap: 6px; }
.task-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid #2a2f36;
  cursor: pointer;
  transition: background 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}
.task-row:hover { background: rgba(255,255,255,0.06); }
.task-row:active { transform: scale(0.99); }
.task-checkbox {
  width: 20px; height: 20px; border-radius: 5px;
  border: 1.5px solid var(--gray-dim);
  background: rgba(0,0,0,0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
  transition: all 0.18s var(--ease-out);
}
.task-row.done .task-checkbox {
  background: var(--gold);
  border-color: var(--gold);
}
.task-row.done .task-checkbox::after {
  content: '✓'; color: #15171a; font-weight: 700; font-size: 13px;
}
.task-row.done { opacity: 0.45; }
.task-row.done .task-text { text-decoration: line-through; }
.task-text {
  flex: 1;
  font-size: 14px; line-height: 1.4;
  color: var(--white);
  word-wrap: break-word;
}
.task-meta {
  font-size: 10px;
  color: var(--gray);
  margin-top: 3px;
  letter-spacing: 0.02em;
}
/* ── Projects tab — numbered, color-coded, link tracker ─────────────── */
.proj-hint { color: var(--gray); font-size: 12px; margin: 6px 0 18px; line-height: 1.5; }
.proj-hint code { background: var(--navy-mid); padding: 1px 5px; border-radius: 3px; font-size: 11px; color: var(--gold); }
.proj-group { margin: 22px 0 14px; }
.proj-group h3 {
  font-size: 13px; font-weight: 600; color: var(--gold); margin: 0 0 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255,167,38,0.12); padding-bottom: 5px;
}
.proj-list { list-style: none; padding: 0; margin: 0; counter-reset: proj; }
.proj-list li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px; line-height: 1.45; color: #d4d6da;
}
.proj-list li:last-child { border-bottom: none; }
.proj-list li::before {
  content: counter(proj, decimal) ".";
  counter-increment: proj;
  color: var(--gray-dim); font-variant-numeric: tabular-nums;
  min-width: 26px; font-size: 11px; padding-top: 3px; text-align: right;
}
/* respect <ol start="N"> by reading the start attribute */
.proj-list[start="8"] { counter-reset: proj 7; }
.proj-list[start="12"] { counter-reset: proj 11; }
.proj-list[start="16"] { counter-reset: proj 15; }
.proj-list[start="21"] { counter-reset: proj 20; }
.proj-list[start="31"] { counter-reset: proj 30; }
.proj-list[start="35"] { counter-reset: proj 34; }
.proj-list[start="42"] { counter-reset: proj 41; }
.proj-list[start="60"] { counter-reset: proj 59; }
.proj-list li a {
  color: var(--gold); text-decoration: none; font-weight: 500;
  border-bottom: 1px dotted rgba(255,167,38,0.3);
}
.proj-list li a:hover { color: #ffc04d; border-bottom-style: solid; }
.proj-list li code {
  background: var(--navy-mid); padding: 1px 5px; border-radius: 3px;
  font-size: 11px; color: var(--gold);
}
.proj-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px; box-shadow: 0 0 6px currentColor;
}
.proj-dot.ok   { background: var(--green); color: var(--green); }
.proj-dot.warn { background: var(--gold);  color: var(--gold);  }
.proj-dot.bad  { background: var(--red);   color: var(--red);   }
.proj-dot.pre  { background: #5b8def;      color: #5b8def;      }
.proj-dot.dor  { background: var(--gray-dim); color: var(--gray-dim); box-shadow: none; }
.proj-summary {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 24px; padding: 12px 14px; border-radius: 8px;
  background: var(--navy-light); border: 1px solid rgba(255,167,38,0.1);
  font-size: 12px; color: var(--gray);
}
.proj-summary > div { display: flex; align-items: center; gap: 6px; }
@media (max-width: 500px) {
  .proj-list li { font-size: 12px; gap: 7px; padding: 6px 2px; }
  .proj-list li::before { min-width: 22px; font-size: 10px; }
  .proj-group h3 { font-size: 11px; }
}

.birdeye-hint {
  font-size: 11px;
  color: var(--gray);
  padding: 7px 10px;
  background: rgba(255,68,84,0.10);
  border-radius: 8px;
  border-left: 2.5px solid #ff5a6f;
  margin: -2px 0 10px;
  line-height: 1.4;
}
.birdeye-banner {
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(255,167,38,0.08) 0%, transparent 30%),
    linear-gradient(180deg, rgba(255,90,111,0.12) 0%, rgba(255,90,111,0.04) 100%);
  border: 1px solid rgba(255,90,111,0.35);
  border-radius: 12px;
  margin: 8px 0 12px;
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
}
.birdeye-banner .be-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #ff8090;
  margin-bottom: 8px;
}
.birdeye-banner .be-head .be-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff5a6f; box-shadow: 0 0 12px rgba(255,90,111,0.70);
  animation: tonightPulse 2.2s ease-in-out infinite;
}
.birdeye-banner .be-when {
  margin-left: auto; font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--gray);
  text-transform: none; font-weight: 500;
}
.birdeye-banner h1, .birdeye-banner h2, .birdeye-banner h3 {
  font-size: 14px; margin: 6px 0 4px; letter-spacing: -0.01em;
  color: var(--white);
}
.birdeye-banner ol, .birdeye-banner ul { padding-left: 22px; margin: 4px 0; }
.birdeye-banner li { margin: 2px 0; }
.task-cb-btn {
  background: rgba(255,90,111,0.16);
  border: 1px solid rgba(255,90,111,0.40);
  color: #ff8090;
}
.task-cb-btn:hover { background: rgba(255,90,111,0.28); }
.task-cb-review {
  background: rgba(255,90,111,0.08);
  border-left-color: #ff5a6f;
  color: var(--white);
}
.task-cb-review .cb-tag { color: #ff8090; }
.task-cb-btn {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(168,51,68,0.12);
  border: 1px solid rgba(168,51,68,0.30);
  color: #a83344;
  font: 700 10px inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  align-self: flex-start; margin-top: 2px;
  transition: all 0.15s var(--ease-out);
}
.task-cb-btn:hover { background: rgba(168,51,68,0.22); }
.task-cb-btn:active { transform: scale(0.90); }
.task-cb-btn.loading { opacity: 0.5; pointer-events: none; }
.task-cb-review {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(168,51,68,0.06);
  border-left: 2px solid #a83344;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  line-height: 1.4;
  color: #2a1808;
}
.task-cb-review .cb-tag {
  display: block;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a83344;
  margin-bottom: 4px;
}

/* ── CHAT tab: gang-chat room ─────────────────────────────── */
.chat-card { display: flex; flex-direction: column; min-height: 60vh; }
.chat-presence {
  font-size: 11px;
  color: var(--gold);
  background: rgba(212,168,67,0.12);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.chat-hint {
  font-size: 11px;
  color: var(--gray-dim);
  margin: -4px 0 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  border-left: 2px solid var(--gold);
}
.chat-stream { display: flex; flex-direction: column; gap: 10px; }
.chat-msg {
  display: flex; gap: 10px; align-items: flex-start;
  animation: chatIn 0.18s var(--ease-out);
}
.chat-msg.me { flex-direction: row-reverse; }
/* R23: Consecutive same-agent grouping — tighten vertical rhythm.
   Per SilverFox info-density review: compress runs of messages from same sender. */
.chat-msg.grouped { margin-top: -6px; }
.chat-msg.grouped .av { visibility: hidden; }
.chat-msg.grouped .who { display: none; }
.chat-msg.grouped .bubble { border-top-left-radius: 6px; }
.chat-msg.me.grouped .bubble { border-top-right-radius: 6px; border-top-left-radius: 14px; }
.chat-msg .av {
  flex-shrink: 0; width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.chat-msg .av.GoldEagle     { background: linear-gradient(135deg, #d4a843, #8c6e1c); }
.chat-msg .av.SilverFox     { background: linear-gradient(135deg, #c0c5ce, #6a6e74); color: #1a1c20; }
.chat-msg .av.CrimsonBadger { background: linear-gradient(135deg, #a83344, #5a1c25); }
.chat-msg .av.SapphireCove  { background: linear-gradient(135deg, #3b6db8, #1a3a6e); }
.chat-msg .av.me            { background: linear-gradient(135deg, #5a8a4a, #2f4a25); }
.chat-msg .bubble {
  max-width: 78%;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--white);
  word-wrap: break-word;
}
.chat-msg.me .bubble {
  background: linear-gradient(135deg, rgba(212,168,67,0.18), rgba(212,168,67,0.08));
  border-color: rgba(212,168,67,0.25);
}
.chat-msg .who {
  font-size: 10px;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 3px;
}
.chat-msg.me .who { text-align: right; color: var(--gold); }
.chat-msg .when { font-size: 10px; color: var(--gray-dim); margin-top: 4px; }
.chat-msg.me .when { text-align: right; }
/* 2026-05-29 FIX (GE): on narrow (mobile) viewports the unnamed message content-column
   had no width constraint and the bubble's max-width:78% resolved against that collapsing
   box → bubbles squeezed to ~1 char wide ("Hi" rendered as "H"/"i" stacked vertically).
   Constrain the COLUMN to 78% of the row (a stable reference) and size the bubble to its
   text via fit-content, so short messages stay compact and long ones wrap at 78%. */
.chat-msg > div:not(.av) {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 78%;
}
.chat-msg.me > div:not(.av) { align-items: flex-end; }
.chat-msg .bubble { max-width: 100%; width: fit-content; }
.chat-msg.me .bubble { margin-left: auto; }
@keyframes chatIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Per-agent typing dots in chat tab */
.chat-msg.chat-typing .bubble.typing {
  display: inline-flex; gap: 4px; padding: 10px 14px;
  background: rgba(255,255,255,0.04);
}
.chat-msg.chat-typing .bubble.typing .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray);
  animation: typingDot 1.2s infinite ease-in-out;
}
.chat-msg.chat-typing .bubble.typing .dot:nth-child(2) { animation-delay: 0.15s; }
.chat-msg.chat-typing .bubble.typing .dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
/* R-PROD-2: pulse for auth beta badge */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ═════════════════════════════════════════════════════════════════════════
   V3 (My Flight Deck) — Approval Tray + send-lock badge.
   Wood + amber + navy preserved. Lock = amber LED. Tray cards = console strips.
   ═════════════════════════════════════════════════════════════════════════ */
.lock-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255,167,38,0.18) 0%, rgba(255,167,38,0.08) 100%);
  color: var(--gold);
  border: 0.5px solid rgba(255,167,38,0.35);
  text-shadow: 0 0 8px var(--gold-glow);
  vertical-align: middle;
  margin-left: 4px;
  user-select: none;
  -webkit-user-select: none;
}
.tray-card { padding: 0; }
.tray-card > h2 {
  display: flex; align-items: center; gap: 8px;
  padding: var(--pad-tight) var(--pad);
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.tray-lock-banner {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: var(--r-pill);
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border: 0.5px solid rgba(239,68,68,0.35);
  margin-left: auto;
}
.tray-stats {
  display: flex; gap: var(--pad);
  padding: var(--pad-tight) var(--pad);
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
}
.tray-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.tray-stat-num { font-size: 18px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1; }
.tray-stat-lbl { font-size: 10px; color: var(--gray-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.tray-cards { padding: var(--pad-tight); display: flex; flex-direction: column; gap: var(--pad-tight); }
.tray-empty { text-align: center; padding: 48px var(--pad); color: var(--gray-dim); }
.tray-empty-icon { font-size: 36px; opacity: 0.5; margin-bottom: 12px; }
.tray-empty-title { font-size: 15px; font-weight: 600; color: var(--gray); margin-bottom: 6px; }
.tray-empty-sub { font-size: 12px; line-height: 1.5; color: var(--gray-dim); }
.tray-card-item {
  background: var(--navy-card);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: var(--r-card);
  padding: var(--pad-tight);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 120ms var(--ease-out), background 120ms var(--ease-out);
}
.tray-card-item:hover { background: var(--navy-mid); border-color: rgba(255,167,38,0.18); }
.tray-card-item.status-approved { border-color: rgba(74,222,128,0.4); }
.tray-card-item.status-exported { border-color: rgba(74,222,128,0.2); opacity: 0.7; }
.tray-card-item.status-deleted { display: none; }
.tray-card-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tray-card-status {
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: var(--r-pill);
  background: rgba(239,68,68,0.12); color: var(--red);
  border: 0.5px solid rgba(239,68,68,0.3);
  text-transform: uppercase;
}
.tray-card-status.s-approved { background: rgba(74,222,128,0.15); color: var(--green); border-color: rgba(74,222,128,0.3); }
.tray-card-status.s-exported { background: rgba(74,222,128,0.08); color: rgba(74,222,128,0.6); }
.tray-card-routing {
  display: inline-flex; gap: 4px; font-size: 10px; color: var(--gray-dim);
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.tray-card-routing .tag {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid rgba(255,255,255,0.08);
  padding: 1px 5px; border-radius: 3px;
}
.tray-card-source {
  font-size: 10px; color: var(--gray-dim);
  margin-left: auto;
}
.tray-card-title { font-size: 14px; font-weight: 600; color: var(--white); }
.tray-card-body { font-size: 12px; color: var(--gray); line-height: 1.45; max-height: 6em; overflow: hidden; }
.tray-card-actions { display: flex; gap: 6px; margin-top: 4px; }
.tray-card-actions button {
  font: 11px 'Inter', sans-serif; font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--gray);
  border: 0.5px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.tray-card-actions button:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.tray-card-actions .btn-approve {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--navy);
  border-color: var(--gold-dim);
  font-weight: 700;
}
.tray-card-actions .btn-approve:hover { box-shadow: 0 0 12px var(--gold-glow); color: var(--navy); }

/* Team-Loop brick #2: inline reply box on email Tray cards */
.reply-box { margin-top: 8px; border-top: 0.5px solid rgba(255,255,255,0.08); padding-top: 8px; }
.reply-ta {
  width: 100%; box-sizing: border-box; background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 9px 11px;
  color: var(--white); font: 13px inherit; line-height: 1.4; resize: vertical; min-height: 52px;
}
.reply-ta:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.reply-actions { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.reply-actions button { padding: 8px 12px; border: 0; border-radius: 999px; font: 12px inherit; font-weight: 600; cursor: pointer; }
.reply-actions .reply-draft { background: rgba(255,255,255,0.07); color: var(--white); }
.reply-actions .reply-send { background: var(--gold); color: var(--navy); font-weight: 700; margin-left: auto; }
.reply-actions .reply-send:active { transform: scale(0.96); }

/* ── V3 Day 4-9: Tray modals (Stage, Approve, CSV) ── */
.ts-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.ts-row label { font-size: 11px; color: var(--gray-dim); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.ts-row input[type="text"],
.ts-row input[type="file"],
.ts-row textarea,
.ts-select {
  background: rgba(255,255,255,0.04);
  color: var(--white);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 12px;
  font: 14px 'Inter', sans-serif;
  -webkit-appearance: none;
  resize: vertical;
}
.ts-row input:focus, .ts-row textarea:focus, .ts-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.ts-routing-row { padding: 8px 0; }
.ts-routing-col { display: flex; flex-direction: column; gap: 6px; }
.ts-pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-pill {
  background: rgba(255,255,255,0.04);
  color: var(--gray);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font: 600 12px 'Inter', sans-serif;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.ts-pill:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.ts-pill.active {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--navy);
  border-color: var(--gold-dim);
}
.ts-meta { font-size: 11px; color: var(--gray-dim); font-style: italic; padding: 6px 0; }
.ts-err { color: var(--red); font-size: 12px; padding: 8px 0; min-height: 18px; }
.ts-lock-banner {
  background: rgba(239,68,68,0.08);
  border: 0.5px solid rgba(239,68,68,0.2);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--red);
  text-align: center;
  margin-top: 12px;
}

/* Approve modal preview + checklist */
.ta-card-preview {
  background: var(--navy-card);
  border: 0.5px solid rgba(255,255,255,0.08);
  border-radius: var(--r-card);
  padding: 12px;
  margin-bottom: 16px;
}
.ta-card-title { font-size: 14px; font-weight: 600; color: var(--white); margin-bottom: 6px; }
.ta-card-body { font-size: 12px; color: var(--gray); line-height: 1.45; margin-bottom: 8px; max-height: 8em; overflow: hidden; }
.ta-card-routing { font-size: 11px; color: var(--gray-dim); display: flex; gap: 6px; }
.ta-checklist { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.ta-check {
  display: flex; gap: 10px;
  font-size: 13px; color: var(--gray);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 0.5px solid rgba(255,255,255,0.04);
}
.ta-check:hover { background: rgba(255,255,255,0.05); }
.ta-check input[type="checkbox"] { accent-color: var(--gold); }
.ta-check strong { color: var(--white); }

/* CSV upload */
.csv-cols {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--gray);
  background: rgba(255,255,255,0.03);
  padding: 8px 10px;
  border-radius: 6px;
  max-height: 80px;
  overflow-y: auto;
}
.csv-stats { font-size: 11px; color: var(--gray-dim); padding: 6px 0; }

/* Send to Tray button on agent reply bubbles */
.bubble-actions {
  display: flex; gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.bubble-action-btn {
  background: rgba(255,167,38,0.08);
  color: var(--gold);
  border: 0.5px solid rgba(255,167,38,0.25);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  font: 600 10px 'Inter', sans-serif;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.bubble-action-btn:hover { background: rgba(255,167,38,0.2); box-shadow: 0 0 8px var(--gold-glow); }

/* ── 2026-05-29 (GE): iMessage-style chat polish ─────────────────────────────
   Rotem: "make the chat like iphone chat — it's still clumsy." Tighter rhythm,
   rounder bubbles with a tail, no own-avatar, quieter sender labels, and a much
   subtler Send-to-Tray button (it was the main visual clutter). */
.chat-stream { gap: 3px; }
.chat-msg { align-items: flex-end; }
.chat-msg.me .av { display: none; }                 /* iMessage: no own avatar */
.chat-msg .bubble { border-radius: 18px; padding: 7px 13px; line-height: 1.35; font-size: 15px; }
.chat-msg:not(.me) .bubble { border-bottom-left-radius: 6px; }   /* received tail */
.chat-msg.me .bubble { border-bottom-right-radius: 6px; }        /* sent tail */
.chat-msg .who { font-size: 9px; opacity: 0.5; margin-bottom: 2px; }
.chat-msg .when { opacity: 0.55; }
.bubble-actions { margin-top: 3px; opacity: 0.35; transition: opacity 140ms var(--ease-out); }
.chat-msg:hover .bubble-actions, .bubble-actions:focus-within { opacity: 1; }
.bubble-action-btn { padding: 2px 9px; font-size: 9.5px; background: transparent; border-color: rgba(255,167,38,0.18); }

/* Tray header "+ Stage" / "Upload CSV" controls */
.tray-header-actions {
  display: flex; gap: 6px;
  padding: 8px var(--pad-tight);
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.tray-header-actions button {
  background: rgba(255,255,255,0.04);
  color: var(--gray);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 12px;
  font: 600 11px 'Inter', sans-serif;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.tray-header-actions button:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.tray-header-actions button.primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--navy);
  border-color: var(--gold-dim);
}
.tray-header-actions button.primary:hover { box-shadow: 0 0 10px var(--gold-glow); color: var(--navy); }

/* ── V3.5 graduation-gate widget ── */
.gate-widget {
  background: linear-gradient(180deg, rgba(255,167,38,0.05) 0%, rgba(255,167,38,0.02) 100%);
  border-top: 0.5px solid rgba(255,167,38,0.2);
  border-bottom: 0.5px solid rgba(255,255,255,0.04);
  padding: var(--pad-tight) var(--pad);
}
.gate-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gate-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--gold); }
.gate-status { font-size: 11px; font-weight: 700; color: var(--gray); font-variant-numeric: tabular-nums; }
.gate-status.pass { color: var(--green); }
.gate-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.gate-stat {
  background: rgba(255,255,255,0.03);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
}
.gate-stat.pass { background: rgba(74,222,128,0.06); border-color: rgba(74,222,128,0.25); }
.gate-num { font-size: 16px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; line-height: 1; }
.gate-stat.pass .gate-num { color: var(--green); }
.gate-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-dim); }
.gate-thresh { font-size: 9px; color: var(--gold); font-variant-numeric: tabular-nums; }
.gate-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.gate-actions button {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.04);
  color: var(--gray);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 8px;
  font: 600 10px 'Inter', sans-serif;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gate-actions button:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ── V3.5: "My active projects" — dynamic Projects view ── */
.mine-card h2 { display: flex; align-items: center; gap: 8px; }
.mine-actions { display: flex; gap: 6px; padding: 8px var(--pad-tight); flex-wrap: wrap; }
.mine-btn {
  background: rgba(255,255,255,0.04);
  color: var(--gray);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 6px 12px;
  font: 600 11px 'Inter', sans-serif;
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.mine-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.mine-btn.primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--navy); border-color: var(--gold-dim); font-weight: 700;
}
.mine-projects {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px var(--pad-tight);
}
.mine-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--navy-card);
  border: 0.5px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  transition: background 120ms var(--ease-out), border-color 120ms var(--ease-out);
}
.mine-row:hover { background: var(--navy-mid); border-color: rgba(255,167,38,0.18); }
.mine-rank {
  flex: 0 0 28px;
  font-variant-numeric: tabular-nums;
  color: var(--gray-dim);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
}
.mine-dot {
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 12px;
  line-height: 1;
}
.mine-dot.starred { color: var(--gold); }
.mine-dot.live { color: var(--blue); }
.mine-dot.in_progress { color: var(--gray); }
.mine-dot.queued { color: var(--gray-dim); }
.mine-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--white);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mine-title a { color: var(--white); text-decoration: none; }
.mine-title a:hover { color: var(--gold); text-decoration: underline; }
.mine-actions-row { display: flex; gap: 4px; }
.mine-actions-row button {
  background: transparent;
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 4px 8px;
  font: 600 10px 'Inter', sans-serif;
  color: var(--gray-dim);
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}
.mine-actions-row button:hover { color: var(--gold); border-color: rgba(255,167,38,0.3); }
.mine-empty {
  text-align: center; padding: 32px var(--pad);
  color: var(--gray-dim); font-size: 12px;
}
/* ═══════════════════════════════════════════════════════════════════════════
   2026 VISUAL REFRESH (GE) — Rotem: "site feels old, not fresh — kick up visuals."
   Sheds the skeuomorphic wood / brushed-metal "console" look for clean frosted
   glass, deeper neutral surfaces, hairline borders, and one punchy gold accent.
   Appended last so it wins by source order.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Cards → frosted glass, hairline light border, soft modern shadow */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.018));
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.07);
  border-top-color: rgba(255,255,255,0.11);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 30px rgba(0,0,0,0.38);
}
@media (hover: hover) {
  .card:hover {
    transform: translateY(-1px);
    border-color: rgba(255,167,38,0.22);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 16px 44px rgba(0,0,0,0.46);
  }
}

/* Nav rail → frosted glass (no brushed metal); gold pill under the active tab */
.tabbar {
  background: linear-gradient(180deg, rgba(22,24,29,0.82), rgba(15,16,20,0.64));
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.42);
  box-shadow: 0 6px 22px rgba(0,0,0,0.30);
}
.tabbar .tab { position: relative; transition: color 0.18s var(--ease-out); }
.tabbar .tab.active { color: var(--gold); }
.tabbar .tab.active::after {
  content: ''; position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 999px;
  background: var(--gold); box-shadow: 0 0 10px var(--gold-glow);
}

/* Composer → matching frosted glass */
.composer {
  background: linear-gradient(180deg, rgba(22,24,29,0.80), rgba(13,14,18,0.66));
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.composer.chat-mode { box-shadow: 0 -8px 28px rgba(0,0,0,0.42); }

/* Message input → glassy pill with a gold focus ring */
#composeText {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 22px;
  color: var(--white);
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}
#composeText::placeholder { color: rgba(240,238,232,0.40); }
#composeText:focus {
  outline: none;
  border-color: rgba(255,167,38,0.45);
  box-shadow: 0 0 0 3px rgba(255,167,38,0.10);
}

/* Send button → the one hero accent: vibrant gold + glow */
.composer button.send {
  background: linear-gradient(135deg, #ffc266, #f2920a);
  color: #1a1206;
  box-shadow: 0 4px 16px rgba(255,167,38,0.36), inset 0 1px 0 rgba(255,255,255,0.35);
}
.composer button.send:hover { box-shadow: 0 6px 22px rgba(255,167,38,0.48), inset 0 1px 0 rgba(255,255,255,0.4); }

/* Ghost circular buttons (mic / email) → clean glass, not metal */
.composer button.icon-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.composer button.mic.recording { background: rgba(239,68,68,0.22); border-color: rgba(239,68,68,0.5); }

/* Pills / chips → quieter, cleaner */
.connection-pill { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.07); }

/* Brick #3 (2026-06-04): always-on ingest dot — is email→REC flowing even when REC is closed? */
.ingest-pill {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 3px; font-size: 11px; line-height: 1; color: rgba(255,255,255,0.55);
  letter-spacing: 0.01em; user-select: none;
}
.ingest-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: #6b7280; transition: background 0.3s ease, box-shadow 0.3s ease;
}
.ingest-dot.green { background: var(--green, #4ade80); box-shadow: 0 0 6px rgba(74,222,128,0.7); animation: ingestPulse 2.4s ease-in-out infinite; }
.ingest-dot.amber { background: var(--gold, #ffa726); box-shadow: 0 0 5px rgba(255,167,38,0.6); }
.ingest-dot.gray  { background: #6b7280; box-shadow: none; }
@keyframes ingestPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(74,222,128,0.55); }
  50%      { box-shadow: 0 0 9px rgba(74,222,128,0.95); }
}

/* Ask Gemini sheet (2026-06-05): drop an image, ask Gemini about it — moved into REC */
.ag-drop { display:flex; align-items:center; justify-content:center; min-height:150px; border:1.5px dashed rgba(255,255,255,0.18); border-radius:14px; cursor:pointer; padding:14px; transition:border-color .2s, background .2s; }
.ag-drop.dragover { border-color: var(--gold); background: rgba(255,167,38,0.06); }
.ag-drop-hint { text-align:center; color: rgba(255,255,255,0.5); font-size:13px; line-height:1.5; }
.ag-drop-icon { font-size:30px; margin-bottom:6px; }
.ag-preview { max-width:100%; max-height:300px; border-radius:10px; display:block; }
.ag-models { display:flex; gap:8px; margin:12px 0 4px; }
.ag-model { flex:1; padding:8px; border-radius:9px; border:1px solid rgba(255,255,255,0.1); background:rgba(255,255,255,0.04); color:rgba(255,255,255,0.7); font-size:13px; cursor:pointer; }
.ag-model.active { border-color: var(--gold); color: var(--gold); background: rgba(255,167,38,0.08); }
.ag-thread { display:flex; flex-direction:column; gap:12px; margin:12px 0; max-height:42vh; overflow-y:auto; }
.ag-turn { font-size:14px; line-height:1.55; }
.ag-turn .ag-q { color: var(--gold); font-weight:600; margin-bottom:3px; }
.ag-turn .ag-a { color: #e8e8ea; white-space:pre-wrap; }
.ag-turn.thinking .ag-a { color: rgba(255,255,255,0.4); font-style:italic; }
.ag-ask-row { display:flex; gap:8px; align-items:flex-end; }
.ag-ask-row textarea { flex:1; resize:none; border-radius:10px; border:1px solid rgba(255,255,255,0.1); background:rgba(255,255,255,0.05); color:#e8e8ea; padding:9px 11px; font-size:14px; font-family:inherit; }
.ag-send { padding:9px 16px; border-radius:10px; border:none; background:linear-gradient(135deg,#ffb74d,#ff9800); color:#1a1205; font-weight:700; font-size:14px; cursor:pointer; white-space:nowrap; }
.ag-send:disabled { opacity:0.5; cursor:default; }
.ag-err { color: var(--red); font-size:12px; margin-top:8px; min-height:1em; }
