/* Mr. Better Boss — logged-in experience
   near-black navy #0A0A0F · violet #5D47FA · green #00E96B · gold #FFD700 · cyan #00D4FF
   Display: Anton · Body: DM Sans · Numbers: JetBrains Mono
   Semantic color: money = green · late/overdue = gold · going cold = cyan ·
   brand/interactive = violet · errors = red */

:root {
  --bg: #0A0A0F;
  --bg-2: #0D0D15;
  --surface: #13131B;
  --surface-2: #1A1A24;
  --input-bg: rgba(26, 26, 33, 0.8);
  --border: #26262E;
  --border-soft: rgba(255, 255, 255, 0.08);
  --text: #F4F4F9;
  --muted: #9BA0AE;
  --faint: #5C6170;
  --violet: #5D47FA;
  --violet-deep: #4633D6;
  --violet-soft: rgba(93, 71, 250, 0.14);
  --violet-glow: rgba(93, 71, 250, 0.45);
  --green: #00E96B;
  --green-dim: rgba(0, 233, 107, 0.12);
  --gold: #FFD700;
  --gold-dim: rgba(255, 215, 0, 0.1);
  --cyan: #00D4FF;
  --cyan-dim: rgba(0, 212, 255, 0.1);
  --red: #FF5D6C;
  --red-dim: rgba(255, 93, 108, 0.1);
  --radius: 18px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --r-xs: 8px; --r-sm: 12px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  --ease: cubic-bezier(0.2, 0.7, 0.25, 1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-body: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.55;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- Aurora background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora i {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: drift 28s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(93, 71, 250, 0.22), transparent 70%);
  top: -180px; left: -140px;
}
.aurora i:nth-child(2) {
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(0, 233, 107, 0.09), transparent 70%);
  bottom: -160px; right: -120px;
  animation-delay: -9s;
}
.aurora i:nth-child(3) {
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(0, 110, 255, 0.12), transparent 70%);
  top: 38%; left: 52%;
  animation-delay: -18s;
}
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(70px, 46px) scale(1.14); }
}

/* ---------- Motion system ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes stagger-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 34px rgba(93, 71, 250, 0.32), 0 24px 60px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 64px rgba(93, 71, 250, 0.6), 0 24px 60px rgba(0, 0, 0, 0.5); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes word-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}
@keyframes shimmer-sweep {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.enter { animation: pop-in 0.32s var(--ease) both; }
.msg.enter { animation: rise 0.28s var(--ease) both; }
.fade { animation: fade-in 0.25s var(--ease) both; }

/* ---------- Login (polished — do not restyle) ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(19, 19, 24, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: 40px 36px 36px;
  box-shadow: var(--shadow), 0 0 60px rgba(93, 71, 250, 0.08);
}
.login-hero {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin: 0 auto 20px;
  border: 3px solid var(--violet);
  box-shadow: 0 0 32px var(--violet-glow);
  animation: floaty 6s ease-in-out infinite;
}
.login-hero.small { width: 84px; height: 84px; }
.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.brand span {
  font-family: var(--font-display);
  font-size: 34px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.brand-bolt { width: 28px; height: 28px; color: var(--violet); }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo-pill {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border-radius: var(--r-pill);
  padding: 8px 22px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 28px rgba(93, 71, 250, 0.28);
  transition: transform 0.18s var(--ease), box-shadow 0.22s var(--ease);
}
.brand-logo-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 36px rgba(93, 71, 250, 0.4);
}
.brand-logo-pill .brand-logo { height: 28px; }
.brand-logo-pill.small { padding: 5px 14px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }
.brand-logo-pill.small .brand-logo { height: 18px; }
.brand-logo-pill.small:hover { transform: none; }
.brand.product { margin-top: 14px; }
.brand.product span { font-size: 30px; }
.brand-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--violet);
  flex: none;
}
.brand.small { justify-content: flex-start; }
.brand.small span { font-size: 18px; white-space: nowrap; }
.brand.small .brand-bolt { width: 18px; height: 18px; }
.brand.small .brand-logo { height: 20px; }
.login-sub {
  text-align: center;
  color: var(--muted);
  margin: 10px 0 24px;
  font-size: 14px;
}
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
}
input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
input:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}
.form-error {
  background: rgba(255, 70, 70, 0.12);
  border: 1px solid rgba(255, 70, 70, 0.4);
  color: #ff9a9a;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  margin-bottom: 6px;
  animation: rise 0.25s var(--ease) both;
}
.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #5D47FA, #7a63ff);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px var(--violet-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0) scale(0.97); box-shadow: 0 2px 10px var(--violet-glow); }
.btn-primary:disabled { opacity: 0.6; cursor: default; transform: none; }
.login-features {
  margin-top: 26px;
  display: grid;
  gap: 10px;
}
.login-features div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
}
.login-features svg { width: 16px; height: 16px; color: var(--green); flex: none; }

/* ---------- App shell ---------- */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: fade-in 0.3s var(--ease) both;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background:
    radial-gradient(1200px 400px at 50% -80px, rgba(93, 71, 250, 0.07), transparent 70%),
    transparent;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: rgba(11, 11, 17, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  z-index: 40;
  height: 100dvh;
}

.sidebar-head {
  padding: 18px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-lockup .brand-avatar {
  width: 44px;
  height: 44px;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.1;
}
.brand-tag {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--violet), #7a63ff);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.btn-new:hover { filter: brightness(1.08); box-shadow: 0 4px 20px var(--violet-glow); }
.btn-new:active { transform: scale(0.98); }

.side-block {
  padding: 14px 16px 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 0; /* never collapse into the nav below */
  margin-bottom: 10px; /* air between workspace pill and nav */
  position: relative;
  z-index: 2;
}
.side-block.grow { flex: 1; padding-bottom: 8px; overflow: hidden; /* clip conv list inside its own lane */ }
.side-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

/* org switcher */
.org-switch { position: relative; }
.org-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
  min-height: 44px;
}
.org-pill:hover { border-color: rgba(93, 71, 250, 0.5); background: rgba(93, 71, 250, 0.07); }
.org-pill svg { margin-left: auto; color: var(--faint); flex: none; }
.org-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  flex: none;
  animation: pulse-dot 2.6s ease-in-out infinite;
}
.org-pill #org-name, .org-pill #org-name-mobile {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
  animation: pop-in 0.18s var(--ease) both;
}
.org-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
}
.org-item:hover { background: rgba(93, 71, 250, 0.1); }
.org-item.active { color: var(--green); font-weight: 700; }

/* vertical nav: icon + full label, grouped, never truncated */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 12px 12px;
  overflow-y: auto;
  flex: none;
  scrollbar-width: thin;
  position: relative;
  z-index: 1;
}
.side-nav-group { display: flex; flex-direction: column; gap: 2px; }
.side-nav-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 12px 12px 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--r-md);
  background: none;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: 0.8; }
.nav-item .nav-label { flex: 1; white-space: nowrap; }
.nav-item:hover { background: rgba(127, 127, 160, 0.12); color: var(--text); }
.nav-item.active { background: var(--violet); color: #fff; box-shadow: 0 2px 12px var(--violet-glow); }
.nav-item.active svg { opacity: 1; color: #fff; }
.nav-item .tab-dot { margin-left: auto; }

/* conversation search */
.conv-search {
  position: relative;
  margin-bottom: 10px;
}
.conv-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}
.conv-search input {
  padding-left: 36px;
  font-size: 13.5px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  min-height: 40px;
}

/* conversation list */
.conv-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}
.conv-group-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 6px 6px;
}
.conv-item {
  padding: 11px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all 0.15s var(--ease);
  min-height: 42px;
  display: flex;
  align-items: center;
}
.conv-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.conv-item.active {
  background: var(--violet-soft);
  border-color: rgba(93, 71, 250, 0.35);
  color: var(--text);
  font-weight: 600;
}
.conv-empty {
  padding: 26px 12px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
  line-height: 1.6;
}
.conv-empty-icon {
  font-size: 26px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 12px rgba(93, 71, 250, 0.6));
}
.conv-empty strong { color: var(--muted); font-size: 13.5px; }
.conv-empty-sub { font-size: 12px; margin-top: 2px; }

/* sidebar footer */
.sidebar-foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-soft);
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
}
.user-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.user-meta { flex: 1; min-width: 0; }
.user-line {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-plan {
  font-size: 11px;
  color: var(--faint);
}
.btn-link {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  flex: none;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }

/* ---------- Mobile topbar ---------- */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 30;
}
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  flex: none;
}
.icon-btn:active { transform: scale(0.94); }
.org-pill.mobile {
  width: auto;
  margin-left: auto;
  padding: 8px 12px;
  font-size: 12.5px;
  min-height: 40px;
}

