/* ── Up24Seven shared styles ───────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* The browser's default `[hidden] { display: none }` user-agent rule is
   lower specificity than the explicit `display: flex` we put on .sheet,
   .t-menu, etc., so without this !important escape the `hidden`
   attribute silently does nothing on those elements. Result: sheets
   stacked on top of each other, menus that wouldn't close. */
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
  background: #f6f7fb;
  line-height: 1.45;
}

a { color: inherit; }
.hidden { display: none !important; }

.muted { color: #6b7280; font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.topbar__brand {
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.topbar__nav { display: flex; gap: 14px; align-items: center; }
.topbar__email { font-size: 13px; color: #6b7280; }
.topbar__link {
  background: none; border: none; cursor: pointer;
  color: #2563eb; text-decoration: none; font-weight: 600; font-size: 14px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  color: #1f2937;
  transition: transform 0.05s ease, background 0.15s ease;
}
.btn:hover { background: #f3f4f6; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.btn--primary:hover { background: #000; }

/* ── Auth status ─────────────────────────────────────────────────── */
.auth__status {
  margin-top: 10px;
  font-size: 13px;
  min-height: 1em;
}
.auth__status[data-tone="good"] { color: #059669; }
.auth__status[data-tone="bad"] { color: #dc2626; }
.auth__status[data-tone="info"] { color: #6b7280; }

/* ── Landing hero ────────────────────────────────────────────────── */
.hero {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px;
  text-align: center;
}
.hero__title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.hero__sub { color: #4b5563; font-size: 18px; margin-bottom: 32px; }
.hero__bullets {
  list-style: none;
  margin-top: 30px;
  color: #6b7280;
  font-size: 14px;
  text-align: left;
  display: inline-block;
}
.hero__bullets li { padding: 4px 0; }
.hero__bullets li::before { content: "✓ "; color: #059669; }
.public-url { margin: 18px 0; font-size: 15px; }
.public-url a { color: #2563eb; word-break: break-all; }

.auth { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: 0 auto; }
.auth__label { font-size: 13px; color: #4b5563; text-align: left; }
.auth__input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 16px;
  background: #fff;
}
.auth__cta { padding: 12px 16px; font-size: 16px; }

.foot {
  margin: 40px 0 24px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

/* ── Dashboard ───────────────────────────────────────────────────── */
.dash {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 20px;
}
.dash__h1 { font-size: 28px; font-weight: 800; margin-bottom: 18px; }
.dash__signedout { text-align: center; padding: 60px 20px; }
.dash__signedout a { color: #2563eb; font-weight: 600; }

.twin-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.twin-list__item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: border 0.1s;
}
.twin-list__item:hover { border-color: #111827; }
.twin-list__item img {
  width: 56px; height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
}
.twin-list__item strong { display: block; font-size: 15px; }
.twin-list__item p { font-size: 13px; color: #4b5563; }
.twin-list__item small { font-size: 12px; color: #9ca3af; }

/* ── Create form ─────────────────────────────────────────────────── */
.create {
  margin-top: 24px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
}
.create h2 { font-size: 18px; margin-bottom: 14px; }
.create__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 4px;
}
.create__label span { color: #9ca3af; font-weight: 400; }
.create input, .create textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 15px;
  background: #fff;
}
.create__hint { margin: 12px 0 16px; font-size: 13px; color: #6b7280; }

/* ── Editor ─────────────────────────────────────────────────────── */
.back-link {
  background: none; border: none;
  color: #2563eb; font-weight: 600; font-size: 14px;
  cursor: pointer; margin-bottom: 14px;
}
.editor__head {
  display: flex; gap: 16px; align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.editor__photo {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
}
.editor__name { font-size: 22px; font-weight: 800; }
.editor__title { color: #4b5563; font-size: 14px; }
.editor__url { color: #2563eb; font-size: 13px; word-break: break-all; }

.editor__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
}
.card h3 { font-size: 13px; color: #6b7280; font-weight: 600; }
.card__big { font-size: 26px; font-weight: 800; margin-top: 4px; }

.editor__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 16px;
}
.tab {
  background: none;
  border: none;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 14px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.is-active { color: #111827; border-bottom-color: #111827; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ── Settings/Personality/Contact forms ──────────────────────────── */
.settings {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
}
.settings label {
  display: block; font-size: 13px; font-weight: 600;
  margin-top: 12px; margin-bottom: 4px;
}
.settings input, .settings textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}
.settings__photo {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
}
.slider { margin: 14px 0; }
.slider label { font-size: 13px; font-weight: 600; }
.slider input[type=range] { width: 100%; }

/* ── Publish bar ─────────────────────────────────────────────────── */
.publish-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

/* ── Chat ─────────────────────────────────────────────────────── */
.chatlog {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  min-height: 240px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  padding: 9px 12px;
  border-radius: 14px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble--twin {
  background: #f3f4f6;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.bubble--visitor {
  background: #111827;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.composer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.composer input {
  flex: 1;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 15px;
}

/* ── Conversations / Leads lists ─────────────────────────────────── */
.convo-list, .leads-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.convo-list__item, .leads-list__item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
}
.convo-list__item strong { font-size: 14px; }
.convo-list__item p { font-size: 13px; color: #4b5563; margin-top: 2px; }
.convo-list__item small { font-size: 13px; color: #6b7280; }
.leads-list__item strong { font-size: 15px; }
.leads-list__item p { font-size: 13px; color: #4b5563; margin: 2px 0; }
.leads-list__item small { font-size: 13px; color: #6b7280; }
.empty {
  background: transparent;
  border: 1px dashed #d1d5db;
  text-align: center;
  color: #9ca3af;
  padding: 18px;
}

/* ── Responsive (landing + dashboard) ─────────────────────────────── */
@media (max-width: 600px) {
  .hero__title { font-size: 30px; }
  .editor__cards { grid-template-columns: 1fr 1fr; }
}

/* ── Handle row (landing + dashboard handle input) ───────────────── */
.handle-row {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
}
.handle-row__prefix {
  background: #f3f4f6;
  padding: 12px 14px;
  font-size: 14px;
  color: #6b7280;
  border-right: 1px solid #e5e7eb;
}
.handle-row__input {
  flex: 1;
  padding: 12px 14px;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
}
.handle-row .btn { border-radius: 0; border: none; border-left: 1px solid #e5e7eb; }

.auth__hint {
  display: block;
  color: #6b7280;
  font-size: 12px;
  font-weight: 400;
  margin-top: 2px;
}
.auth__hint strong { color: #111827; font-weight: 600; }

/* ── Editor chip (Private label, etc.) ───────────────────────────── */
.editor__chip {
  display: inline-block;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}

/* ──────────────────────────────────────────────────────────────────
   Public twin page — only4you-style chat shell.

   Layout: body locks scroll. .app is a flex column 100dvh tall,
   max-width 480px centered. Header + composer are flex-shrink:0;
   the middle .chat area is the only thing that scrolls. This is
   the same architecture only4you.ai uses.
   ────────────────────────────────────────────────────────────── */

body.page--twin {
  overflow: hidden;
  background: #f8f9fb;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  background: #fff;
}

/* ── Header (sticky top) ─────────────────────────────────────────── */

.t-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  z-index: 10;
}
.t-header__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
  flex-shrink: 0;
}
.t-header__info { flex: 1; min-width: 0; }
.t-header__name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-header__status {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.t-header__status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.55);
  animation: t-pulse 2s infinite;
}
@keyframes t-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* Burger button + dropdown menu */
.t-menu-wrap { position: relative; flex-shrink: 0; }
.t-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
}
.t-menu-btn:hover,
.t-menu-btn[aria-expanded="true"] {
  color: #111827;
  background: #f3f4f6;
}
.t-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: t-menu-in 0.12s ease-out;
}
@keyframes t-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.t-menu__item {
  background: transparent;
  border: none;
  color: #111827;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-family: inherit;
}
.t-menu__item:hover { background: #f3f4f6; }
.t-menu__item--cta {
  background: #111827;
  color: #fff;
}
.t-menu__item--cta:hover { background: #000; }

/* ── Owner action strip — sits directly below the header ────────────
   The user wants Preview/Edit/Publish/Manage as VISIBLE controls in
   the top section, not buried inside a burger menu. This is the strip
   that hosts them. Only renders when the device owns the twin. */

.t-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  flex-shrink: 0;
  overflow-x: auto;          /* horizontal scroll if buttons exceed width */
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.t-actions::-webkit-scrollbar { display: none; }
.t-actions__chip {
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.t-actions__chip--live {
  background: #16a34a;
}
.t-actions__btn {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #111827;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  font-family: inherit;
}
.t-actions__btn:hover { background: #f3f4f6; }
.t-actions__btn--primary {
  background: #111827;
  color: #fff;
  border-color: #111827;
  margin-left: auto;          /* push primary to the right edge */
}
.t-actions__btn--primary:hover { background: #000; }

/* ── Scrollable chat region ─────────────────────────────────────── */

.t-chat {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 4px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.t-chat::-webkit-scrollbar { width: 4px; }
.t-chat::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* Welcome block (greeting + image + CTAs), shown above the
   conversation. On the public twin page, name/headline/tagline go
   here — the header bar already shows the small name + status. */
.t-welcome {
  text-align: center;
  padding: 12px 4px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.t-welcome__name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: #111827;
}
.t-welcome__headline {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  margin-top: 6px;
}
.t-welcome__tagline {
  font-size: 14px;
  color: #6b7280;
  margin-top: 2px;
}
.t-welcome__photo {
  width: 160px;
  height: 160px;
  border-radius: 22px;
  object-fit: cover;
  margin-top: 14px;
  background: #f3f4f6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* CTA pill row (Call · Text · Email · Book · Website) */
.t-ctas {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 16px 0 4px;
}
.t-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: #1f2937;
}
.t-cta:hover { background: #e5e7eb; }
.t-cta__ico { font-size: 14px; line-height: 1; }

/* Message bubbles */
.t-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.t-bubble {
  max-width: min(320px, 80%);
  padding: 10px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  border-radius: 20px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.t-bubble--twin {
  align-self: flex-start;
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.t-bubble--visitor {
  align-self: flex-end;
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.20);
}
/* ── Typing indicator + cold-start (matches only4you UX) ──────────
   Initial state: three bouncing dots inside an AI bubble (.t-bubble
   --typing). After ~10s of waiting (cold dyno / slow LLM), the JS
   swaps the dots for a rotating short message in italic with a gentle
   pulse so it reads as "still working" not "Mia said this". */
.t-bubble--typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 14px 18px;
  min-height: 0;
}
.t-typing-dot {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  display: inline-block;
  animation: t-typing-blink 1.35s infinite both;
}
.t-typing-dot:nth-child(2) { animation-delay: 0.18s; }
.t-typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes t-typing-blink {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35%            { opacity: 1;    transform: translateY(-3px); }
}
.t-bubble--cold {
  font-style: italic;
  color: #6b7280;
  animation: t-cold-pulse 1.6s ease-in-out infinite;
}
@keyframes t-cold-pulse {
  0%, 100% { opacity: 0.72; }
  50%      { opacity: 1; }
}

/* ── Composer (bottom of flex column, not position:fixed) ───────── */

.t-composer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.t-composer__input {
  flex: 1;
  background: #f8f9fb;
  border: 1px solid #d1d5db;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 16px;          /* 16px prevents iOS zoom-on-focus */
  line-height: 1.4;
  color: #111827;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  font-family: inherit;
  /* Hide the scrollbar by default — autosize() in twin.js flips to
     `auto` only once the text actually exceeds the max-height. Without
     this, browsers (Safari/Firefox especially) render a 12-15px gutter
     on the empty textarea. */
  overflow-y: hidden;
}
.t-composer__input:focus {
  border-color: #111827;
  background: #fff;
}
.t-composer__send {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: #111827;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.t-composer__send:hover  { background: #000; }
.t-composer__send:active { transform: scale(0.95); }
.t-composer__send svg    { width: 18px; height: 18px; }

/* ── Bottom sheets (lead capture, publish modal) ────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 70;
}
.sheet__inner {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.2);
}
.sheet__inner h2 { font-size: 18px; margin-bottom: 4px; }
.sheet__inner p  { color: #6b7280; font-size: 14px; margin-bottom: 12px; }
.sheet__inner label {
  display: block; font-size: 13px; font-weight: 600;
  margin-top: 10px; margin-bottom: 4px;
}
.sheet__inner input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

/* ── Dashboard editor — action stack + cta fieldset ─────────────── */
.editor__head { flex-wrap: wrap; }
.editor__meta { flex: 1 1 220px; }
.editor__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.cta-fields {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 14px 16px;
  margin-top: 16px;
}
.cta-fields legend {
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
  color: #111827;
}
.cta-fields .muted { margin-bottom: 6px; }

/* ── Tone select (dropdown in dashboard Edit form) ───────────────── */
#tone-select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background: #fff;
  flex: 1;
}

/* ── Setup page (Step 2 of the create wizard) ───────────────────── */
.step-tag {
  display: inline-block;
  background: #eef2ff;
  color: #4338ca;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.setup-card {
  max-width: 520px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 22px;
  text-align: left;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.setup-card__head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 18px;
}
.setup-card__avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: #f3f4f6;
  flex-shrink: 0;
}
.setup-card__name {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}
.setup-card__tagline {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

/* ── In-button spinner (used by landing.js during create) ────────── */
.btn-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: btn-spin 0.75s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
.btn--primary[disabled] {
  background: #374151;
  cursor: progress;
}

/* ── Setup page: "Have a website?" fetch row ────────────────────── */
.fetch-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.fetch-row__input {
  flex: 1;
  min-width: 0;          /* allow flex shrink in narrow viewports */
}
.fetch-row__btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Fetch button under the URL input on the setup page. */
.fetch-btn {
  margin-top: 8px;
  width: 100%;
}

/* ── Setup page v2: edit + live chat side-by-side ──────────────── */
.setup-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 20px 60px;
  text-align: center;
}
.setup-page .step-tag { margin-bottom: 14px; }
.setup-page .hero__title { margin-bottom: 6px; }
.setup-page .hero__sub { margin-bottom: 28px; }

.setup-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  text-align: left;
}
@media (min-width: 900px) {
  .setup-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: start;
  }
}

.setup-pane {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px 18px 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.setup-pane__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 14px;
}
.setup-pane__head .setup-card__avatar { width: 44px; height: 44px; }
.setup-pane__head .setup-card__name { font-size: 16px; font-weight: 700; }
.setup-pane__link {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: #2563eb; font-weight: 600; font-size: 13px;
}
.setup-pane__form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.setup-pane__form .auth__label { margin-top: 12px; }
.setup-pane__form .auth__input,
.setup-pane__form textarea {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
}
.setup-pane__form textarea { resize: vertical; }
.setup-pane__form .setup-pane__qna {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}
.setup-pane__cta {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  justify-content: flex-end;
}

/* Chat pane — fixed-ish height with internal scrolling */
.setup-pane--chat {
  height: 100%;
  min-height: 520px;
}
.setup-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 2px 8px;
  min-height: 260px;
  max-height: 60vh;
}
.setup-chat-scroll::-webkit-scrollbar { width: 4px; }
.setup-chat-scroll::-webkit-scrollbar-thumb {
  background: #e5e7eb; border-radius: 4px;
}
.setup-pane__composer {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
  padding: 8px 10px;
  margin-top: 10px;
}
.setup-pane__composer .t-composer__input {
  background: transparent;
  border: none;
}

/* ── Featured CTA on the public twin page ───────────────────────── */
.t-featured-cta {
  display: inline-block;
  background: #111827;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 13px 28px;
  border-radius: 999px;
  text-decoration: none;
  margin-top: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.t-featured-cta:hover {
  background: #000;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}
.t-featured-cta:active { transform: translateY(0); }

/* Danger button (Delete Agent in the dashboard) */
.btn--danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.btn--danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* Smaller font on the long-form textareas (setup page + dashboard) */
#s-bio, #s-qna,
[data-field="bio"], [data-field="qna"] {
  font-size: 13.5px;
  line-height: 1.5;
}

/* Lock the primary-button text white in every state — including the
   browser's default greyed-out look on `disabled` (which we hit while
   the spinner is rotating during create / fetch). */
.btn--primary,
.btn--primary:hover,
.btn--primary:active,
.btn--primary:focus,
.btn--primary:disabled,
.btn--primary[disabled] {
  color: #ffffff;
}
.btn--primary[disabled] { opacity: 1; }
.btn--primary > span,
.btn--primary > .btn-spin { color: inherit; }

/* ── Conversations list (with inline transcript expand) ────────── */
.convo-row {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  margin-bottom: 10px;
  list-style: none;
  overflow: hidden;
}
.convo-row__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}
.convo-row__head:hover { background: #f9fafb; }
.convo-row__date { font-weight: 700; font-size: 14px; color: #111827; }
.convo-row__count { font-size: 13px; color: #6b7280; }
.convo-row__caret {
  margin-left: auto;
  color: #6b7280;
  font-size: 12px;
}
.convo-row__lead {
  padding: 0 14px 6px;
  font-size: 13px;
  color: #1f2937;
}
.convo-row__lead strong { color: #111827; }
.convo-row__intent {
  padding: 0 14px 6px;
  font-size: 13px;
  color: #4b5563;
  font-style: italic;
}
.convo-row__summary {
  display: block;
  padding: 0 14px 12px;
  font-size: 13px;
  color: #6b7280;
}
.convo-row__transcript {
  border-top: 1px solid #e5e7eb;
  padding: 14px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.convo-row__transcript .t-bubble {
  max-width: 80%;
  font-size: 13.5px;
}

/* Structured lead body in the dashboard Leads tab */
.convo-row__body {
  padding: 0 14px 12px;
}
.lead__name {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}
.lead__name--anon {
  font-weight: 600;
  color: #9ca3af;
}
.lead__row {
  font-size: 13px;
  line-height: 1.55;
  color: #1f2937;
  margin: 2px 0;
  display: flex;
  gap: 6px;
}
.lead__key {
  display: inline-block;
  min-width: 64px;
  color: #6b7280;
  font-weight: 600;
  flex-shrink: 0;
}

/* Two-column stat-card grid (when Leads card is dropped) */
.editor__cards--two { grid-template-columns: repeat(2, 1fr); }

/* Muted "not shared" placeholder in lead rows */
.lead__val--missing {
  color: #9ca3af;
  font-style: italic;
}

/* Inline key on the .lead__name header so it aligns with the rows below */
.lead__name { display: flex; align-items: baseline; gap: 6px; }
.lead__name .lead__key {
  font-size: 13px;    /* match other key labels */
  font-weight: 600;
  color: #6b7280;
}

/* Match Name value to the rest of the lead rows (same font size + weight) */
.lead__name {
  font-size: 13px;
  font-weight: 400;
  color: #1f2937;
  line-height: 1.55;
  margin-bottom: 0;
  margin-top: 2px;
}
.lead__name--anon { font-weight: 400; color: #1f2937; }

/* Topbar burger-menu wrapper (landing + dashboard) */
.topbar__menu-wrap { position: relative; }
.topbar__menu-wrap .t-menu-btn {
  background: none; border: none; cursor: pointer;
  color: #6b7280; padding: 6px; border-radius: 8px;
  display: flex; align-items: center;
}
.topbar__menu-wrap .t-menu-btn:hover,
.topbar__menu-wrap .t-menu-btn[aria-expanded="true"] {
  color: #111827; background: #f3f4f6;
}
.topbar__menu-wrap .t-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
}

/* Header height parity across all pages (.topbar on landing/setup/
   signin/dashboard, .t-header on the public twin page) */
.topbar, .t-header { min-height: 60px; }

/* Make sure the topbar burger menu drops down *below the button*
   and isn't pushed to the bottom of the page by an unpositioned
   ancestor. !important locks in over the cascade. */
.topbar .topbar__menu-wrap {
  position: relative !important;
  display: inline-flex;
  align-items: center;
}
.topbar .topbar__menu-wrap > .t-menu {
  /* position: fixed pins to the viewport, bypassing every parent's
     position-context quirks. Coordinates: just under the 60px header,
     16px in from the right edge. */
  position: fixed !important;
  top: 64px !important;
  right: 16px !important;
  bottom: auto !important;
  left: auto !important;
  margin: 0 !important;
  transform: none !important;
}
