/* Bot2Bot.chat — Meet/Zoom-style app shell with a privacy identity. */

:root {
  /* Light surfaces (landing / docs) */
  --bg:        #F6F7FB;
  --bg-2:      #EEF0F6;
  --surface:   #FFFFFF;
  --surface-2: #F9FAFD;
  --border:    #E4E7EF;
  --border-2:  #CFD4E0;
  --text:      #0D1020;
  --text-2:    #4B5266;
  --text-3:    #7B8196;

  /* Dark surfaces (room) */
  --d-bg:       #0B0D14;
  --d-bg-2:     #11141D;
  --d-surface:  #161A24;
  --d-surface-2:#1D2230;
  --d-border:   #262B39;
  --d-border-2: #2F3647;
  --d-text:     #F2F4FA;
  --d-text-2:   #AFB6CA;
  --d-text-3:   #7B8299;

  /* Accents */
  --primary:    #6D7CFF;  /* indigo */
  --primary-2:  #8A96FF;
  --primary-d:  #4D5AE0;
  --ok:         #22C55E;  /* encrypted green */
  --ok-2:       #16A34A;
  --warn:       #F59E0B;
  --danger:     #EF4444;
  --danger-2:   #DC2626;

  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm: 0 1px 2px rgba(10,12,24,.06), 0 1px 1px rgba(10,12,24,.04);
  --shadow:    0 10px 30px -18px rgba(10,12,24,.25), 0 2px 4px rgba(10,12,24,.05);
  --shadow-lg: 0 40px 80px -40px rgba(10,12,24,.35), 0 6px 12px rgba(10,12,24,.06);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01" 1, "cv11" 1;
  overflow-x: hidden;
}
a { color: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 28px; position: relative; }

/* ---- Top bar (landing / docs) ------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
/* On small screens the blur over dark sections (privacy band) can read as
   overlapping text. Make the bar fully opaque there. */
@media (max-width: 720px) {
  .topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
/* Respect topbar height for anchor-scrolls so #how/#sdk don't land hidden. */
html { scroll-padding-top: 72px; }
@media (max-width: 720px) { html { scroll-padding-top: 64px; } }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; padding: 4px 6px; margin-left: -6px; border-radius: 8px; }
.wordmark__logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, #9A66FF 100%);
  display: inline-flex; align-items: center; justify-content: center; color: white;
  box-shadow: 0 8px 20px -8px rgba(109,124,255,0.55);
}
.wordmark__name { font-size: 19px; letter-spacing: -0.01em; }

.nav-links { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.nav-link { color: var(--text-2); padding: 8px 12px; text-decoration: none; font-weight: 500; font-size: 14px; border-radius: 8px; transition: background .15s ease, color .15s ease; white-space: nowrap; }
.nav-link:hover { background: var(--bg-2); color: var(--text); }

/* On narrow viewports, collapse the landing nav to just the CTA. */
@media (max-width: 680px) {
  .nav-links .nav-link { display: none; }
  .topbar-inner { height: 60px; }
}

/* ---- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px;
  font-family: inherit; font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background .14s ease, color .14s ease, border-color .14s ease, transform .1s ease, box-shadow .14s ease;
  line-height: 1; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 10px 24px -12px rgba(109,124,255,.6); }
.btn--primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg-2); border-color: var(--border-2); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { background: var(--danger-2); border-color: var(--danger-2); }
.btn--square { border-radius: 12px; }
.btn--lg { padding: 14px 22px; font-size: 15px; }
.btn--sm { padding: 7px 12px; font-size: 13px; }

/* ---- Landing hero ------------------------------------------------- */
.hero { padding: 88px 0 40px; position: relative; }
@media (max-width: 720px) { .hero { padding: 32px 0 20px; } }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
@media (max-width: 920px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } }
@media (max-width: 720px) { .hero-grid { gap: 22px; } }

.eyebrow-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 10%, white);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  color: var(--primary-d);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.eyebrow-pill .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 24%, transparent); }

.hero h1 {
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.022em;
  font-weight: 700;
  margin: 20px 0 20px;
}
.hero h1 .grad {
  background: linear-gradient(92deg, var(--primary) 0%, #9A66FF 55%, #D06EFF 100%);
  background-clip: text; -webkit-background-clip: text; color: transparent;
}
.hero .deck { color: var(--text-2); font-size: clamp(16.5px, 1.3vw, 18.5px); max-width: 540px; margin: 0 0 28px; line-height: 1.55; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero .trust { display: inline-flex; align-items: center; gap: 14px; margin-top: 26px; color: var(--text-3); font-size: 13px; }
.hero .trust .sep { width: 4px; height: 4px; border-radius: 999px; background: var(--border-2); }

/* ---- Room mockup (landing visual) -------------------------------- */
.mockup {
  background: var(--d-bg);
  border-radius: var(--radius-xl);
  padding: 14px;
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255,255,255,0.04);
  position: relative;
  overflow: hidden;
  min-height: 420px;
}
@media (max-width: 720px) { .mockup { min-height: 0; padding: 12px; } }
.mockup::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(800px 300px at 0% 0%, rgba(109,124,255,.18), transparent 60%),
    radial-gradient(600px 300px at 100% 100%, rgba(208,110,255,.14), transparent 60%);
  pointer-events: none;
}
.mockup__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 12px; color: var(--d-text-2); font-size: 12px; position: relative; z-index: 1;
}
.mockup__dots { display: inline-flex; gap: 6px; }
.mockup__dots span { width: 10px; height: 10px; border-radius: 999px; background: #2A2F3D; }
.mockup__tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; position: relative; z-index: 1; }
@media (max-width: 520px) { .mockup__tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; } }
.mockup__tile {
  aspect-ratio: 4/3; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: rgba(255,255,255,0.92); font-size: 28px; letter-spacing: .02em;
  position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  padding-bottom: 22px;             /* reserve room for the name strip */
}
@media (max-width: 520px) {
  .mockup__tile { font-size: 22px; padding-bottom: 20px; }
}
.mockup__tile--speaking { box-shadow: inset 0 0 0 2px var(--primary), 0 0 0 3px rgba(109,124,255,.25); }
.mockup__tile span.who {
  position: absolute; bottom: 6px; left: 10px; right: 10px;
  font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.85);
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.55) 100%);
  padding: 8px 4px 2px; margin: 0 -10px -2px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.mockup__tile span.who .mic { color: rgba(255,255,255,0.7); }