/* ---------- Desktop thread header ---------- */
.thread-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 28px 8px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  flex: none;
}
.th-ws {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse-dot 2.2s ease-in-out infinite;
  flex: none;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.82); }
}
.th-ws::after {
  content: "LIVE";
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--green);
  border: 1px solid rgba(0, 233, 107, 0.35);
  border-radius: var(--r-pill);
  padding: 2px 8px;
}
.th-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* ---------- Thread ---------- */
.thread {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 28px 24px;
  scroll-behavior: smooth;
}
.thread-inner, .msg, .welcome { max-width: 860px; margin-left: auto; margin-right: auto; }
.msg { margin-left: auto; margin-right: auto; }

/* ---------- Welcome state ---------- */
.welcome {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 4px 28px;
  text-align: center;
  animation: fade-in 0.4s var(--ease) both;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.welcome-stage {
  position: relative;
  display: inline-block;
  margin: 0 auto 4px;
}
.welcome-video {
  width: min(320px, 72vw);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-xl);
  border: 1px solid rgba(93, 71, 250, 0.4);
  box-shadow: 0 0 60px rgba(93, 71, 250, 0.28), 0 24px 60px rgba(0, 0, 0, 0.5);
  display: block;
  animation: breathe 5s ease-in-out infinite;
}
img.welcome-video { animation: floaty 6s ease-in-out infinite; }
.welcome-stage.small .welcome-video { width: 120px; }
.welcome-avatar {
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--violet), 0 8px 24px rgba(0, 0, 0, 0.5);
}
.welcome-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
}
.welcome-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2.2s ease-in-out infinite;
}
.welcome-pulse {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--green);
  margin: 10px 0 0;
  min-height: 18px;
}
.welcome h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 52px);
  line-height: 1.02;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 10px;
  font-weight: 400;
}
.welcome h2 .accent, .welcome h2 .accent-gold {
  color: var(--violet);
  text-shadow: 0 0 34px var(--violet-glow);
}
.welcome > p {
  color: var(--muted);
  font-size: 15.5px;
  max-width: 480px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* short viewports: the whole welcome must fit without scrolling */
@media (max-height: 740px) {
  .welcome { padding: 12px 4px 16px; }
  .welcome-video { width: min(230px, 56vw); }
  .welcome-kicker { margin: 10px 0 6px; font-size: 10.5px; }
  .welcome h2 { font-size: clamp(28px, 4.2vw, 40px); margin-bottom: 8px; }
  .welcome > p { font-size: 14px; margin-bottom: 14px; }
  .chips { gap: 8px; }
  .chip { padding: 11px 13px; }
}

/* suggestion cards */
.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}
.chip {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 15px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.2s var(--ease);
  animation: stagger-in 0.4s var(--ease) both;
  min-height: 44px;
}
.chip:hover {
  transform: translateY(-2px);
  border-color: rgba(93, 71, 250, 0.55);
  background: rgba(93, 71, 250, 0.07);
  box-shadow: 0 8px 28px rgba(93, 71, 250, 0.18);
}
.chip:active { transform: translateY(0) scale(0.99); }
.chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--violet-soft);
  color: var(--violet);
  flex: none;
}
.chip:nth-child(2) .chip-icon { background: var(--gold-dim); color: var(--gold); }
.chip:nth-child(3) .chip-icon { background: var(--cyan-dim); color: var(--cyan); }
.chip:nth-child(4) .chip-icon { background: var(--green-dim); color: var(--green); }
.chip-icon svg { width: 19px; height: 19px; }
.chip-text { min-width: 0; }
.chip-label { display: block; font-size: 14.5px; font-weight: 700; }
.chip-desc { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* ---------- Messages ---------- */
.msg {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  max-width: 860px;
}
.msg + .msg { margin-top: 2px; }

.msg-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--violet);
  flex: none;
  margin-top: 2px;
}
.msg-avatar.alive, .brand-avatar.alive { animation: breathe 5.5s ease-in-out infinite; }
img.alive { animation: breathe 5.5s ease-in-out infinite; }

/* pending-state avatar ring */
.avatar-live { position: relative; flex: none; margin-top: 2px; }
.avatar-live .msg-avatar { animation: breathe 1.6s ease-in-out infinite; }

.msg-main { flex: 1; min-width: 0; }
.msg-name {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--violet);
  margin-bottom: 7px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.msg-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  text-transform: none;
  font-weight: 500;
}

.msg-body {
  font-size: 15px;
  line-height: 1.62;
  overflow-wrap: break-word;
}
.msg.assistant .msg-body {
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  border-top-left-radius: var(--r-xs);
  padding: 16px 18px;
}
.msg-body > p:first-child { margin-top: 0; }
.msg-body > p:last-child, .msg-body > ul:last-child { margin-bottom: 0; }
.msg-body p { margin: 0 0 10px; }
.msg-body strong { color: #fff; font-weight: 700; }

/* user message: violet bubble, right aligned */
.msg.user { flex-direction: row-reverse; }
.msg.user .msg-main { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .msg-name {
  color: var(--muted);
  flex-direction: row-reverse;
}
.msg.user .msg-body {
  background: linear-gradient(135deg, var(--violet), #7a63ff);
  color: #fff;
  border-radius: var(--r-lg);
  border-top-right-radius: var(--r-xs);
  padding: 12px 18px;
  max-width: 78%;
  box-shadow: 0 4px 20px rgba(93, 71, 250, 0.3);
}

/* message actions */
.msg-actions { margin-top: 10px; display: flex; gap: 8px; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-pill);
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  min-height: 34px;
}
.copy-btn:hover { color: var(--text); border-color: rgba(93, 71, 250, 0.5); }
.copy-btn.copied { color: var(--green); border-color: rgba(0, 233, 107, 0.5); }

/* follow-up pills */
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.followup {
  border: 1px solid rgba(93, 71, 250, 0.4);
  background: rgba(93, 71, 250, 0.07);
  color: #cfc9ff;
  border-radius: var(--r-pill);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  min-height: 40px;
}
.followup:hover { background: rgba(93, 71, 250, 0.18); border-color: var(--violet); color: #fff; }

/* error state */
.msg-error {
  color: #ffb3ba !important;
  border-color: rgba(255, 93, 108, 0.4) !important;
  background: var(--red-dim) !important;
}
/* Retry button inside a timed-out chat answer (item 4). */
.retry-btn {
  margin-left: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--violet);
  background: var(--violet);
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.retry-btn:hover { filter: brightness(1.12); }

/* ---------- Rich content: semantic color ---------- */
.rich-list { margin: 0 0 12px; padding-left: 4px; list-style: none; }
.rich-list li {
  position: relative;
  padding: 7px 0 7px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.rich-list li:last-child { border-bottom: none; }
.rich-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 15px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--violet);
  box-shadow: 0 0 8px var(--violet-glow);
}
.rich-lead { font-size: 16.5px; font-weight: 500; color: #fff; }
.rich-caption { color: var(--muted); font-size: 13.5px; margin-top: -4px; }

/* money is always green */
.money { color: var(--green); font-weight: 700; font-family: var(--font-mono); font-size: 1em; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.money-big {
  color: var(--green);
  font-family: var(--font-mono);
  font-weight: 700;
  text-shadow: 0 0 24px rgba(0, 233, 107, 0.35);
}

/* stat hero: the headline numbers, set big */
.stat-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin: 2px 0 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}
.stat-num {
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0.01em;
}
.stat-num.money-big { font-family: var(--font-mono); font-size: 40px; }
.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* progress bars */
.pct {
  display: inline-block;
  width: 74px;
  height: 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  vertical-align: middle;
  margin-right: 7px;
  overflow: hidden;
}
.pct i { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--cyan), var(--violet)); }
.pct-num { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyan); font-weight: 600; }

/* status badges: late/overdue = gold, waiting/cold = cyan */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-late { color: var(--gold); background: var(--gold-dim); border: 1px solid rgba(255, 215, 0, 0.35); }
.badge-wait { color: var(--cyan); background: var(--cyan-dim); border: 1px solid rgba(0, 212, 255, 0.35); }

/* streaming reveal */
.stream .w { display: inline-block; opacity: 0; animation: word-in 0.24s var(--ease) forwards; }
/* Item 44: visible-by-default — if the stream class is gone (settled,
   interrupted, or JS bailed mid-animation), words must never stay
   invisible. */
.msg-body:not(.stream) .w { opacity: 1; animation: none; }
.rich-settle { animation: fade-in 0.25s var(--ease) both; }

/* ---------- Pending / typing states ---------- */
.msg-body.shimmer { min-height: 64px; }
.typing { display: inline-flex; gap: 6px; align-items: center; padding: 6px 0; }
.typing span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--violet);
  animation: typing-dot 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
.pending-step {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  font-style: italic;
}
.msg.state-working .pending-step { color: var(--cyan); }
.msg.state-working .msg-body {
  background: linear-gradient(110deg, rgba(255,255,255,0.028) 40%, rgba(0,212,255,0.06) 50%, rgba(255,255,255,0.028) 60%);
  background-size: 200% 100%;
  animation: shimmer-sweep 2.4s linear infinite;
}
/* done pulse + celebration */
.msg-avatar.state-done { border-color: var(--green); box-shadow: 0 0 24px rgba(0, 233, 107, 0.55); }
.msg-avatar.state-celebrate { animation: celebrate-bounce 0.9s var(--ease) 3; border-color: var(--green); }
@keyframes celebrate-bounce {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-9px) rotate(-6deg); }
  70% { transform: translateY(2px) rotate(4deg); }
}

/* ---------- Action proposal cards (Tier 2) ---------- */
.proposal-card {
  margin-top: 4px;
  border-radius: var(--r-lg);
  padding: 20px;
  border: 1px solid rgba(255, 215, 0, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 215, 0, 0.075), rgba(255, 215, 0, 0.018)),
    rgba(255, 255, 255, 0.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 215, 0, 0.12);
  animation: pop-in 0.3s var(--ease) both;
}
.prop-top { display: flex; gap: 13px; align-items: flex-start; }
.prop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid rgba(255, 215, 0, 0.4);
  font-size: 19px;
  flex: none;
}
.prop-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.prop-title {
  font-family: var(--font-display);
  font-size: 23px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 3px;
}
.prop-body { margin-top: 12px; font-size: 14.5px; line-height: 1.6; color: var(--text); }
.prop-body p { margin: 0 0 10px; }
.prop-body p:last-child { margin-bottom: 0; }
.prop-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.prop-confirm, .prop-decline {
  flex: 1;
  min-width: 140px;
  min-height: 48px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.prop-confirm {
  border: none;
  background: linear-gradient(135deg, var(--violet), #7a63ff);
  color: #fff;
  box-shadow: 0 4px 20px rgba(93, 71, 250, 0.4);
}
.prop-confirm:hover { filter: brightness(1.1); box-shadow: 0 6px 26px var(--violet-glow); }
.prop-confirm:active { transform: scale(0.98); }
.prop-decline {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--muted);
}
.prop-decline:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.25); }
.prop-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--faint);
  display: flex;
  align-items: center;
  gap: 7px;
}
.prop-note::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

/* ---------- Action receipt cards (Tier 1 results) ---------- */
.receipt-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-top: 4px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.025);
  animation: pop-in 0.3s var(--ease) both;
}
.rc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  border: 1px solid;
}
.rc-icon svg { width: 16px; height: 16px; }
.rc-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.rc-text { font-size: 14.5px; line-height: 1.55; }
.rc-text p { margin: 0; }
.receipt-card.rc-ok { border-color: rgba(0, 233, 107, 0.35); background: rgba(0, 233, 107, 0.05); }
.receipt-card.rc-ok .rc-icon { color: var(--green); border-color: rgba(0, 233, 107, 0.5); background: var(--green-dim); }
.receipt-card.rc-ok .rc-label { color: var(--green); }
.receipt-card.rc-undo { border-color: rgba(93, 71, 250, 0.35); background: rgba(93, 71, 250, 0.05); }
.receipt-card.rc-undo .rc-icon { color: var(--violet); border-color: rgba(93, 71, 250, 0.5); background: var(--violet-soft); }
.receipt-card.rc-undo .rc-label { color: #a99aff; }
.receipt-card.rc-drop { border-color: var(--border-soft); }
.receipt-card.rc-drop .rc-icon { color: var(--muted); border-color: var(--border-soft); background: rgba(255,255,255,0.04); }
.receipt-card.rc-drop .rc-label { color: var(--muted); }
.receipt-card.rc-err { border-color: rgba(255, 93, 108, 0.4); background: var(--red-dim); }
.receipt-card.rc-err .rc-icon { color: var(--red); border-color: rgba(255, 93, 108, 0.5); background: var(--red-dim); }
.receipt-card.rc-err .rc-label { color: var(--red); }

/* ---------- Briefing pane ---------- */
.briefing-pane {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 28px 32px;
}
.briefing-content { max-width: 860px; margin: 0 auto; }
.brief-loading {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  font-size: 15px;
}
.brief-head { margin: 10px 0 20px; }
.brief-head h2 {
  font-family: var(--font-display);
  font-size: 40px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  font-weight: 400;
}
.brief-asof { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.brief-section { margin-bottom: 26px; }
.wrap-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  padding: 14px 16px;
}
.wrap-card p { margin: 0 0 8px; }
.wrap-card p:last-child { margin-bottom: 0; }
.brief-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
}
.brief-priority {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  margin-bottom: 10px;
}
.brief-rank {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--violet);
  line-height: 1.2;
  min-width: 26px;
}
.brief-priority-label { font-weight: 700; font-size: 14.5px; }
.brief-priority-text { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.brief-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.brief-action {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(93, 71, 250, 0.45);
  background: rgba(93, 71, 250, 0.12);
  color: #cfc9ff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.brief-action:hover { background: rgba(93, 71, 250, 0.28); color: #fff; }
.brief-action:active { transform: scale(0.97); }

.brief-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 26px;
}
.brief-card {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.025);
  padding: 18px;
  overflow: hidden;
}
.brief-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--violet);
}
.brief-card.accent-money::before { background: var(--green); box-shadow: 0 0 16px rgba(0, 233, 107, 0.5); }
.brief-card.accent-late::before { background: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 0, 0.5); }
.brief-card.accent-todo::before { background: var(--violet); box-shadow: 0 0 16px var(--violet-glow); }
.brief-card.accent-cold::before { background: var(--cyan); box-shadow: 0 0 16px rgba(0, 212, 255, 0.5); }
.brief-card-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.brief-card-big { font-family: var(--font-display); font-size: 34px; line-height: 1.1; }
.brief-card-big .money-big { font-size: 30px; }
.brief-card-unit { font-size: 15px; color: var(--muted); font-family: var(--font-body); }
.brief-card-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }

.drill { margin-top: 12px; }
.drill summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  padding: 8px 0;
  min-height: 36px;
}
.drill summary:hover { text-decoration: underline; }
.drill .rich-list { margin-top: 4px; }

.brief-people { display: grid; gap: 8px; }
.brief-person {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.025);
  font-size: 14px;
}
.brief-person strong { font-family: var(--font-mono); color: var(--gold); font-size: 15px; }
.brief-muted { color: var(--faint); font-size: 13.5px; }
.compose-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #0A0A0F;
  background: linear-gradient(135deg, #00E96B, #5D47FA);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.brief-section p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.brief-section p strong { color: var(--text); }

/* ---------- Composer ---------- */
.composer-wrap {
  flex: none;
  padding: 12px 28px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(10, 10, 15, 0.92) 32%);
  position: relative;
  z-index: 20;
}
.composer {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 20px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-soft);
  background: rgba(20, 20, 28, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.composer:focus-within {
  border-color: rgba(93, 71, 250, 0.6);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 3px var(--violet-soft);
}
.composer textarea {
  flex: 1;
  border: none;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
  padding: 8px 0;
  max-height: 180px;
}
.composer textarea::placeholder { color: var(--faint); }
.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), #7a63ff);
  color: #fff;
  cursor: pointer;
  flex: none;
  transition: transform 0.14s var(--ease), filter 0.2s, background 0.2s;
}
.btn-send:hover:not(:disabled) { filter: brightness(1.12); }
.btn-send:active:not(:disabled) { transform: scale(0.93); }
.btn-send:disabled { opacity: 0.35; cursor: default; }
.btn-send.stop { background: linear-gradient(135deg, #e5484d, #b3202e); }
.btn-mic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: #cfc9ff;
  cursor: pointer;
  flex: none;
  transition: transform 0.14s var(--ease), background 0.2s, color 0.2s;
}
.btn-mic:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-mic:active { transform: scale(0.93); }
.btn-mic.listening {
  background: linear-gradient(135deg, #e5484d, #b3202e);
  color: #fff;
  border-color: transparent;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(229,72,77,0); }
}
.composer-hint {
  max-width: 760px;
  margin: 7px auto 0;
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  opacity: 0.75; /* quiet bystander, not a billboard */
}
.composer-hint kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.04);
}