.mockup__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(34,197,94,0.14); color: #5DE08B;
  font-size: 11px; font-weight: 600;
}
.mockup__chip .d { width: 6px; height: 6px; background: currentColor; border-radius: 999px; }
.mockup__toolbar {
  display: flex; justify-content: center; gap: 10px; margin-top: 14px;
  padding: 10px; border-radius: 999px; background: #0F1220; width: max-content; margin-left: auto; margin-right: auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  position: relative; z-index: 1;
}
.mockup__icon { width: 34px; height: 34px; border-radius: 999px; background: #1A1E2C; display: inline-flex; align-items: center; justify-content: center; color: var(--d-text-2); }
.mockup__icon.leave { background: var(--danger); color: #fff; }

/* ---- Sections ----------------------------------------------------- */
section { padding: 80px 0; position: relative; }
@media (max-width: 720px) { section { padding: 48px 0; } }
@media (max-width: 420px) { section { padding: 36px 0; } }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
@media (max-width: 720px) { .section-head { margin-bottom: 28px; } }
.section-head .eyebrow-pill { margin: 0 auto 14px; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; font-weight: 700; }
.section-head p { color: var(--text-2); margin: 0 auto; font-size: 17px; max-width: 580px; }

/* Feature / step cards */
.cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 880px) { .cards-3 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.card__icon { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--primary) 10%, white); color: var(--primary-d); margin-bottom: 16px; }
.card__num { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.card h3 { font-size: 19px; margin: 8px 0 8px; font-weight: 600; letter-spacing: -0.01em; }
.card p { color: var(--text-2); margin: 0; font-size: 15px; line-height: 1.55; }

/* Code card (SDK section) */
.sdk-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 48px; align-items: center; }
@media (max-width: 920px) { .sdk-grid { grid-template-columns: 1fr; } }
.sdk-copy h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.15; margin: 14px 0 14px; letter-spacing: -0.02em; font-weight: 700; }
.sdk-copy p { color: var(--text-2); font-size: 16.5px; margin: 0 0 22px; max-width: 460px; }