/* scroll-to-latest */
.scroll-btn {
  position: absolute;
  bottom: 148px; /* right side, stacked above the feedback ladybug — never over the pills */
  right: 20px;
  left: auto;
  transform: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: rgba(20, 20, 28, 0.92);
  backdrop-filter: blur(10px);
  color: var(--text);
  cursor: pointer;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  animation: pop-in 0.2s var(--ease) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pop-in-centered {
  from { opacity: 0; transform: translateX(-50%) scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* stale-data banner */
.stale-banner {
  max-width: 760px;
  margin: 0 auto 14px;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 215, 0, 0.35);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- Onboarding overlay ---------- */
.onboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 9, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.3s var(--ease) both;
}
.onboard-card {
  width: 100%;
  max-width: 430px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-xl);
  padding: 34px 30px 28px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 60px rgba(93, 71, 250, 0.12);
  animation: pop-in 0.35s var(--ease) both;
}
.onboard-card .welcome-stage { margin-bottom: 4px; }
.onboard-card h3 {
  font-family: var(--font-display);
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 14px 0 8px;
  font-weight: 400;
}
.onboard-card > p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.onboard-choices { display: grid; gap: 10px; margin-bottom: 14px; }
.onboard-choice {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid rgba(93, 71, 250, 0.4);
  background: rgba(93, 71, 250, 0.08);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  transition: all 0.16s var(--ease);
}
.onboard-choice:hover { background: rgba(93, 71, 250, 0.18); transform: translateY(-1px); }

/* ---------- Mobile nav drawer ---------- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}
body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
    width: min(320px, 86vw);
    min-width: 0;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .thread-head { display: none; }
  .thread { padding: 10px 16px 20px; }
  .briefing-pane { padding: 10px 16px 28px; }
  .composer-wrap { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .msg { gap: 10px; }
  .msg-avatar { width: 36px; height: 36px; }
  .msg.assistant .msg-body { padding: 15px 16px; }
  .msg.user .msg-body { max-width: 88%; }
  .stat-num { font-size: 38px; }
  .stat-num.money-big { font-size: 33px; }
  .chips { grid-template-columns: 1fr; }
  .welcome { padding-top: 18px; }
  .brief-cards { grid-template-columns: 1fr; }
  .scroll-btn { bottom: 148px; }
}
@media (min-width: 901px) {
  .nav-overlay { display: none; }
}
@media (max-width: 420px) {
  .welcome h2 { font-size: 36px; }
  .prop-actions { flex-direction: column; }
  .prop-confirm, .prop-decline { width: 100%; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .stream .w { opacity: 1; }
}

/* ---- Phase 2: new views ---- */
.tab-dot {
  position: absolute; top: 6px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}
.brief-source {
  font-size: 11.5px; color: var(--muted); margin-top: 6px;
  font-family: "JetBrains Mono", monospace;
}
.brief-source .src-id { opacity: 0.45; font-size: 10.5px; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px;
  vertical-align: middle;
}
.pill.open { background: rgba(255, 215, 0, 0.15); color: #FFD700; }
.pill.snoozed { background: rgba(93, 71, 250, 0.2); color: #b3a8ff; }
.pill.done { background: rgba(0, 233, 107, 0.15); color: var(--green); }
.pill.quiet { background: rgba(255, 255, 255, 0.07); color: var(--muted); }
.pill.fail { background: rgba(255, 93, 108, 0.15); color: var(--red); }

/* ---------- Phase 2 tab polish (ws-c3): shared additions ----------
   .outbox-kind — color-coded draft-kind labels for the Outbox tab.
   .aging — proportional aging-bucket bars for the Pipeline tab.
   .brain-grid — 2-col company-brain form, 1-col under 480px.
   .agent-list media queries — responsive agent card grid.
   .inbound-gen 480px rule — Email tab generator stacks at phone widths. */
.outbox-kind {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; margin-left: 8px;
  vertical-align: middle; letter-spacing: 0.02em; white-space: nowrap;
}
.outbox-kind.k-followup { background: rgba(255, 215, 0, 0.14); color: var(--gold); }
.outbox-kind.k-sms { background: var(--cyan-dim); color: var(--cyan); }
.outbox-kind.k-call { background: rgba(93, 71, 250, 0.22); color: #b3a8ff; }
.outbox-kind.k-bill { background: var(--red-dim); color: var(--red); }
.outbox-kind.k-update { background: var(--green-dim); color: var(--green); }
.outbox-kind.k-log { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
[data-theme="light"] .outbox-kind.k-log { background: rgba(0, 0, 0, 0.07); }
.ob-full { white-space: pre-wrap; }
/* Decision history (outbox): decided drafts stay visible with who/when. */
.ob-hist-head { margin-top: 28px; }
.ob-hist-head .brief-muted { margin-top: 4px; font-size: 13px; }
.ob-status {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 999px; margin-left: 8px;
  vertical-align: middle; letter-spacing: 0.02em; white-space: nowrap;
}
.ob-status-sent { background: var(--green-dim); color: var(--green); }
.ob-status-discarded { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
[data-theme="light"] .ob-status-discarded { background: rgba(0, 0, 0, 0.07); }
.ob-hist-card { opacity: 0.94; }
.aging { display: flex; flex-direction: column; gap: 12px; }
.aging-row { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.aging-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.aging-label { font-weight: 700; font-size: 13.5px; }
.aging-val { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.aging-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.aging-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width 0.4s var(--ease); }
.aging-fill.hot { background: linear-gradient(90deg, var(--gold), #ff9d5d); }
[data-theme="light"] .aging-bar { background: rgba(0, 0, 0, 0.08); }
.brain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.brain-grid .span2 { grid-column: 1 / -1; }
.brain-hint { font-size: 12px; color: var(--faint); margin: 4px 0 0; line-height: 1.45; }
@media (max-width: 480px) {
  .brain-grid { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .agent-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .agent-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .inbound-gen .inbound-select { flex: 1 1 100%; }
  .inbound-gen .brief-action { flex: 1 1 100%; text-align: center; }
}

/* ---------- loading skeletons (shimmer placeholder cards) ---------- */
.brief-loading-sm { padding: 4px 0 14px; text-align: left; }
.skel {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%,
    rgba(255,255,255,.10) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.3s linear infinite;
}
.skel-card { height: 112px; margin-bottom: 12px; }
@keyframes skel-shimmer { to { background-position: -200% 0; } }

/* ---------- agent cards: stats, previews, instructions editor ---------- */
.agent-stats { margin-top: 4px; }
.agent-compare { margin-top: 4px; }
.agent-compare .cmp-up { color: var(--gold, #ffd166); }
.agent-compare .cmp-down { color: var(--green, #00e96b); }
.agent-compare .cmp-flat { color: var(--faint); }
.agent-preview {
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--border-soft); border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.agent-preview-sub { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.agent-preview-body {
  font-size: 13px; color: var(--muted); white-space: pre-wrap;
  max-height: 120px; overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}
.agent-preview-notes { font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.agent-instr { margin-top: 12px; }
.agent-instr textarea {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 10px 12px;
  font-family: inherit; resize: vertical; margin-bottom: 8px;
}
.agent-instr textarea:focus {
  outline: none; border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(93, 71, 250, 0.2);
}
.brief-action.vlog { border-color: rgba(0, 233, 107, 0.4); }
.brain-field { margin: 0 0 14px; }
.brain-field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
}
.brain-field textarea {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 10px 12px;
  font-family: inherit; resize: vertical;
}
.brain-field textarea:focus {
  outline: none; border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(93, 71, 250, 0.2);
}

/* =====================================================================
   v20261001t — streaming, mobile tab bar, palette, jobsite, light mode,
   job pages, cash, digest, onboarding, team
   ===================================================================== */

/* ---------- Light theme: every :root var overridden, sunlight-readable ---------- */
[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-2: #F5F6FA;
  --surface: #FFFFFF;
  --surface-2: #EFF1F6;
  --border: #E0E3EC;
  --border-soft: rgba(15, 18, 40, 0.10);
  --text: #14141C;
  --muted: #565B6B;
  --faint: #9AA0B2;
  --violet: #5D47FA;
  --violet-deep: #4633D6;
  --violet-soft: rgba(93, 71, 250, 0.10);
  --violet-glow: rgba(93, 71, 250, 0.22);
  --green: #00A651;
  --green-dim: rgba(0, 166, 81, 0.10);
  --input-bg: #FFFFFF;
  --gold: #9A6B00;
  --gold-dim: rgba(154, 107, 0, 0.10);
  --cyan: #007A99;
  --cyan-dim: rgba(0, 122, 153, 0.08);
  --red: #D63A4A;
  --red-dim: rgba(214, 58, 74, 0.08);
  --shadow: 0 8px 32px rgba(20, 24, 60, 0.12);
}
[data-theme="light"] .aurora { opacity: 0.22; }
[data-theme="light"] .msg-body strong { color: var(--text); }
[data-theme="light"] .rich-lead { color: var(--text); }
[data-theme="light"] .login-card { background: rgba(255, 255, 255, 0.92); }
[data-theme="light"] .sidebar { background: rgba(245, 246, 250, 0.96); }
[data-theme="light"] .composer { background: rgba(255, 255, 255, 0.95); }
[data-theme="light"] .mobile-topbar { background: rgba(255, 255, 255, 0.9); }
[data-theme="light"] .msg.assistant .msg-body {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}
[data-theme="light"] .brief-priority,
[data-theme="light"] .brief-card,
[data-theme="light"] .job-log,
[data-theme="light"] .job-row,
[data-theme="light"] .cal-item,
[data-theme="light"] .sheet,
[data-theme="light"] .palette {
  background: #fff;
}
[data-theme="light"] .brief-action { color: var(--violet-deep); background: rgba(93, 71, 250, 0.08); }
[data-theme="light"] .brief-action.ghost { background: transparent; }
[data-theme="light"] .followup { color: var(--violet-deep); background: rgba(93, 71, 250, 0.06); }
[data-theme="light"] .pill.open { color: #8a6d00; background: rgba(154, 107, 0, 0.14); }
[data-theme="light"] .pill.snoozed { color: var(--violet-deep); }
[data-theme="light"] .pill.quiet { background: rgba(15, 18, 40, 0.07); }
[data-theme="light"] .pill.done { color: #007a3d; }
[data-theme="light"] .pill.fail { color: #c22a3a; }
[data-theme="light"] .diag-log { background: #f4f5f9; border-color: var(--border); color: var(--text); }
[data-theme="light"] .msg-error { color: #b3202e !important; }
[data-theme="light"] .receipt-card.rc-undo .rc-label { color: var(--violet-deep); }
[data-theme="light"] .prog-bar { background: rgba(15, 18, 40, 0.08); }
[data-theme="light"] .wd-seg { background: rgba(15, 18, 40, 0.05); }

/* ---------- Desktop/mobile header tools ---------- */
.th-tools { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon-btn.slim { width: 38px; height: 38px; position: relative; }
.icon-btn.muted { opacity: 0.45; }
.bell-btn { position: relative; }
.bell-dot {
  position: absolute; top: 7px; right: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green);
}
.topbar-spacer { flex: 1; }
.org-menu-div { height: 1px; background: var(--border-soft); margin: 6px 4px; }

/* ---------- Mobile bottom tab bar (≤720px) ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .tabbar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    background: rgba(13, 13, 21, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border-soft);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  [data-theme="light"] .tabbar { background: rgba(255, 255, 255, 0.96); }
  .mtab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none; color: var(--muted);
    font-size: 11px; font-weight: 700;
    min-height: 52px;
    padding: 8px 0 6px;
    cursor: pointer;
    border-radius: var(--r-sm);
  }
  .mtab.active { color: var(--green); }
  .mtab svg { width: 22px; height: 22px; }
  .mtab:active { background: var(--violet-soft); }
  /* room for the bar */
  .composer-wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .briefing-pane { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .scroll-btn { bottom: 176px; }
  /* slim the topbar: brand avatar + tools only; org moves to the More sheet */
  #org-pill-mobile { display: none; }
  .brand.small span { display: none; }
  /* the vertical side-nav stays visible in the drawer — full labels, no stubs */
}

/* ---------- "More" bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  animation: fade-in 0.2s var(--ease) both;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 80dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: rise 0.25s var(--ease) both;
}
.sheet-handle {
  width: 40px; height: 4px; border-radius: 4px;
  background: var(--border); margin: 2px auto 10px;
}
.sheet-title {
  font-family: var(--font-display); font-size: 22px;
  text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 6px;
}
.sheet-item {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; background: none; border: none;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text); font-size: 15px; font-weight: 600;
  min-height: 52px; padding: 8px 4px; cursor: pointer; text-align: left;
}
.sheet-item em { font-style: normal; color: var(--faint); font-size: 18px; }
.sheet-item:active { background: var(--violet-soft); }
.sheet-orgs { margin-top: 14px; }
.sheet-orgs-title {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 4px;
}

/* ---------- Command palette ---------- */
.palette-wrap {
  position: fixed; inset: 0; z-index: 90;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12dvh 16px 16px;
}
.palette-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.palette {
  position: relative; width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop-in 0.2s var(--ease) both;
}
.palette-icon {
  position: absolute; left: 16px; top: 19px;
  width: 18px; height: 18px; color: var(--faint); pointer-events: none;
}
.palette input {
  border: none; background: none; box-shadow: none;
  font-size: 16px; padding: 16px 16px 16px 46px;
}
.palette-results { max-height: 52dvh; overflow-y: auto; border-top: 1px solid var(--border-soft); }
.pal-row {
  display: flex; gap: 12px; align-items: center;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 13px 16px; font-size: 14.5px; cursor: pointer; min-height: 54px;
}
.pal-row.sel, .pal-row:hover { background: var(--violet-soft); }
.pal-kind {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--faint); min-width: 40px; flex: none;
}
.pal-main { display: flex; flex-direction: column; min-width: 0; }
.pal-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { font-size: 12px; color: var(--faint); }
.pal-loading { padding: 18px; color: var(--muted); font-size: 14px; }
.pal-loading:empty { display: none; }
/* shortcut-help rows inside the palette: same row layout as .pal-row, but static (no pointer/hover) */
.pal-note { display: flex; gap: 12px; align-items: center; padding: 10px 16px; font-size: 14.5px; border-radius: 10px; }
.pal-note .pal-kind { min-width: 92px; }
.palette-hint {
  padding: 10px 16px; font-size: 12px; color: var(--faint);
  border-top: 1px solid var(--border-soft);
}
.palette-hint kbd {
  font-family: var(--font-mono); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft); border-radius: 6px; padding: 1px 6px;
}

/* ---------- Jobsite mode overlay ---------- */
.jobsite {
  position: fixed; inset: 0; z-index: 85;
  background: var(--bg);
  display: flex; flex-direction: column;
  animation: fade-in 0.25s var(--ease) both;
}
.jobsite-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
}
.jobsite-title {
  font-family: var(--font-display); font-size: 24px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.jobsite-center {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; padding: 24px;
}
.jobsite-mic {
  width: 152px; height: 152px; border-radius: 50%;
  border: 2px solid var(--green);
  background: var(--green-dim); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 48px rgba(0, 233, 107, 0.22);
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.jobsite-mic.talking {
  background: var(--green); color: #06281a;
  animation: pulse-dot 1.1s ease-in-out infinite;
}
.jobsite-status { color: var(--muted); font-size: 15px; font-weight: 600; }
.jobsite-transcript {
  max-width: 560px; font-size: 18px; line-height: 1.5;
  min-height: 30px; text-align: center; color: var(--text);
}

/* ---------- Self-explaining error cards ---------- */
.pane-err {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid rgba(255, 93, 108, 0.35);
  background: var(--red-dim);
  border-radius: var(--r-md);
  padding: 14px 16px; margin: 12px 0;
}
.pane-err.in-chat { margin: 8px 0 0; }
.pane-err-icon { font-size: 18px; flex: none; }
.pane-err-text { font-size: 13.5px; color: var(--text); flex: 1; }
.pane-err-text strong { display: block; margin-bottom: 2px; }
.pane-err-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.brief-action.ghost { background: transparent; border-color: var(--border-soft); color: var(--muted); }
.inline-note { font-size: 12.5px; color: var(--red); margin-left: 8px; }

/* ---------- Teaching empty states ---------- */
.empty-state {
  border: 1px dashed var(--border-soft);
  border-radius: var(--r-lg);
  padding: 30px 24px; text-align: center; margin-bottom: 20px;
  animation: fade-in 0.3s var(--ease) both;
}
.empty-why { color: var(--muted); font-size: 14.5px; margin-bottom: 14px; line-height: 1.6; }

/* ---------- Nudges / calendar strip / watchdog ---------- */
.nudge-list { display: grid; gap: 10px; margin-bottom: 20px; }
.nudge-card {
  border: 1px solid rgba(0, 233, 107, 0.3);
  background: var(--green-dim);
  border-radius: var(--r-md);
  padding: 12px 16px;
  animation: pop-in 0.3s var(--ease) both;
}
.nudge-text { font-size: 14.5px; font-weight: 600; }
.nudge-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.cal-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.cal-item {
  flex: none; min-width: 150px; max-width: 220px;
  border: 1px solid var(--border-soft); border-radius: var(--r-md);
  padding: 10px 14px; background: rgba(255, 255, 255, 0.025);
  display: flex; flex-direction: column; gap: 2px;
}
.cal-time { font-family: var(--font-mono); font-size: 12px; color: var(--green); font-weight: 700; }
.cal-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.wd-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.wd-seg {
  display: inline-flex; background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft); border-radius: var(--r-pill); padding: 3px;
}
.wd-opt {
  border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 700;
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer; min-height: 40px;
}
.wd-opt.active { background: var(--violet); color: #fff; }

/* ---------- Job detail page ---------- */
.job-top { margin: 6px 0 12px; }
.job-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.job-head h2 {
  font-family: var(--font-display); font-size: 32px;
  text-transform: uppercase; letter-spacing: 0.02em;
  margin: 0; font-weight: 400; line-height: 1.1;
}
.job-meta { display: grid; gap: 14px; margin-bottom: 18px; }
.job-prog-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.job-prog-top strong { color: var(--text); font-family: var(--font-mono); }
.prog-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), #7a63ff); border-radius: 999px; }
.prog-bar.spend i { background: linear-gradient(90deg, var(--green), #4dff9d); }
.job-money { display: flex; gap: 28px; }
.job-money-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--faint); margin-bottom: 2px;
}
.job-money .money { font-size: 17px; }
.job-templates { margin-bottom: 20px; }
.job-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft); border-radius: var(--r-md);
  color: var(--text); padding: 13px 16px; margin-bottom: 8px;
  cursor: pointer; min-height: 54px;
}
.job-row:active { background: var(--violet-soft); }
.job-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.job-row-main strong { overflow-wrap: break-word; }
.job-row-sub { font-size: 12.5px; color: var(--muted); }
.job-log {
  padding: 12px 16px; border: 1px solid var(--border-soft);
  border-radius: var(--r-md); margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02); font-size: 14px;
}
.job-log-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); margin-bottom: 4px; }
.job-log-text { line-height: 1.55; }
.job-photos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.job-photos img {
  width: 120px; height: 120px; object-fit: cover; flex: none;
  border-radius: var(--r-md); border: 1px solid var(--border-soft);
}

/* ---------- deep links & citations ---------- */
.cite-link { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.cite-link:hover { filter: brightness(1.15); }
.job-link {
  color: var(--text); font-weight: 700;
  text-decoration: underline; text-decoration-color: var(--violet);
  text-underline-offset: 2px;
}
.job-link-loading { opacity: 0.5; pointer-events: none; }

/* ---------- Digest page ---------- */
.digest-para { font-size: 17px; line-height: 1.65; margin: 0 0 16px; color: var(--text); }
.digest-deliveries {
  margin-top: 22px; padding: 14px 16px;
  border: 1px dashed var(--border-soft); border-radius: var(--r-md);
  color: var(--muted); font-size: 13.5px; line-height: 1.6;
}

/* ---------- Streaming cursor ---------- */
.stream-cursor,
.stream-caret {
  display: inline-block; width: 0.62em; height: 1.02em;
  background: linear-gradient(180deg, #8a76ff, var(--violet));
  border-radius: 3px;
  vertical-align: text-bottom;
  margin-left: 3px;
  box-shadow: 0 0 12px var(--violet-glow);
  animation: caret-pulse 1.2s ease-in-out infinite;
}
@keyframes caret-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--violet-glow); }
  50% { opacity: 0.45; box-shadow: 0 0 3px var(--violet-glow); }
}

/* ---------- Optimistic proposal cards ---------- */
.proposal-card.card-approving, .proposal-card.card-declining { opacity: 0.88; }
.proposal-card.card-done { border-color: rgba(0, 233, 107, 0.45); }
.prop-working {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid var(--border-soft); border-top-color: var(--violet);
  animation: spin 0.7s linear infinite;
}
.prop-done-note {
  display: flex; align-items: center; gap: 8px;
  color: var(--green); font-weight: 700; font-size: 14px;
  margin-top: 16px;
}
.prop-done-note span { font-size: 18px; }
.prop-inline-err {
  margin-top: 12px; font-size: 13.5px; color: var(--red);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.bulk-count {
  margin-top: 12px; font-size: 13.5px; color: var(--muted);
  border-top: 1px dashed var(--border-soft); padding-top: 10px;
}
.bulk-count strong { color: var(--text); }

/* ---------- Photo messages ---------- */
.photo-tray { display: flex; gap: 8px; max-width: 760px; margin: 0 auto 8px; overflow-x: auto; }
.photo-thumb { position: relative; flex: none; }
.photo-thumb img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--border-soft);
  display: block;
}
.photo-thumb button {
  position: absolute; top: -7px; right: -7px;
  width: 24px; height: 24px; border-radius: 50%;
  border: none; background: var(--red); color: #fff;
  font-size: 11px; cursor: pointer; line-height: 1;
}
.btn-mic.uploading { opacity: 0.5; pointer-events: none; }
.msg-photos { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.msg.user .msg-photos { justify-content: flex-end; }
.msg-photos img {
  width: 120px; height: 120px; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border-soft);
}

/* ---------- Agents: run controls ---------- */
.agent-list { display: grid; gap: 12px; margin-bottom: 26px; }
.agent-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); margin-top: 8px; }
/* ---------- agent avatars + personas ---------- */
.agent-identity { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.agent-avatar {
  width: 56px; height: 56px; border-radius: 18px; object-fit: cover; flex: none;
  background: var(--surface-2); border: 1px solid rgba(93, 71, 250, 0.45);
  box-shadow: 0 0 16px rgba(93, 71, 250, 0.35);
}
.agent-avatar.sm { width: 26px; height: 26px; border-radius: 9px; box-shadow: none; }
.agent-identity-text { min-width: 0; }
.agent-identity .brief-card-title { line-height: 1.15; }
.agent-persona { font-size: 13px; color: var(--muted); margin-top: 3px; font-style: italic; }
.agent-field { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.agent-field input[type="text"] {
  display: block; width: 100%; background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-soft); border-radius: 12px;
  color: var(--text); font-size: 14px; padding: 10px 12px;
  font-family: inherit; margin-top: 4px; box-sizing: border-box;
}
.agent-field input[type="text"]:focus {
  outline: none; border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(93, 71, 250, 0.2);
}
.agent-run-label { display: flex; align-items: center; gap: 9px; }
.agent-byline {
  display: inline-flex; align-items: center; gap: 6px;
  margin-right: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
@media (max-width: 390px) {
  .agent-avatar { width: 48px; height: 48px; border-radius: 15px; }
  .agent-identity { gap: 11px; }
}
.agent-controls { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.agent-sched { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.agent-sched select,
.team-role select {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  padding: 8px 10px; font-size: 13px; min-height: 42px; font-family: inherit;
}
.agent-result { margin-top: 12px; }
.agent-result-card {
  border: 1px solid rgba(0, 233, 107, 0.3);
  background: var(--green-dim);
  border-radius: var(--r-md); padding: 14px 16px;
  animation: pop-in 0.3s var(--ease) both;
}
.brief-priority .team-role { margin-left: auto; flex: none; }

/* ---------- Onboarding (connect org) ---------- */
.connect-card {
  max-width: 480px;
  border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 24px; background: rgba(255, 255, 255, 0.02);
}
.connect-card .btn-primary { margin-top: 16px; }
.connect-card .brief-muted { margin-top: 12px; }

/* tappable job rows (button-styled log/proposal rows) */
button.job-log {
  display: block; width: 100%; text-align: left;
  cursor: pointer; font: inherit; color: inherit;
}
button.job-log:active { background: var(--violet-soft); }
.job-row-log .job-log-date, .job-row-log .job-log-text { display: block; }

/* ---------- web-push toggle (digest view) ---------- */
.push-row{margin:14px 0 4px}
.push-toggle{display:flex;align-items:center;gap:10px;cursor:pointer;user-select:none}
.push-toggle input{position:absolute;opacity:0;pointer-events:none}
.push-track{width:44px;height:26px;border-radius:13px;background:#2a2a33;position:relative;transition:background .2s;flex:none}
.push-knob{position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:left .2s}
.push-toggle input:checked + .push-track{background:#00E96B}
.push-toggle input:checked + .push-track .push-knob{left:21px}
.push-toggle input:focus-visible + .push-track{outline:2px solid #5D47FA;outline-offset:2px}
.push-label{font-weight:600;font-size:14px}
.push-hint{font-size:12px;color:#9a9aad;margin-top:8px;line-height:1.45}

/* ============================================================
   FIRE PASS — visual system
   Brand: violet #5D47FA · near-black navy #0A0A0F ·
   electric green #00E96B · gold #FFD700 · bolt motif ·
   "Better starts now." Display: Anton · numbers: JetBrains Mono
   ============================================================ */

/* ---------- Money typography ---------- */
/* .money base (green, owed-to-you / positive) is defined above;
   .gold variant = pipeline totals */
.money.gold { color: var(--gold); text-shadow: 0 0 20px rgba(255, 215, 0, 0.28); }
.money-cold {
  color: var(--faint);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1em;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* ---------- Branded scrollbars (no gray defaults) ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(93, 71, 250, 0.55) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(93, 71, 250, 0.65), rgba(0, 233, 107, 0.35));
  border-radius: 999px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(93, 71, 250, 0.85); }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Branded dropdowns (no native gray) ---------- */
select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface-2);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235D47FA' stroke-width='3' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 34px 10px 12px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
select:hover { border-color: rgba(93, 71, 250, 0.5); }
select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}
select option { background: var(--surface-2); color: var(--text); }
/* keep the branded arrow where component rules use the background shorthand */
.agent-sched select,
.team-role select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235D47FA' stroke-width='3' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
}

/* ---------- Branded textareas ---------- */
textarea {
  font-family: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 15px;
  resize: vertical;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-soft);
}
textarea::placeholder { color: var(--faint); }

/* ---------- Toast banner (Low-21: replaces native alert()) ---------- */
#mb-toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(12px);
  bottom: 24px; z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: min(480px, calc(100vw - 32px));
}
#mb-toast.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mb-toast-card {
  background: #3a1420; color: #ffd7de;
  border: 1px solid #a33; border-radius: var(--r-sm);
  padding: 12px 40px 12px 16px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.45); position: relative;
}
.mb-toast-x {
  position: absolute; right: 10px; top: 10px; cursor: pointer; opacity: .7;
  font-size: 14px; padding: 2px 6px; min-height: 32px; min-width: 32px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mb-toast-x:hover { opacity: 1; }

/* ---------- Segmented control (item 14/43: real buttons, keyboard accessible) ---------- */
.seg-ctrl {
  display: flex; gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.seg-btn {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.on { background: var(--violet); color: #fff; }
.seg-btn:focus-visible { outline: 2px solid var(--violet); outline-offset: -2px; }

/* ---------- Form grid (two-up fields) ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Toggles: sliding knob, violet -> green ---------- */
.push-track {
  background: rgba(93, 71, 250, 0.3);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.push-knob {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: left 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.push-toggle input:checked + .push-track {
  background: linear-gradient(90deg, var(--violet), var(--green));
  box-shadow: 0 0 14px rgba(0, 233, 107, 0.35), inset 0 1px 3px rgba(0, 0, 0, 0.25);
}
.push-toggle input:checked + .push-track .push-knob {
  box-shadow: 0 2px 8px rgba(0, 233, 107, 0.5);
}

/* ---------- Press states: scale .97 + shadow tighten ---------- */
.btn-new:active,
.sheet-item:active,
.pal-row:active,
.mtab:active,
.job-row:active,
.wd-opt:active,
.icon-btn:active,
.brief-action:active {
  transform: scale(0.97);
}
.btn-new:active,
.sheet-item:active,
.pal-row:active {
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}
button, .btn-primary, .btn-send, .btn-mic {
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Cards: lift 2px + shadow on hover ---------- */
.brief-priority, .job-row, .cal-item, .job-log,
.nudge-card, .agent-result-card, .agent-preview,
.followup, .digest-deliveries, .connect-card, .empty-state {
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
@media (hover: hover) {
  .brief-priority:hover, .job-row:hover, .cal-item:hover, .job-log:hover,
  .nudge-card:hover, .agent-result-card:hover, .agent-preview:hover,
  .followup:hover, .digest-deliveries:hover, .connect-card:hover, .empty-state:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(93, 71, 250, 0.25);
  }
}

/* ---------- Tab/page transitions: instant crossfade + slide (<=200ms) ---------- */
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.briefing-pane:not(.hidden) { animation: view-in 0.18s var(--ease) both; }
#thread.msg-enter { animation: view-in 0.18s var(--ease) both; }

/* staggered card entrances on briefing + panes */
@keyframes stagger-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger > * { animation: stagger-rise 0.32s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 0.04s; }
.stagger > *:nth-child(3) { animation-delay: 0.08s; }
.stagger > *:nth-child(4) { animation-delay: 0.12s; }
.stagger > *:nth-child(5) { animation-delay: 0.16s; }
.stagger > *:nth-child(6) { animation-delay: 0.2s; }
.stagger > *:nth-child(7) { animation-delay: 0.24s; }
.stagger > *:nth-child(8) { animation-delay: 0.28s; }
/* automatic stagger for briefing pane sections (no markup change needed) */
.briefing-pane:not(.hidden) .brief-section > * { animation: stagger-rise 0.32s var(--ease) both; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(2) { animation-delay: 0.05s; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(3) { animation-delay: 0.1s; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(4) { animation-delay: 0.15s; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(5) { animation-delay: 0.2s; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(6) { animation-delay: 0.25s; }
.briefing-pane:not(.hidden) .brief-section > *:nth-child(n+7) { animation-delay: 0.3s; }

/* ---------- Skeleton variants (every loading state gets shimmer) ---------- */
.skel-line { height: 14px; margin-bottom: 10px; }
.skel-line.short { width: 55%; }
.skel-num { height: 44px; width: 180px; margin-bottom: 10px; }
.skel-avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.skel-row {
  display: flex; align-items: center; gap: 12px;
  height: 64px; margin-bottom: 10px; padding: 0 14px;
}
/* CSS-only safety net: every pane loader shows a shimmer bar even
   where markup only has .brief-loading text */
.brief-loading::after {
  content: "";
  display: block;
  height: 12px;
  max-width: 300px;
  margin: 20px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(93, 71, 250, 0.12) 25%, rgba(93, 71, 250, 0.35) 50%, rgba(93, 71, 250, 0.12) 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.3s linear infinite;
}
.brief-loading-sm::after { margin-left: 0; max-width: 220px; }

/* ---------- success-sweep: check sweep + green glow (~900ms, auto-clean) ---------- */
@keyframes sweep-glow {
  0% { box-shadow: 0 0 0 rgba(0, 233, 107, 0); }
  30% { box-shadow: 0 0 28px rgba(0, 233, 107, 0.5), inset 0 0 18px rgba(0, 233, 107, 0.12); }
  100% { box-shadow: 0 0 0 rgba(0, 233, 107, 0); }
}
@keyframes sweep-check {
  0% { left: 4%; opacity: 0; transform: translateY(-50%) scale(0.6); }
  18% { opacity: 1; }
  70% { opacity: 1; }
  100% { left: 92%; opacity: 0; transform: translateY(-50%) scale(1.05); }
}
.success-sweep {
  position: relative;
  overflow: hidden;
  animation: sweep-glow 0.9s var(--ease) both;
}
.success-sweep::after {
  content: "\2713";
  position: absolute;
  top: 50%;
  left: 4%;
  transform: translateY(-50%);
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  color: var(--green);
  text-shadow: 0 0 20px rgba(0, 233, 107, 0.9);
  pointer-events: none;
  animation: sweep-check 0.9s var(--ease) both;
}

/* ---------- Contract classes ---------- */

/* .empty-robot — Mr. Better Boss robot in empty states */
.empty-robot {
  width: 118px;
  height: 118px;
  object-fit: cover;
  border-radius: 30px;
  border: 1px solid rgba(93, 71, 250, 0.45);
  outline: 2px solid rgba(0, 233, 107, 0.22);
  outline-offset: 5px;
  box-shadow: 0 0 44px rgba(93, 71, 250, 0.35), 0 14px 34px rgba(0, 0, 0, 0.55);
  animation: floaty 5s ease-in-out infinite;
}
.empty-state .empty-robot { margin: 2px auto 16px; display: block; }

/* .page-head — consistent page header: Anton title + context subline */
.page-head {
  margin: 8px 0 18px;
}
.page-head h1, .page-head h2, .page-head .title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin: 0;
}
.page-head .sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 6px;
}

/* .pri-card / .pri-rank — briefing priority cards */
.pri-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--violet);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}
.pri-card .money { font-size: 16px; }
@media (hover: hover) {
  .pri-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(93, 71, 250, 0.3);
    border-left-color: var(--green);
  }
}
.pri-rank {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  min-width: 38px;
  text-align: center;
  color: var(--green);
  text-shadow: 0 0 18px rgba(0, 233, 107, 0.45);
  padding-top: 2px;
}
.pri-card .pri-title { font-weight: 700; font-size: 14.5px; }
.pri-card .pri-src {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: 4px;
  letter-spacing: 0.06em;
}
.pri-card .pri-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pri-list { display: flex; flex-direction: column; gap: 10px; }
.pri-list .pri-card { margin-bottom: 0; }
.pri-body { flex: 1; min-width: 0; }
.pri-card .pri-money { font-size: 26px; line-height: 1.15; margin: 6px 0 2px; }
.pri-text { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* .nudge-card — briefing nudge with Do it / Dismiss (extends existing) */
.nudge-card { position: relative; overflow: hidden; border-left: 3px solid var(--green); }
.nudge-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--green), var(--violet));
}
.nudge-card.nudge-dismissing {
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
}

/* .src-link — obvious source citation */
.src-link {
  color: #b3a8ff;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--violet);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.src-link:hover {
  color: #d3cbff;
  text-decoration-color: var(--green);
  text-shadow: 0 0 12px rgba(93, 71, 250, 0.6);
}

/* ---------- Light theme adjustments for fire-pass classes ---------- */
[data-theme="light"] .money { color: #00963f; }
[data-theme="light"] .money.gold { color: #8a6d00; text-shadow: none; }
[data-theme="light"] .money-cold { color: #8a8fa0; }
[data-theme="light"] .pri-card,
[data-theme="light"] .nudge-card { background: #fff; }
[data-theme="light"] .src-link { color: var(--violet-deep); }
[data-theme="light"] ::-webkit-scrollbar-thumb { border-color: #f2f3f7; }

/* ---------- Mobile 390px: tabbar + More sheet + composer ---------- */
@media (max-width: 720px) {
  .mtab { min-height: 56px; font-size: 12px; }
  .mtab span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.25;
  }
  .mtab:focus-visible {
    outline: 2px solid var(--violet);
    outline-offset: -2px;
  }
  .sheet-item { min-height: 56px; font-size: 16px; }
  .sheet-item em { min-width: 28px; text-align: center; }
  .sheet { border-top: 2px solid rgba(93, 71, 250, 0.35); }
  .sheet-handle { background: linear-gradient(90deg, var(--violet), var(--green)); }
  /* keep composer clear of the tabbar at small widths */
  .composer-wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .scroll-btn { bottom: 190px; }
  /* contract classes scale down gracefully */
  .page-head h1, .page-head h2, .page-head .title { font-size: 28px; }
  .empty-robot { width: 92px; height: 92px; border-radius: 24px; }
  .pri-rank { font-size: 24px; min-width: 30px; }
}

/* ---------- Reduced motion: covers EVERY keyframe ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .stream .w { opacity: 1; }
  /* fire-pass specifics */
  .success-sweep { animation: none; box-shadow: inset 0 0 0 2px rgba(0, 233, 107, 0.5); }
  .success-sweep::after { display: none; }
  .brief-loading::after { animation: none; opacity: 0.4; }
  .briefing-pane:not(.hidden),
  .stagger > *,
  .briefing-pane:not(.hidden) .brief-section > * { animation: none; }
  .empty-robot, .stream-cursor, .stream-caret { animation: none; }
  .nudge-card.nudge-dismissing { transform: none; }
}

/* ---------- JobTread Pros build (2026-10-01): funnel/leads/orders/sms/vendors/catalog/inbound ---------- */
.brief-note {
  background: rgba(93, 71, 250, 0.08);
  border: 1px solid rgba(93, 71, 250, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: inherit;
  opacity: 0.92;
}
.addr-list { display: flex; flex-direction: column; gap: 8px; }
.addr-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 10px 12px;
}
.addr-job { font-weight: 600; flex: 1 1 140px; min-width: 0; }
.addr-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 8px; border-radius: 6px; word-break: break-all;
}
.inbound-gen { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inbound-select {
  flex: 1 1 200px; background: rgba(255,255,255,0.05); color: inherit;
  border: 1px solid rgba(255,255,255,0.14); border-radius: 8px;
  padding: 8px 10px; font-size: 14px;
}
.inbound-email {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
}
.inbound-email-subj { font-weight: 600; margin-bottom: 4px; }
.muted { opacity: 0.65; font-size: 13px; }

/* ---------- Leads quick-add + flow (Phase 2 polish) ---------- */
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.lead-full { grid-column: 1 / -1; }
.lead-flow { display: flex; align-items: stretch; gap: 6px; margin: 2px 0 6px; flex-wrap: wrap; }
.lead-flow-step {
  flex: 1 1 0; min-width: 88px; text-align: center;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
  padding: 10px 6px;
}
.lead-flow-count { font-family: var(--font-display); font-size: 24px; color: var(--green); line-height: 1.1; }
.lead-flow-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.lead-flow-arrow { align-self: center; color: var(--faint); font-size: 15px; flex: none; }
[data-theme="light"] .lead-flow-step { background: rgba(0, 0, 0, 0.03); }
@media (max-width: 480px) {
  .lead-grid { grid-template-columns: 1fr; }
}
@media (prefers-color-scheme: light) {
  .addr-row { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
  .addr-code { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); }
  .inbound-select { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.14); }
  .inbound-email { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.08); }
}

/* ---------- Funnel stage strip (Phase 2 polish) ---------- */
.funnel-strip {
  display: flex; gap: 8px; overflow-x: auto; align-items: stretch;
  padding: 4px 0 12px; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.funnel-stage { flex: 0 0 auto; min-width: 132px; scroll-snap-align: start; }
.funnel-arrow {
  flex: 0 0 auto; align-self: center; text-align: center; min-width: 56px;
  color: var(--accent, #5D47FA);
}
.funnel-pct { font-weight: 700; font-size: 13px; white-space: nowrap; }
.funnel-dir { font-size: 20px; line-height: 1; }

/* ---------- Dogfood feedback (2026-10-02) ---------- */
.fb-fab {
  position: fixed; right: 20px; bottom: 88px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent, #5D47FA); color: #fff; border: none;
  font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 0; flex-shrink: 0;
}
.fb-fab:active { transform: scale(.94); }
.fb-sheet {
  position: fixed; inset: 0; z-index: 70; display: flex;
  align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.5);
}
.fb-card {
  width: 100%; max-width: 520px; margin: 0 12px 12px;
  background: var(--card, #141422); border-radius: 16px;
  padding: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.fb-card h3 { margin: 0 0 4px; font-size: 16px; }
.fb-card p { margin: 0 0 10px; font-size: 13px; opacity: .7; }
.fb-card textarea {
  width: 100%; min-height: 90px; resize: vertical;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05); color: inherit;
  padding: 10px; font-size: 14px; font-family: inherit;
}
.fb-row { display: flex; gap: 10px; margin-top: 12px; justify-content: flex-end; }
.fb-btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.fb-btn.send { background: var(--accent, #5D47FA); color: #fff; }
.fb-btn.cancel { background: rgba(255,255,255,.08); color: inherit; }
.fb-note { font-size: 12px; opacity: .6; margin-top: 8px; }

/* ---------- Agent template gallery ---------- */
.tpl-gallery-head { margin: 18px 0 10px; }
.tpl-gallery-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.tpl-gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 22px; }
.tpl-card {
  background: var(--card, rgba(255,255,255,0.03));
  border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 13px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.tpl-card:hover { border-color: rgba(93, 71, 250, 0.5); }
.tpl-name { font-size: 14px; font-weight: 700; }
.tpl-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45; flex: 1; }
.tpl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.tpl-sched { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

/* ---------- Chat appearance: thread width + density (2026-10-02) ----------
   Toggled from Settings → Chat; body classes applied by app.js at boot. */
body.thread-wide .thread-inner,
body.thread-wide .msg { max-width: 1080px; }
body.thread-wide .msg.user .msg-body { max-width: 72%; }

body.density-compact .thread { padding: 6px 20px 16px; }
body.density-compact .msg { padding: 4px 0; gap: 8px; }
body.density-compact .msg + .msg { margin-top: 0; }
body.density-compact .msg-avatar { width: 32px; height: 32px; }
body.density-compact .avatar-live { margin-top: 0; }
body.density-compact .msg-name { margin-bottom: 4px; }
body.density-compact .msg.assistant .msg-body {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
}
body.density-compact .msg.user .msg-body { padding: 8px 14px; }
body.density-compact .msg-body p { margin: 0 0 7px; }
body.density-compact .msg-actions { margin-top: 7px; }
body.density-compact .followups { margin-top: 10px; gap: 6px; }
body.density-compact .followup {
  padding: 6px 12px;
  font-size: 12.5px;
  min-height: 32px;
}

/* selected state for segmented brief-action toggles (2026-10-02) */
.brief-action.sel {
  background: rgba(93, 71, 250, 0.45);
  border-color: var(--violet);
  color: #fff;
  box-shadow: 0 2px 12px rgba(93, 71, 250, 0.35);
}

/* stale snapshot banner (briefing served from last verified data) */
.stale-banner {
  margin: 10px 0 4px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 200, 60, .35);
  background: rgba(255, 200, 60, .08);
  color: #e8c86a;
  border-radius: 10px;
  font-size: 13px;
}

/* diagnostics view */
.diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.diag-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px 16px; }
.diag-wide { margin-bottom: 12px; }
.diag-card-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.diag-sub { font-weight: 400; font-size: 12px; color: rgba(255,255,255,.45); }
.diag-dim { color: rgba(255,255,255,.45); font-size: 13px; padding: 8px 0; }
.diag-svc { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.diag-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.diag-dot.on { background: #00e96b; box-shadow: 0 0 6px rgba(0,233,107,.7); }
.diag-dot.off { background: #ff5d5d; }
.diag-svc-name { flex: 1; font-family: monospace; }
.diag-svc-state { color: rgba(255,255,255,.55); font-size: 12px; }
.diag-kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.diag-kv span { color: rgba(255,255,255,.55); }
.diag-logbar { display: flex; gap: 8px; margin-bottom: 8px; }
.diag-logbar select { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.diag-log { background: #0a0a12; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 10px 12px; font-family: monospace; font-size: 11.5px; line-height: 1.55; max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; }
.diag-log .diag-err { color: #ff8a8a; }
.diag-err { color: #ff8a8a; font-size: 13px; }
.diag-tables { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.diag-table { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; }
.diag-table span { color: rgba(255,255,255,.5); margin-left: 6px; font-size: 11.5px; }
.diag-table.sel { border-color: #5d47fa; background: rgba(93,71,250,.15); }
.diag-tablewrap { overflow-x: auto; }
.diag-grid-table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
.diag-grid-table th, .diag-grid-table td { text-align: left; padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; max-width: 320px; }
.diag-grid-table th { color: rgba(255,255,255,.55); font-weight: 600; white-space: nowrap; }
.diag-grid-table td { font-family: monospace; font-size: 11.5px; }
.btn-sm { background: rgba(93,71,250,.2); border: 1px solid rgba(93,71,250,.5); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