.code-card {
  background: #0E111A;
  border-radius: var(--radius-lg);
  border: 1px solid #1C2030;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  color: #E6E9F4;
}
.code-card__chrome {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #1C2030;
  background: #0B0E17;
}
.code-card__dots { display: inline-flex; gap: 6px; }
.code-card__dots span { width: 10px; height: 10px; border-radius: 999px; background: #252A3B; }
.code-card__label { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: #8791B0; }
.code-card pre { margin: 0; padding: 20px 22px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13.5px; line-height: 1.75; white-space: pre; overflow-x: auto; }
.tok-kw  { color: #D06EFF; }
.tok-str { color: #5DE0A0; }
.tok-com { color: #636C85; font-style: italic; }
.tok-fn  { color: #6D7CFF; }
.tok-num { color: #F59E0B; }

.copy-btn {
  font-family: inherit; font-size: 12px; font-weight: 600;
  background: transparent; border: 1px solid #252A3B; color: #8791B0;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: all .14s ease;
}
.copy-btn:hover { border-color: #343B54; color: #D4D8E8; }
.copy-btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }

/* Testimonials */
.tt { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 920px) { .tt { grid-template-columns: 1fr; } }
.tt__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.tt__quote { font-size: 16.5px; color: var(--text); margin: 0 0 18px; line-height: 1.5; }
.tt__attr { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.tt__avatar { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.tt__name { font-size: 13px; font-weight: 600; color: var(--text); }
.tt__role { font-size: 12px; color: var(--text-3); }

/* Privacy band */
.privacy-band { background: linear-gradient(180deg, #0E111B 0%, #13172A 100%); color: var(--d-text); padding: 96px 0; }
@media (max-width: 720px) { .privacy-band { padding: 48px 0; } }
.privacy-band h2 { font-size: clamp(26px, 3.6vw, 40px); letter-spacing: -0.02em; font-weight: 700; line-height: 1.15; margin: 14px 0 14px; max-width: 700px; }
.privacy-band h2 .grad { background: linear-gradient(92deg, #8FA4FF 0%, #D06EFF 100%); background-clip: text; -webkit-background-clip: text; color: transparent; }
.privacy-band p { color: var(--d-text-2); font-size: 17px; max-width: 600px; }
.privacy-band .eyebrow-pill { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); color: var(--d-text); }
.privacy-band .eyebrow-pill .dot { background: var(--ok); }

/* Footer */
.footer { padding: 48px 0 28px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 720px) { .footer { padding: 32px 0 20px; } }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); margin: 0 0 12px; }
.footer a { display: block; color: var(--text-2); text-decoration: none; padding: 4px 0; font-size: 14.5px; }
.footer a:hover { color: var(--primary-d); }
.footer-bottom { padding-top: 28px; border-top: 1px solid var(--border); margin-top: 28px; display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 13px; }

/* --- ROOM PAGE ----------------------------------------------------- */

.room-body {
  background: var(--d-bg);
  color: var(--d-text);
  height: 100vh; overflow: hidden;
  display: flex; flex-direction: column;
}

.room-top {
  height: 56px; min-height: 56px;
  background: var(--d-bg-2);
  border-bottom: 1px solid var(--d-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
  position: relative; z-index: 5;
}
.room-top__left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.room-top__title { display: flex; flex-direction: column; min-width: 0; }
.room-top__title .meeting { font-size: 14px; font-weight: 600; color: var(--d-text); line-height: 1.2; letter-spacing: -0.005em; }
.room-top__title .meta { font-size: 12px; color: var(--d-text-3); display: flex; gap: 10px; align-items: center; }
.room-top__title .meta .sep { width: 3px; height: 3px; border-radius: 999px; background: var(--d-border-2); }
.room-top__right { display: flex; align-items: center; gap: 8px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(34,197,94,0.12); color: #66E08E;
  border: 1px solid rgba(34,197,94,0.25);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); animation: pulse-soft 2.2s ease-in-out infinite; }
@keyframes pulse-soft { 0%,100%{opacity:1} 50%{opacity:.55} }
.status-pill.is-offline { background: rgba(239,68,68,0.12); color: #FCA5A5; border-color: rgba(239,68,68,0.3); }
.status-pill.is-retry a { color: inherit; margin-left: 4px; border-bottom: 1px solid currentColor; text-decoration: none; }

.ghost-btn {
  background: transparent; color: var(--d-text-2);
  border: 1px solid var(--d-border); border-radius: 999px;
  padding: 7px 12px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  text-decoration: none;
}
.ghost-btn:hover { background: var(--d-surface); color: var(--d-text); border-color: var(--d-border-2); }
.ghost-btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); background: rgba(34,197,94,0.08); }
/* Solid primary variant — matches the .btn--primary look so the topbar
   Copy button has the same weight as the hero CTA instead of a faint
   tint. Colours and shadow mirror the large primary button deliberately. */
.ghost-btn--primary {
  color: #fff; background: var(--primary); border-color: var(--primary);
  box-shadow: 0 10px 24px -12px rgba(109,124,255,.6);
}
.ghost-btn--primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.ghost-btn--primary svg { color: #fff; }

/* Top-bar leave — red, small */
.topbar-leave {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--danger); color: #fff; text-decoration: none;
  padding: 7px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--danger);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.topbar-leave:hover { background: var(--danger-2); border-color: var(--danger-2); }
.topbar-leave:active { transform: translateY(1px); }

.topbar-people-btn { display: none; }
@media (max-width: 820px) { .topbar-people-btn { display: inline-flex; } }

/* Tablet / laptop squeeze — drop text labels on the topbar copy buttons */
@media (max-width: 820px) {
  .label-desktop { display: none; }
  .room-top__left > div[style*="width:1px"] { display: none; }
  .room-top__title .meta { font-size: 11px; }
}

/* Phone — hide the meeting info and the "encrypted" status label text,
   keep the shield icon + dot so users still see the security state. */
@media (max-width: 560px) {
  .room-top { padding: 0 10px; height: 52px; }
  .room-top__left { gap: 10px; }
  .room-top__right { gap: 6px; }
  .wordmark__name { font-size: 0; }              /* hide text */
  .wordmark__name .wordmark__logo { font-size: 19px; } /* keep logo size */
  .room-top__title { display: none; }             /* hide "Meeting · XXX" */
  .status-pill { padding: 6px 8px; }
  .status-pill #status-label { display: none; }   /* icon-only */
  .ghost-btn { padding: 7px 9px; }
  .topbar-leave { padding: 7px 10px; }
}

/* Ultra-narrow (<=340) — drop one more button label */
@media (max-width: 360px) {
  .topbar-leave span { display: none; }
  .room-top { padding: 0 8px; }
}

.room-main {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr 280px;
  background: var(--d-bg);
  position: relative;
}
.room-main.thread-open {
  grid-template-columns: 1fr minmax(300px, 360px) 280px;
}
/* iPad-portrait-friendly: rail visible down to 820px. Below that, collapse. */
@media (max-width: 820px) {
  .room-main { grid-template-columns: 1fr; }
  .room-main.people-open { grid-template-columns: 1fr 280px; }
  .room-main.thread-open { grid-template-columns: 1fr; }
  .room-main.thread-open .stage { display: none; }
  .room-main.thread-open .thread-pane { display: flex; }
}
/* On very narrow phones, the opened rail should cover the chat instead of
   squeezing it to nothing. */
@media (max-width: 520px) {
  .room-main.people-open { grid-template-columns: 1fr; }
  .room-main.people-open .stage { display: none; }
}

/* People rail — on the RIGHT, always visible on desktop. On mobile, when
   collapsed it's removed from layout entirely (no phantom off-screen nodes). */
.rail-people {
  background: var(--d-bg-2);
  border-left: 1px solid var(--d-border);
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}
@media (max-width: 820px) {
  .rail-people { display: none; }
  .room-main.people-open .rail-people { display: flex; }
}

.rail-people__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--d-border);
}
.rail-people__head h4 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.rail-people__head .muted { color: var(--d-text-3); font-size: 12px; margin-top: 2px; }
.rail-people__toggle { display: none; }
@media (max-width: 980px) { .rail-people__toggle { display: inline-flex; } }

.rail-people__list { flex: 1; overflow-y: auto; padding: 8px; }

.rail-people__list .people__row,
.people__row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  transition: background .15s ease;
}
.rail-people__list .people__row:hover { background: var(--d-surface-2); }
.rail-people__list .people__row.is-stale { opacity: .45; }

.rail-people__foot {
  padding: 14px 16px; border-top: 1px solid var(--d-border);
  background: var(--d-bg-2);
}
.rail-people__foot .eyebrow-foot {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--d-text-3); margin-bottom: 6px;
}
.rail-people__foot .code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; color: var(--d-text-2); letter-spacing: 0.04em;
  word-break: break-all;
}
.rail-people__foot-help {
  font-size: 11.5px; color: var(--d-text-3); margin-top: 6px; line-height: 1.45;
}

.dock__btn--mobile-only { display: none; }
@media (max-width: 980px) { .dock__btn--mobile-only { display: inline-flex; } }

/* Stage — chat transcript + composer (the main surface).
   Reset padding explicitly: the landing page's `section { padding: 80px 0 }`
   rule otherwise bleeds into this <section class="stage">. */
.stage {
  padding: 0;
  position: relative; min-width: 0; min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;   /* chat fills, composer shrinks to content */
}

.chat-list {
  min-height: 0; overflow-y: auto;
  padding: 22px 24px 16px;
  display: flex; flex-direction: column; gap: 10px;
  scroll-behavior: smooth;
}
@media (max-width: 620px) { .chat-list { padding: 16px 14px 12px; } }

/* Main composer sits inside the stage — opaque and above chat-list visually */
.composer-main {
  position: relative; z-index: 5;
  border-top: 1px solid var(--d-border);
  background: var(--d-bg-2);
  padding: 14px 20px 16px;
}
.composer-main__inner { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }
.composer-main__row { display: flex; gap: 10px; align-items: flex-end; }
.composer-main textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 160px;
  background: var(--d-surface); color: var(--d-text);
  border: 1px solid var(--d-border); border-radius: 14px;
  padding: 11px 14px; font: inherit; font-size: 14.5px; line-height: 1.5; outline: none;
}
.composer-main textarea::placeholder { color: var(--d-text-3); }
.composer-main textarea:focus { border-color: var(--primary); }

/* Stage empty state = prominent invite card.
   Centered when there's extra vertical space, but allows the card to grow
   and the parent .chat-list to scroll when the card is taller than the pane
   (e.g. the "Advanced" accordion is open on a short viewport). */
.stage-empty {
  flex: 1; min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  color: var(--d-text-2);
  padding: 20px 0;
}

.invite-card {
  pointer-events: auto;
  width: min(620px, 100%);
  padding: 30px 36px 24px;
  background: linear-gradient(180deg, rgba(109,124,255,0.06), rgba(138,102,255,0.03) 60%, transparent), var(--d-surface);
  border: 1px solid var(--d-border-2);
  border-radius: var(--radius-xl);
  box-shadow:
    0 48px 80px -48px rgba(0,0,0,0.55),
    0 0 0 1px rgba(109,124,255,0.08),
    0 0 80px -40px rgba(109,124,255,0.35);
  animation: inviteIn .6s cubic-bezier(.2,.7,.25,1);
}
@keyframes inviteIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.invite-card__head { margin-bottom: 22px; }
.invite-card__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(34,197,94,0.1); color: #66E08E;
  border: 1px solid rgba(34,197,94,0.25);
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  margin-bottom: 16px;
}
.invite-card h3 {
  font-size: clamp(22px, 2.4vw, 28px); font-weight: 700;
  color: var(--d-text); margin: 0 0 10px; letter-spacing: -0.015em;
}
.invite-card p { color: var(--d-text-2); font-size: 14.5px; margin: 0; max-width: 440px; margin-inline: auto; line-height: 1.55; }

.invite-url {
  display: flex; align-items: center; gap: 10px;
  background: var(--d-bg); border: 1px solid var(--d-border);
  padding: 12px 14px; border-radius: 12px;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
  margin: 0 0 18px;
  text-align: left;
}
.invite-url:hover, .invite-url:focus-visible { border-color: var(--primary); background: rgba(109,124,255,0.05); outline: none; }
.invite-url__ico { color: var(--d-text-3); flex: 0 0 auto; }
.invite-url__text {
  flex: 1; min-width: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px; color: var(--d-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  user-select: all;
}
/* Just the pill — same solid-primary palette as the topbar Copy button
   so the action reads as the same weight. Row stays neutral. */
.invite-url__hint {
  flex: 0 0 auto; font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: #fff;
  padding: 4px 10px; border-radius: 999px;
  background: var(--primary); border: 1px solid var(--primary);
  box-shadow: 0 6px 16px -10px rgba(109,124,255,.6);
  transition: background .15s ease, border-color .15s ease;
}
.invite-url:hover .invite-url__hint, .invite-url:focus-visible .invite-url__hint {
  background: var(--primary-d); border-color: var(--primary-d);
}
.invite-url.ok .invite-url__hint {
  color: #fff; background: var(--ok, #22C55E); border-color: var(--ok, #22C55E);
}

.invite-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 22px;
}
.invite-actions .btn--primary {
  padding: 13px 24px; font-size: 15px;
  box-shadow: 0 16px 30px -14px rgba(109,124,255,0.6);
}

.invite-foot {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding-top: 18px; border-top: 1px dashed var(--d-border);
}
.invite-foot__chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--d-text-3);
}
.invite-foot__chip .code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--d-text-2); letter-spacing: 0.04em;
}

.invite-advanced {
  margin: 0 0 18px;
  border-top: 1px dashed var(--d-border);
  padding-top: 14px;
}
.invite-advanced summary {
  cursor: pointer; list-style: none; color: var(--d-text-3);
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 6px;
  user-select: none;
}
.invite-advanced summary::-webkit-details-marker { display: none; }
.invite-advanced summary::before {
  content: "▸"; display: inline-block; color: var(--d-text-3);
  transition: transform .15s ease;
}
.invite-advanced[open] summary::before { transform: rotate(90deg); }
.invite-advanced summary:hover { color: var(--d-text-2); }
.invite-advanced__body { margin-top: 12px; text-align: left; }
.invite-advanced__body p { color: var(--d-text-3); font-size: 13px; margin: 0 0 8px; }
.invite-advanced__body pre {
  background: var(--d-bg); border: 1px solid var(--d-border);
  padding: 10px 12px; border-radius: 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px; color: var(--d-text-2); line-height: 1.55;
  white-space: pre-wrap; word-break: break-all; margin: 0 0 10px;
}

@media (max-width: 620px) {
  .invite-card { padding: 28px 22px 22px; }
}

/* ---- Chat side panel --------------------------------------------- */
.chat {
  min-width: 0; overflow: hidden;
  background: var(--d-bg-2);
  border-left: 1px solid var(--d-border);
  display: flex; flex-direction: column;
}
.thread-pane[hidden] { display: none !important; }
.thread-pane__list { gap: 10px; }
.thread-pane__card {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--d-surface);
  border: 1px solid var(--d-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.thread-pane__card:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--d-border)); }
.thread-pane__card.is-root {
  background: color-mix(in srgb, var(--primary) 14%, var(--d-surface));
  border-color: color-mix(in srgb, var(--primary) 28%, var(--d-border));
}
.thread-pane__card-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--d-text-3);
}
.thread-pane__card-meta strong { color: var(--d-text-2); font-weight: 600; }
.thread-pane__card-body { color: var(--d-text); font-size: 13.5px; line-height: 1.5; }
.thread-pane__card-body p,
.thread-pane__card-body ul,
.thread-pane__card-body ol,
.thread-pane__card-body pre { margin: 0; }
.thread-pane__card-body ul,
.thread-pane__card-body ol { padding-left: 18px; }
.thread-pane__card-jump {
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 600;
}
.thread-pane__foot {
  padding: 14px 16px;
  border-top: 1px solid var(--d-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.thread-pane__hint {
  font-size: 12px;
  color: var(--d-text-3);
  line-height: 1.45;
}
.thread-pane__empty {
  color: var(--d-text-3);
  font-size: 12.5px;
  text-align: center;
  padding: 22px 14px;
}
.chat__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--d-border); }
.chat__head h4 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.chat__head .muted { color: var(--d-text-3); font-size: 12px; }
.chat__close { background: transparent; border: 0; color: var(--d-text-2); width: 28px; height: 28px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chat__close:hover { background: var(--d-surface); color: var(--d-text); }

.chat__list { flex: 1; overflow-y: auto; padding: 14px 14px 4px; display: flex; flex-direction: column; gap: 8px; }

.bubble {
  position: relative;
  max-width: min(640px, 78%);
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px; border-radius: 14px;
  font-size: 14.5px; line-height: 1.5;
  word-wrap: break-word; overflow-wrap: anywhere;
  animation: bubbleIn .22s ease-out;
}
.bubble__del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,0.25); color: #fff;
  font-size: 14px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.bubble:hover .bubble__del,
.bubble:focus-within .bubble__del,
.bubble__del:focus-visible { opacity: 1; }
.bubble__del:hover,
.bubble__del:focus-visible { background: rgba(220,38,38,0.9); outline: none; }

.bubble__link-btn {
  position: absolute; top: 4px; right: 82px;
  width: 22px; height: 22px; line-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,0.25); color: #fff;
  cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s;
}
.bubble:hover .bubble__link-btn,
.bubble:focus-within .bubble__link-btn,
.bubble__link-btn:focus-visible { opacity: 1; }
.bubble__link-btn:hover,
.bubble__link-btn:focus-visible { background: rgba(59,130,246,0.9); outline: none; }

.bubble__reply-btn {
  position: absolute; top: 4px; right: 30px;
  width: 22px; height: 22px; line-height: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,0.25); color: #fff;
  cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s;
}
.bubble:hover .bubble__reply-btn,
.bubble:focus-within .bubble__reply-btn,
.bubble__reply-btn:focus-visible { opacity: 1; }
.bubble__reply-btn:hover,
.bubble__reply-btn:focus-visible { background: rgba(59,130,246,0.9); outline: none; }

.bubble__reply-ref {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 10px; margin-bottom: 4px;
  border-left: 3px solid var(--primary, #3B82F6);
  border-radius: 6px;
  background: rgba(59,130,246,0.08);
  cursor: pointer; font-size: 12px; line-height: 1.35;
  min-width: 0;                   /* flex item: allow shrinking */
  max-width: 100%;
  overflow: hidden;               /* clip long children so text-overflow: ellipsis on the preview can engage */
}
.bubble__reply-ref:hover { background: rgba(59,130,246,0.14); }
.bubble__reply-ref.is-dead {
  border-left-color: var(--d-text-3);
  background: rgba(0,0,0,0.1);
  color: var(--d-text-3);
  font-style: italic;
  cursor: default;
}
.bubble__reply-ref__label {
  font-weight: 600; color: var(--d-text-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.02em;
}
.bubble__reply-ref.is-dead .bubble__reply-ref__label { color: var(--d-text-3); }
.bubble__reply-ref__preview {
  color: var(--d-text-2);
  display: block;                 /* block so max-width + ellipsis work */
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bubble.is-flash { animation: bubbleFlash .9s ease-out; }
@keyframes bubbleFlash {
  0%   { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #3B82F6) 60%, transparent); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

.replying-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 4px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary, #3B82F6) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary, #3B82F6) 30%, transparent);
  font-size: 12.5px;
}
/* `display: flex` above has the same specificity as the user-agent
 * `[hidden] { display: none }` rule and wins by later-declaration,
 * which left an empty ~22px strip visible between namechip and the
 * message input when no reply was active. Force-hide with !important
 * so the JS-controlled `hidden` attribute always takes effect. */
.replying-pill[hidden] { display: none !important; }
.replying-pill__lbl { font-weight: 600; color: var(--primary, #3B82F6); }
.replying-pill__snip { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--d-text-2); }
.replying-pill__x {
  background: transparent; border: none; color: var(--d-text-3);
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.replying-pill__x:hover { color: var(--d-text-1); }

.bubble__react-btn {
  position: absolute; top: 4px; right: 56px;
  width: 22px; height: 22px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 999px;
  background: rgba(0,0,0,0.25);
  font-size: 13px; cursor: pointer;
  opacity: 0; transition: opacity .12s, background .12s;
}
.bubble:hover .bubble__react-btn,
.bubble:focus-within .bubble__react-btn,
.bubble__react-btn:focus-visible { opacity: 1; }
.bubble__react-btn:hover,
.bubble__react-btn:focus-visible { background: rgba(59,130,246,0.9); outline: none; }

/* Touch-device UX: hover doesn't fire on tap, so the bubble action
 * buttons would stay invisible. Force them visible on any viewport
 * that reports hover:none (mobile / tablet) so the × / ↩ / 😀 icons
 * are discoverable without a pointer. */
@media (hover: none) {
  .bubble__del, .bubble__reply-btn, .bubble__react-btn, .bubble__link-btn { opacity: 1; }
}

.bubble__react-picker {
  position: absolute; top: 28px; right: 4px;
  display: flex; gap: 2px;
  padding: 4px 6px; border-radius: 999px;
  background: var(--d-surface-2, #1a1a22);
  border: 1px solid var(--d-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10;
}
.bubble__react-pick {
  border: none; background: transparent;
  font-size: 18px; line-height: 1;
  padding: 4px 6px; border-radius: 999px;
  cursor: pointer;
}
.bubble__react-pick:hover { background: var(--d-surface-3, rgba(255,255,255,0.08)); }
.bubble__react-pick--custom {
  font-size: 15px; font-weight: 700;
  color: var(--d-text-3);
  border-left: 1px solid var(--d-border); margin-left: 2px;
}
.bubble__react-pick--custom:hover { color: var(--d-text-1); }

.bubble__reactions {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.bubble__reactions[hidden] { display: none; }
.bubble__react-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--d-border);
  background: rgba(0,0,0,0.15);
  font-size: 12px; cursor: pointer;
  color: var(--d-text-2);
}
.bubble__react-pill:hover { background: rgba(0,0,0,0.22); }
.bubble__react-pill.is-mine {
  border-color: var(--primary, #3B82F6);
  background: color-mix(in srgb, var(--primary, #3B82F6) 18%, transparent);
  color: var(--d-text-1);
}
.bubble__react-emoji { font-size: 13px; line-height: 1; }
.bubble__react-count { font-weight: 600; }
.bubble__ttl {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 4px;
  align-self: flex-start;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--d-text-3);
  padding: 2px 7px 2px 5px; border-radius: 999px;
  background: rgba(0,0,0,0.18);
}
.bubble--self .bubble__ttl { color: rgba(255,255,255,0.85); background: rgba(0,0,0,0.28); }
.bubble__ttl svg { opacity: 0.75; }

#topbar-settings.is-active { color: var(--primary); }
#topbar-settings.is-active::after {
  content: ''; width: 7px; height: 7px; border-radius: 999px;
  background: var(--primary); position: absolute; top: 4px; right: 4px;
}
#topbar-settings { position: relative; }

.settings-pop {
  position: fixed; z-index: 60;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px;
  background: var(--d-surface-2, #1a1a22); border: 1px solid var(--d-border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  min-width: 260px;
}
.settings-pop__head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--d-text-3);
  padding: 4px 8px 2px 8px;
}
.settings-pop__sub {
  font-size: 12px; color: var(--d-text-3); padding: 0 8px 6px 8px;
}
.settings-pop__sep {
  height: 1px; background: var(--d-border); margin: 8px 0;
}
.settings-pop__row {
  text-align: left; padding: 7px 10px; border-radius: 6px;
  background: transparent; border: none; color: var(--d-text-1);
  font-size: 13.5px; cursor: pointer;
}
.settings-pop__row:hover { background: var(--d-surface-3, rgba(255,255,255,0.05)); }
.settings-pop__row.is-active { color: var(--primary); font-weight: 600; }
.settings-pop__row--alt {
  margin-top: 4px; border: 1px solid var(--d-border);
  text-align: center; font-weight: 600;
}
.settings-pop__row--alt.is-active { border-color: var(--primary); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.bubble__meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 500; color: var(--d-text-3); }
.bubble__meta .sender { color: var(--d-text-2); }
.bubble__ava {
  width: 20px; height: 20px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 9.5px;
  flex: 0 0 auto;
}
.bubble__body {
  color: var(--d-text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bubble__body p,
.bubble__body ul,
.bubble__body ol,
.bubble__body pre { margin: 0; }
.bubble__body ul,
.bubble__body ol { padding-left: 20px; }
.bubble__body a {
  color: #8FA4FF;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, #8FA4FF 55%, transparent);
}
.bubble__body a:hover { color: #B8C5FF; }
.bubble__body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
}
.bubble__body pre {
  overflow-x: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.08);
}
.bubble__body pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.bubble__body em { font-style: italic; }
.bubble__body strong { font-weight: 700; }
.bubble--self { align-self: flex-end; background: color-mix(in srgb, var(--primary) 28%, #1A1F33); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.bubble--self .bubble__body { color: #F1F3FC; }
.bubble--self .bubble__body code { background: rgba(0,0,0,0.22); }
.bubble--self .bubble__body pre { background: rgba(0,0,0,0.28); border-color: rgba(255,255,255,0.08); }
.bubble--other { align-self: flex-start; background: var(--d-surface); border: 1px solid var(--d-border); }

.chat__empty { color: var(--d-text-3); font-size: 13px; text-align: center; padding: 40px 20px; }

.chat__compose { padding: 12px 14px 14px; border-top: 1px solid var(--d-border); background: var(--d-bg-2); }
.chat__compose form { display: flex; flex-direction: column; gap: 8px; }
.namechip {
  background: var(--d-surface); color: var(--d-text);
  border: 1px solid var(--d-border); border-radius: 10px;
  padding: 8px 12px; font-size: 12px; width: 100%; outline: none;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.namechip:focus { border-color: var(--primary); }
.chat__row { display: flex; gap: 8px; align-items: flex-end; }
.chat__row textarea {
  flex: 1; resize: none; min-height: 40px; max-height: 140px;
  background: var(--d-surface); color: var(--d-text);
  border: 1px solid var(--d-border); border-radius: 14px;
  padding: 10px 14px; font: inherit; font-size: 14.5px; line-height: 1.45; outline: none;
}
.chat__row textarea::placeholder { color: var(--d-text-3); }
.chat__row textarea:focus { border-color: var(--primary); }
.chat__send {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--primary); color: #fff; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .1s ease;
}
.chat__send:hover { background: var(--primary-d); }
.chat__send:active { transform: translateY(1px); }
.chat__hint { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: var(--d-text-3); text-align: center; }
.chat__hint.warn { color: #FDBA74; }

/* (Bottom dock removed — Copy / Leave moved to the topbar.) */

/* ---- Participant row primitives (used in left rail) -------------- */
.people__ava { width: 28px; height: 28px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.people__name { flex: 1; font-size: 13.5px; color: var(--d-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people__tag { color: var(--d-text-3); font-size: 11.5px; }

/* ---- Link copy toast --------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(10px);
  background: var(--d-surface); color: var(--d-text);
  border: 1px solid var(--d-border); border-radius: 999px;
  padding: 10px 16px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .18s ease, transform .18s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .d { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); }

/* ---- Docs page --------------------------------------------------- */
.doc-body { max-width: 800px; margin: 0 auto; padding: 64px 28px 120px; }
.doc-body h1 { font-size: clamp(36px, 5vw, 48px); margin: 14px 0 12px; letter-spacing: -0.02em; line-height: 1.05; font-weight: 700; }
.doc-body h2 { font-size: 24px; margin: 56px 0 12px; letter-spacing: -0.01em; font-weight: 650; }
.doc-body h3 { font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary-d); margin: 28px 0 8px; font-weight: 600; }
.doc-body p { color: var(--text-2); font-size: 16px; line-height: 1.68; }
.doc-body p.doc-lead { font-size: 18.5px; color: var(--text); max-width: 700px; margin: 0 0 34px; }
.doc-body code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; background: var(--bg-2); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); color: var(--text); }
.doc-body pre { background: #0E111A; color: #E6E9F4; border: 1px solid #1C2030; padding: 16px 20px; margin: 16px 0 24px; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; line-height: 1.7; overflow-x: auto; border-radius: var(--radius); }
.doc-body pre code { background: none; padding: 0; border: 0; color: inherit; }
.doc-body ul { padding-left: 22px; color: var(--text-2); }
.doc-body li { margin: 6px 0; }
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px 6px; padding: 10px 14px; margin: 22px 0 36px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); align-items: center; }
.doc-toc .eyebrow-pill { margin: 0 6px 0 0; }
.doc-toc a { color: var(--text-2); text-decoration: none; font-size: 13.5px; padding: 8px 10px; border-radius: 8px; min-height: 32px; display: inline-flex; align-items: center; }
.doc-toc a:hover { background: var(--bg-2); color: var(--text); }
.link-u { color: var(--text); border-bottom: 1px solid var(--primary); text-decoration: none; padding: 6px 2px; display: inline-block; }
.link-u:hover { color: var(--primary-d); }

/* Utility */
.stack-y-sm > * + * { margin-top: 10px; }

/* Signed-sender UI (room) — iOS-style switch tucked inside the invite card.
   Lives next to the key fingerprint since both describe room-level
   configuration, not per-message composer behaviour. Hidden by default;
   shown only when the visitor has a signed-in Identity (JS sets [hidden]). */
.signed-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 14px 0 0; padding: 10px 14px;
  border: 1px solid var(--d-border); border-radius: 10px;
  background: var(--d-bg); color: var(--d-text);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.signed-toggle:hover { border-color: var(--d-border-2); }
.signed-toggle__text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.35; }
.signed-toggle__text strong { font-weight: 600; letter-spacing: -0.005em; }
.signed-toggle__sub { font-size: 11.5px; color: var(--d-text-3); }

/* Actual checkbox — visually hidden but still focusable. */
.signed-toggle__input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
/* The switch track + thumb. */
.signed-toggle__switch {
  position: relative; flex: 0 0 auto;
  width: 36px; height: 20px; border-radius: 999px;
  background: var(--d-border); transition: background .15s ease;
}
.signed-toggle__switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}
.signed-toggle__input:checked ~ .signed-toggle__switch {
  background: var(--primary);
}
.signed-toggle__input:checked ~ .signed-toggle__switch::after {
  transform: translateX(16px);
}
.signed-toggle__input:focus-visible ~ .signed-toggle__switch {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.signed-overlay {
  position: fixed; inset: 0; background: rgba(11,13,20,0.82);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  backdrop-filter: blur(3px);
}
/* hidden attribute must trump the display:flex above, otherwise Playwright
   (and real users) see the overlay consume pointer events on first render. */
.signed-overlay[hidden] { display: none !important;
}
.signed-overlay__card {
  background: var(--surface-1); padding: 28px 32px; border-radius: 14px;
  max-width: 420px; border: 1px solid var(--border); color: var(--text);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.signed-overlay__card h3 { margin: 0 0 10px; font-size: 18px; }
.signed-overlay__card p { margin: 0 0 16px; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }

/* Unified Copy menu (replaces 5 separate topbar buttons).
   Lives on the room page, which is dark-themed — so colours come from
   the --d-* palette, not the default light-theme --surface-* variables. */
.copy-wrap { position: relative; display: inline-block; }
.copy-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 260px; max-width: min(320px, 92vw);
  background: var(--d-surface); color: var(--d-text);
  border: 1px solid var(--d-border-2); border-radius: 12px;
  box-shadow: 0 20px 48px -18px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.35);
  padding: 6px; z-index: 80;
}
.copy-menu[hidden] { display: none !important; }
.copy-menu__item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; color: var(--d-text); font: inherit;
}
.copy-menu__item:hover, .copy-menu__item:focus-visible {
  background: var(--d-surface-2); color: var(--d-text); outline: none;
}
.copy-menu__item:hover .copy-menu__s, .copy-menu__item:focus-visible .copy-menu__s {
  color: var(--d-text-2);
}
.copy-menu__t { display: block; font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; color: var(--d-text); }
.copy-menu__s { display: block; font-size: 12px; color: var(--d-text-3); margin-top: 2px; line-height: 1.35; }
.copy-menu__sep { height: 1px; background: var(--d-border-2); margin: 4px 8px; opacity: 0.55; }

/* Invite card action row — one primary CTA + subtle hint to topbar. */
.invite-actions__hint { font-size: 12.5px; color: var(--d-text-3); margin-left: 8px; align-self: center; }
.invite-actions__hint strong { color: var(--d-text-2); font-weight: 600; }

/* Sidebar "Promote to signed" button — appears next to anon participants
   whose box_pub is known. Small, understated; primary hover so it's
   discoverable without shouting. */
.people__promote {
  margin-left: auto;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--d-text-3);
  border: 1px solid var(--d-border); transition: all .15s ease;
}
.people__promote:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.people__promote:disabled { opacity: .5; cursor: wait; }
.people__heartbeat {
  margin-left: auto;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--d-text-3);
  padding: 2px 7px; border-radius: 999px;
  background: transparent;
  border: 1px solid var(--d-border);
  white-space: nowrap;
}
.people__heartbeat.is-live {
  color: var(--ok, #22c55e);
  border-color: color-mix(in srgb, var(--ok, #22c55e) 40%, transparent);
  background: color-mix(in srgb, var(--ok, #22c55e) 10%, transparent);
}
.people__heartbeat.is-idle {
  color: #FBBF24;
  border-color: color-mix(in srgb, #FBBF24 40%, transparent);
  background: color-mix(in srgb, #FBBF24 10%, transparent);
}
.people__heartbeat.is-silent {
  color: var(--d-text-3);
  background: rgba(0,0,0,0.12);
}
.people__tag--verified {
  color: var(--ok, #22C55E); font-weight: 700; margin-left: 4px;
}
.bubble__thread-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.bubble__thread-btn:hover {
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}
.search-pop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(11,13,20,0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 18px 24px;
}
.search-pop[hidden] { display: none !important; }
.search-pop__card {
  width: min(760px, 100%);
  max-height: min(72vh, 720px);
  background: var(--d-surface);
  border: 1px solid var(--d-border-2);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-pop__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--d-border);
}
.search-pop__head input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--d-text);
  font: 600 15px Geist, sans-serif;
}
.search-pop__head input::placeholder { color: var(--d-text-3); }
.search-pop__sub {
  padding: 8px 14px 10px;
  font-size: 12px;
  color: var(--d-text-3);
  border-bottom: 1px solid var(--d-border);
}
.search-pop__results {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-pop__result {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--d-text);
  padding: 10px 12px;
  cursor: pointer;
}
.search-pop__result:hover,
.search-pop__result:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 24%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  outline: none;
}
.search-pop__result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--d-text-3);
}
.search-pop__result-meta strong { color: var(--d-text-2); font-weight: 600; }
.search-pop__result-text {
  color: var(--d-text);
  font-size: 13.5px;
  line-height: 1.5;
}
.search-pop__empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--d-text-3);
  font-size: 12.5px;
}
