/* ============================================================
   DESIGN TOKENS
   Dark is the base set; light overrides it. The theme is chosen in
   assets/theme-boot.js before first paint: the visitor's saved choice, else
   their system setting. Without JavaScript the media query below follows the
   system setting on its own. tests/contrast.test.mjs checks these pairs
   against WCAG AA, so change a colour there and here together.
============================================================ */
:root {
  color-scheme: dark;
  --font-display:  'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body:     'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:     'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --bg:            #0B0E14;
  --bg-raised:     #0E121A;   /* sidebar, top bar */
  --bg-panel:      #131824;   /* cards and panels */
  --bg-card:       #182031;   /* raised inside a panel; AI bubbles */
  --bg-input:      #0F141E;
  --bg-chat:       #0B0E14;
  --text:          #ECEFF4;
  --text-2:        #A9B2C3;
  --text-3:        #8C96A8;
  --border:        #252D3D;
  --border-2:      #384357;
  --field-border:  #5E6A82;   /* form fields and controls: 3:1 against their fill */
  --accent:        #7590FF;
  --accent-2:      #7590FF;   /* the purple gradient partner is retired */
  --on-accent:     #0B0E14;
  --accent-bg:     rgba(117,144,255,0.12);
  --accent-bg2:    rgba(117,144,255,0.20);
  --user-msg:      var(--accent);
  --amber:         #F0B25A;   /* AI-generated labels and opportunities only */
  --amber-bg:      rgba(240,178,90,0.12);
  --success:       #6FCF97;
  --warn:          #F0B25A;
  --danger:        #F87171;
  --mark-bg:       #ECEFF4;
  --mark-fg:       #0B0E14;
  --focus:         #9FB2FF;
  --scrim:         rgba(5,7,11,0.62);
  --shadow:        0 24px 64px rgba(0,0,0,0.45);
  --shadow-sm:     0 6px 20px rgba(0,0,0,0.30);
  --shadow-xs:     none;

  --sb-w:          264px;
  --rail-w:        72px;
  --topbar-h:      60px;
  --r-xl:          20px;
  --r-lg:          16px;
  --r-md:          12px;
  --r-sm:          8px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg:            #F3F5F8;
  --bg-raised:     #EAEEF3;
  --bg-panel:      #FFFFFF;
  --bg-card:       #F6F8FA;
  --bg-input:      #FFFFFF;
  --bg-chat:       #F3F5F8;
  --text:          #0B0E14;
  --text-2:        #454D5E;
  --text-3:        #556070;
  --border:        #D9DEE6;
  --border-2:      #B9C1CE;
  --field-border:  #7B8598;
  --accent:        #3253E6;
  --accent-2:      #3253E6;
  --on-accent:     #FFFFFF;
  --accent-bg:     rgba(50,83,230,0.08);
  --accent-bg2:    rgba(50,83,230,0.14);
  --amber:         #8A5100;
  --amber-bg:      rgba(154,91,0,0.09);
  --success:       #1E7A46;
  --warn:          #8A5100;
  --danger:        #B42318;
  --mark-bg:       #0B0E14;
  --mark-fg:       #F3F5F8;
  --focus:         #3253E6;
  --scrim:         rgba(11,14,20,0.38);
  --shadow:        0 24px 64px rgba(11,14,20,0.14);
  --shadow-sm:     0 6px 20px rgba(11,14,20,0.08);
}
/* No JavaScript: follow the system. Same values as the light block above. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #F3F5F8; --bg-raised: #EAEEF3; --bg-panel: #FFFFFF; --bg-card: #F6F8FA; --bg-input: #FFFFFF; --bg-chat: #F3F5F8;
    --text: #0B0E14; --text-2: #454D5E; --text-3: #556070;
    --border: #D9DEE6; --border-2: #B9C1CE; --field-border: #7B8598;
    --accent: #3253E6; --accent-2: #3253E6; --on-accent: #FFFFFF; --accent-bg: rgba(50,83,230,0.08); --accent-bg2: rgba(50,83,230,0.14);
    --amber: #8A5100; --amber-bg: rgba(154,91,0,0.09);
    --success: #1E7A46; --warn: #8A5100; --danger: #B42318;
    --mark-bg: #0B0E14; --mark-fg: #F3F5F8; --focus: #3253E6; --scrim: rgba(11,14,20,0.38);
    --shadow: 0 24px 64px rgba(11,14,20,0.14); --shadow-sm: 0 6px 20px rgba(11,14,20,0.08);
  }
}

/* ============================================================
   RESET
============================================================ */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 160ms ease, color 160ms ease;
}
button { cursor: pointer; font: inherit; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; outline: none; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }

/* ============================================================
   APP SHELL
============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: 1fr;
  height: 100vh;   /* fallback for browsers without dvh */
  height: 100dvh;  /* excludes the mobile URL bar, which 100vh does not */
  width: 100vw;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR — seven views; full width on desktop, an icon rail on
   tablet (≤1099px), a drawer on phone (≤699px)
============================================================ */
.sidebar {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;   /* fallback for browsers without dvh */
  height: 100dvh;  /* excludes the mobile URL bar, which 100vh does not */
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  position: relative;
  transition: transform 240ms cubic-bezier(.4,0,.2,1);
}

.sb-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  color: var(--text);
}
.mark {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--mark-bg);
  color: var(--mark-fg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.mark svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; fill: none; }
.sb-brand-copy { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-brand-copy strong { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.sb-brand-copy span { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.sb-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.sb-group-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 10px 6px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: background 130ms ease, color 130ms ease;
}
.sb-item:hover { background: var(--bg-panel); color: var(--text); }
.sb-item.active { background: var(--bg-card); color: var(--text); }
.sb-item.active .sb-item-label { font-weight: 650; }
.sb-item.active .sb-item-icon { color: var(--accent); }
.sb-item-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--text-3);
  display: grid; place-items: center;
}
.sb-item-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sb-item-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.sb-item-label { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }

/* Footer: theme, language, contact */
.sb-footer {
  flex: 0 0 auto;
  padding: 14px 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sb-prefs { display: flex; flex-direction: column; gap: 10px; }
.sb-pref-label { font-size: 12px; color: var(--text-3); margin-bottom: 4px; display: block; }
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--bg-input);
}
.seg button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.seg button svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button.active { background: var(--bg-card); color: var(--text); font-weight: 650; box-shadow: inset 0 0 0 1px var(--border-2); }
.lang-switch { grid-auto-columns: 1fr; }
.sb-contact { font-size: 13px; color: var(--text-3); padding: 2px 2px 0; }
.sb-contact:hover { color: var(--text); }
.sb-more { display: none; }

/* Sidebar overlay (phone drawer) */
.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 98;
}
.sb-overlay.on { display: block; }

/* ============================================================
   MAIN PANEL
============================================================ */
.main {
  display: flex;
  flex-direction: column;
  height: 100vh;   /* fallback for browsers without dvh */
  height: 100dvh;  /* excludes the mobile URL bar, which 100vh does not */
  min-width: 0;
  background: var(--bg);
  overflow: hidden;
}

/* ============================================================
   TOPBAR — view name; Ask MCTB and Book a call on every view
============================================================ */
.topbar {
  flex: 0 0 auto;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  gap: 12px;
  z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-title { font-size: 14px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-mark { display: none; color: var(--text); align-items: center; gap: 8px; }
.topbar-mark .mark { width: 30px; height: 30px; border-radius: 8px; }
.topbar-mark .mark svg { width: 15px; height: 15px; }
.topbar-hamburger {
  display: none;
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  align-items: center; justify-content: center;
  color: var(--text);
  flex-shrink: 0;
  margin-left: -10px;
}
.topbar-hamburger svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

/* Buttons shared by the shell, the homepage and the panels */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-secondary { border: 1px solid var(--field-border); color: var(--text); background: transparent; }
.btn-secondary:hover { background: var(--bg-panel); }
.btn-soft { border: 1px solid var(--border-2); background: var(--bg-panel); color: var(--text); }
.btn-soft:hover { border-color: var(--field-border); }
.btn-ink { background: var(--text); color: var(--bg); }
.btn-ink:hover { background: color-mix(in srgb, var(--text) 85%, var(--bg)); }
.btn-text { min-height: 40px; padding: 0 4px; color: var(--accent); }
.btn-text:hover { text-decoration: underline; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

.msg-counter {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.new-session-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
}
.new-session-btn:hover { color: var(--text); border-color: var(--field-border); }
.new-session-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* ============================================================
   VIEWS — one visible at a time; hidden ones are out of the
   accessibility tree via the hidden attribute
============================================================ */
.views { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.view-scroll { overflow-y: auto; overflow-x: hidden; }
.view h1:focus { outline: none; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }

/* Demo tabs above the existing chat demos */
.demo-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.demo-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.demo-tab { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-2); font-size: 14px; font-weight: 600; }
.demo-tab:hover { color: var(--text); border-color: var(--field-border); }
.demo-tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.demo-label { font-size: 12px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border-radius: 999px; padding: 4px 10px; }

/* ============================================================
   CHAT STAGE
============================================================ */
.chat-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-chat);
}

/* Scrollable inner */
.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  position: relative;
}
.chat-scroll::-webkit-scrollbar { width: 5px; }
.chat-scroll::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 99px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

/* ============================================================
   WELCOME STATE — centered card
============================================================ */
.welcome {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.welcome.hidden { display: none; }
.welcome-body {
  width: 100%;
  max-width: 580px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Welcome container — borderless, layout only */
.welcome-card {
  width: 100%;
}
.welcome-card-top {
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Status pill */
.welcome-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px 5px 9px;
  border-radius: 99px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 18px;
  letter-spacing: 0.01em;
}


/* Title */
.welcome-title {
  font-size: clamp(22px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin-bottom: 10px;
  white-space: pre-line;
}
.welcome-desc {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 440px;
  margin-bottom: 20px;
}

/* Stat strip */
.welcome-stats {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 20px;
}
.welcome-stat {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 6px 9px;
  text-align: center;
  transition: border-color 140ms ease;
}
.welcome-stat:hover { border-color: var(--border-2); }
.welcome-stat-val {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}
.welcome-stat-label {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.2;
}

/* Quick action chips — now below the composer */
.welcome-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 14px;
}
.welcome-chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: var(--bg-card);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 130ms ease, color 130ms ease, background 130ms ease, transform 120ms ease;
  cursor: pointer;
}
.welcome-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-bg);
  transform: translateY(-1px);
}

/* Demo call button — receptionist only */
.demo-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  border-radius: 99px;
  background: #16A34A;
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 14px;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 4px 18px rgba(22,163,74,0.38);
  cursor: pointer;
}
.demo-call-btn:hover {
  background: #15803D;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(22,163,74,0.48);
}
.demo-call-btn svg {
  width: 16px; height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Divider before composer */
.welcome-card-divider {
  height: 1px;
  background: var(--border);
  margin: 0;
}

/* Composer section in welcome — full width, no side padding */
.welcome-card-composer {
  padding: 12px 0 0;
}

/* ============================================================
   AUDIT FORM CARD
============================================================ */
.audit-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-panel);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: left;
  margin-top: 4px;
}
.audit-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.audit-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-bg2);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.audit-card-icon svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.audit-card-head-copy strong { display: block; font-size: 14px; font-weight: 600; }
.audit-card-head-copy span { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.audit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.audit-field-full { grid-column: 1 / -1; }
.afield-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 5px;
}
.afield-input, .afield-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.afield-input:focus, .afield-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.afield-input::placeholder { color: var(--text-3); }
.afield-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235C5C72' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.afield-select option { background: var(--bg-card); }
.audit-run-btn {
  width: 100%;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  margin-top: 4px;
}
.audit-run-btn:hover { opacity: 0.90; transform: translateY(-1px); box-shadow: none; }
.audit-run-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ============================================================
   MESSAGES
============================================================ */
.messages {
  padding: 24px 24px 8px;
  max-width: 840px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.messages.hidden { display: none; }

.msg {
  display: flex;
  gap: 11px;
  opacity: 0;
  transform: translateY(8px);
  animation: msgIn 200ms ease forwards;
}
@keyframes msgIn { to { opacity: 1; transform: none; } }
.msg.user { justify-content: flex-end; }
.msg.user .msg-avatar { display: none; }
.msg.user .msg-body { align-items: flex-end; }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--accent-bg);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}
.msg-avatar svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

.msg-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: min(680px, 84%); }
.msg-meta { font-size: 10.5px; color: var(--text-3); padding: 0 3px; font-weight: 500; }
.msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 11px 15px;
  border-radius: 4px 18px 18px 18px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  box-shadow: var(--shadow-xs);
}
.msg.user .msg-bubble {
  background: var(--user-msg);
  border-color: transparent;
  color: var(--on-accent);
  border-radius: 18px 4px 18px 18px;
}

/* Typing indicator */
.msg-typing .msg-bubble {
  padding: 13px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: tdot 1.15s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes tdot { 0%,60%,100%{transform:translateY(0);opacity:.35} 30%{transform:translateY(-4px);opacity:1} }

/* Inline chips (quick replies inside messages) */
.msg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 0 2px;
}
.msg-chip {
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-panel);
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
  cursor: pointer;
}
.msg-chip:hover { border-color: var(--accent); color: var(--text); background: var(--accent-bg); }
.msg-chip:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   SCAN LOG (audit flow)
============================================================ */
.scan-log {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 2;
  max-height: 220px;
  overflow-y: auto;
}
.scan-line { color: var(--text-3); }
.scan-line.ok { color: var(--success); }
.scan-line.ok::before { content: "✓  "; }
.scan-line.warn { color: var(--warn); }
.scan-line.warn::before { content: "⚠  "; }
.scan-line.run::before { content: "›  "; color: var(--text-3); }

/* Score card inside a message bubble */
.score-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-top: 6px;
}
.score-card-top {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.score-ring-wrap { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.score-ring-wrap svg { width: 100%; height: 100%; }
.score-ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-ring-num { font-size: 22px; font-weight: 700; line-height: 1; }
.score-ring-denom { font-size: 10px; color: var(--text-3); }
.score-card-copy { flex: 1; min-width: 0; }
.score-grade {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  margin-bottom: 7px;
}
.score-card-hl { font-size: 15px; font-weight: 600; }
.score-card-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.risk-bar {
  margin: 0 20px 16px;
  padding: 11px 14px;
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.18);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  gap: 12px;
}
.risk-bar-icon { color: var(--danger); flex-shrink: 0; }
.risk-bar-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.risk-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--danger); margin-bottom: 2px; }
.risk-amount { font-size: 20px; font-weight: 700; color: var(--danger); line-height: 1; }
.risk-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.score-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px 20px;
}
.score-col-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.score-col-title.issues { color: var(--danger); }
.score-col-title.wins { color: var(--success); }
.score-col-title svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.score-item { display: flex; gap: 7px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; line-height: 1.5; }
.score-item svg { flex-shrink: 0; margin-top: 2px; width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

/* ============================================================
   CONTACT CAPTURE
============================================================ */
.contact-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.contact-card-head { font-size: 13px; font-weight: 500; }
.contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.contact-field-full { grid-column: 1 / -1; }
.cfield-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cfield-wrap .cfield { width: 100%; }
.cfield-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.cfield {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--field-border);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.cfield:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.cfield::placeholder { color: var(--text-3); }
.contact-submit {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: opacity 160ms ease, transform 160ms ease;
  align-self: flex-end;
}
.contact-submit:hover { opacity: 0.90; transform: translateY(-1px); }
.contact-submit svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }

/* ============================================================
   CONVERSION / CTA BANNER
============================================================ */
.conv-banner {
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}
.conv-banner.hidden { display: none; }
.conv-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  background: var(--bg-panel);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  animation: msgIn 220ms ease forwards;
}
.conv-copy strong { display: block; font-size: 13.5px; font-weight: 600; }
.conv-copy span { display: block; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.conv-cta {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.conv-cta:hover { opacity: 0.90; transform: translateY(-1px); box-shadow: none; }

/* ============================================================
   COMPOSER
============================================================ */
.composer-wrap {
  flex: 0 0 auto;
  padding: 10px 20px 18px;
  max-width: 840px;
  width: 100%;
  margin: 0 auto;
}

/* Contextual suggestions above composer (shown in conversation mode) */
.composer-suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 2px 10px;
  scrollbar-width: none;
}
.composer-suggestions::-webkit-scrollbar { display: none; }
.composer-suggestions.hidden { display: none; }
.composer-suggest-chip {
  padding: 6px 13px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: var(--bg-panel);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 130ms ease, color 130ms ease, background 130ms ease;
  cursor: pointer;
}
.composer-suggest-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-bg);
}

/* Main composer box */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 8px 8px 8px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.composer:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
/* The composer's own border is the focus indicator (focus token: 3:1 or
   better on panels); a second ring on the textarea inside it reads as a glitch. */
.composer textarea:focus-visible { outline: none; }
.composer textarea {
  flex: 1 1 auto;
  min-height: 26px;
  max-height: 180px;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 9px 0;
  line-height: 1.55;
  font-size: 14px;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer textarea:disabled { opacity: 0.5; cursor: not-allowed; }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--on-accent);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: opacity 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  box-shadow: none;
}
.send-btn:hover:not(:disabled) {
  opacity: 0.90;
  transform: translateY(-1px);
  box-shadow: none;
}
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }
.send-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 4px 0;
  font-size: 11px;
  color: var(--text-3);
  gap: 10px;
}

/* ============================================================
   RESPONSIVE
   ≥1100px  full sidebar
   700–1099 icon rail; theme and language move into a popover
   ≤699px   drawer from the menu button; Book stays in the top bar
============================================================ */
@media (max-width: 1099px) {
  .app { grid-template-columns: var(--rail-w) 1fr; }
  .sidebar { width: var(--rail-w); }
  .sb-brand { justify-content: center; padding: 16px 0 14px; }
  .sb-brand-copy, .sb-group-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .sb-nav { padding: 4px 10px 12px; gap: 4px; }
  .sb-nav .sb-group-label + .sb-item { margin-top: 10px; }
  .sb-item { justify-content: center; padding: 10px; }
  /* Labels stay in the accessibility tree; the tooltip comes from title. */
  .sb-item-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .sb-footer { padding: 10px; align-items: center; }
  .sb-contact { display: none; }
  .sb-more { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); color: var(--text-2); }
  .sb-more:hover, .sb-more[aria-expanded="true"] { background: var(--bg-panel); color: var(--text); }
  .sb-more svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .sb-prefs {
    position: absolute;
    left: calc(var(--rail-w) + 8px);
    bottom: 12px;
    width: 260px;
    padding: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    z-index: 50;
  }
  .sb-prefs:not(.open) { display: none; }
  .topbar { padding: 0 20px; }
}
@media (max-width: 699px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(304px, 86vw);
    z-index: 99;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 240ms cubic-bezier(.4,0,.2,1), visibility 0s linear 240ms;
  }
  .sidebar.open { transform: translateX(0); visibility: visible; transition: transform 240ms cubic-bezier(.4,0,.2,1); }
  /* In the drawer everything is shown in full again. */
  .sidebar .sb-brand { justify-content: flex-start; padding: 18px 18px 14px; }
  .sidebar .sb-brand-copy, .sidebar .sb-group-label, .sidebar .sb-item-copy { position: static !important; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; }
  .sidebar .sb-item { justify-content: flex-start; padding: 8px 10px; min-height: 48px; }
  .sidebar .sb-nav .sb-group-label + .sb-item { margin-top: 0; }
  .sidebar .sb-footer { align-items: stretch; padding: 14px; }
  .sidebar .sb-contact { display: block; }
  .sb-more { display: none !important; }
  .sb-prefs, .sb-prefs:not(.open) { display: flex; position: static; width: auto; padding: 0; background: none; border: 0; box-shadow: none; }
  .topbar { padding: 0 12px 0 10px; gap: 8px; }
  .topbar-hamburger { display: flex; margin-left: 0; }
  .topbar-mark { display: flex; }
  .topbar-title { font-size: 13px; }
  .msg-counter { display: none; }
  .new-session-btn { padding: 0 10px; }
  .new-session-btn .nsb-label { display: none; }
  .demo-bar { padding: 10px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .demo-label { order: -1; }
  /* One row of tabs that scrolls inside its own box rather than wrapping. */
  .demo-tabs { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 28px); margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
  .demo-tab { flex-shrink: 0; }
  .conv-inner { flex-direction: column; align-items: stretch; }
  .composer-wrap { padding: 8px 14px 16px; }
  .messages { padding: 18px 14px 8px; }
  .contact-fields { grid-template-columns: 1fr; }
  .score-cols { grid-template-columns: 1fr; }
  .audit-fields { grid-template-columns: 1fr; }
  .welcome-stats { flex-direction: column; gap: 8px; }
  .welcome { padding: 28px 18px 20px; }
}
/* ============================================================
   SMS MODE — missed call flow
============================================================ */
.messages.sms-mode {
  padding: 16px 20px 8px;
  gap: 8px;
  max-width: 680px;
}
.sms-header {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
  padding: 8px 0 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.messages.sms-mode .msg {
  gap: 6px;
}
.messages.sms-mode .msg-avatar { display: none; }
.messages.sms-mode .msg-meta { display: none; }
.messages.sms-mode .msg-body { max-width: min(72%, 360px); }
.messages.sms-mode .msg.user .msg-body { align-items: flex-end; }
.messages.sms-mode .msg-bubble {
  padding: 9px 14px;
  border-radius: 18px 18px 4px 18px;
  background: #2A2A38;
  border: none;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: none;
}
[data-theme="light"] .messages.sms-mode .msg-bubble {
  background: #E5E5EA;
  color: #1C1C1E;
}
.messages.sms-mode .msg.user .msg-bubble {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  border-radius: 18px 18px 18px 4px;
}
.messages.sms-mode .msg-typing .msg-bubble {
  background: #2A2A38;
  border: none;
  border-radius: 18px 18px 4px 18px;
}
[data-theme="light"] .messages.sms-mode .msg-typing .msg-bubble {
  background: #E5E5EA;
}
/* SMS composer style */
.sms-composer-mode .composer {
  border-radius: 99px;
  padding: 6px 6px 6px 18px;
  background: var(--bg-card);
  border-color: var(--border-2);
}
.sms-composer-mode .send-btn {
  border-radius: 50%;
  width: 36px; height: 36px;
}

/* ============================================================
   DEMO CALL MODAL
============================================================ */
.demo-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn 200ms ease forwards;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.demo-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-2);
  border-radius: 24px;
  padding: 24px 24px 20px;
  max-width: 440px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 220ms cubic-bezier(.34,1.56,.64,1) forwards;
  position: relative;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.demo-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  display: grid; place-items: center;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
  font-size: 15px;
  line-height: 1;
}
.demo-modal-close:hover { color: var(--text); background: var(--bg-raised); }
.demo-modal-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(22,163,74,0.15);
  border: 2px solid rgba(22,163,74,0.4);
  display: grid; place-items: center;
  margin: 0 auto 14px;
  position: relative;
}
.demo-modal-icon::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(22,163,74,0.2);
  animation: callPulse 1.8s ease-in-out infinite;
}
.demo-modal-icon::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2px solid rgba(22,163,74,0.1);
  animation: callPulse 1.8s ease-in-out infinite 0.3s;
}
@keyframes callPulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.08);opacity:0.5} }
.demo-modal-icon svg { width: 22px; height: 22px; color: #22C55E; fill: currentColor; }
.demo-modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 5px; }
.demo-modal-sub { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 18px; }
/* GHL widget iframe container */
.demo-modal-widget {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-height: 420px;
}
.demo-modal-widget iframe {
  width: 100%;
  height: 480px;
  border: none;
  display: block;
  border-radius: 14px;
}
.demo-modal-widget-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13px;
  pointer-events: none;
  transition: opacity 400ms ease;
  background: var(--bg-card);
  border-radius: 14px;
  z-index: 2;
}
.demo-modal-widget-loading.hidden { opacity: 0; pointer-events: none; }


/* ============================================================
   BOOKING MODAL — GHL Discovery Call calendar
============================================================ */
.demo-modal.booking-modal { max-width: 760px; padding: 20px 20px 16px; }
.booking-modal .demo-modal-title { margin-right: 32px; }
.booking-modal .demo-modal-sub { margin-bottom: 14px; }
.booking-modal .demo-modal-widget { min-height: 0; }
.booking-modal .demo-modal-widget iframe { height: min(68dvh, 640px); background: #fff; }
.booking-modal-alt { margin-top: 10px; font-size: 12px; color: var(--text-3); }
.booking-modal-alt a { font-weight: 600; }

/* ============================================================
   SYSTEM NOTICES — never styled or labelled as an AI reply
============================================================ */
.msg-notice {
  align-self: center;
  max-width: min(560px, 92%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-2);
  background: var(--bg-panel);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  animation: msgIn 200ms ease forwards;
}
.msg-notice.warn { border-color: rgba(245,158,11,0.45); }
.msg-notice-btn {
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: var(--bg-card);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.msg-notice-btn:hover { border-color: var(--accent); }
.msg-meta.guide { color: var(--text-3); font-style: italic; }

/* Cards rendered inside a pre-wrap bubble: their template indentation is not content. */
.msg-bubble .contact-card, .msg-bubble .score-card { white-space: normal; }

/* Contact capture states */
.contact-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-error { font-size: 12.5px; color: var(--danger); line-height: 1.5; }
.contact-error:empty { display: none; }
.contact-error a { color: inherit; text-decoration: underline; }
.contact-submit:disabled { opacity: 0.55; cursor: progress; transform: none; }
.contact-done { text-align: center; padding: 14px 0 4px; }
.contact-done-check { color: var(--success); font-size: 22px; margin-bottom: 8px; }
.contact-done-title { font-weight: 600; margin-bottom: 4px; }
.contact-done-sub { font-size: 13px; color: var(--text-2); }
.contact-done .contact-submit { margin: 14px auto 0; align-self: center; }

/* Audit: the real data the estimate was based on */
.score-facts { margin: 0 20px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.score-fact { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.score-fact strong { color: var(--text); font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.score-note { margin: 0 20px 16px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
@media (max-width: 640px) { .score-facts { grid-template-columns: 1fr; } }


/* ============================================================
   BASE (B2): type, focus, motion
============================================================ */
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; }
.mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
/* `hidden` must win over any component's display rule. */
[hidden] { display: none !important; }
/* The reset removes outlines from fields; keyboard focus must stay visible everywhere. */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 10px 16px; border-radius: var(--r-sm); background: var(--accent); color: var(--on-accent); font-weight: 600; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

/* ============================================================
   HOME
============================================================ */
.home { max-width: 1280px; padding: 52px 56px 40px; display: flex; flex-direction: column; gap: 88px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 7fr);
  grid-template-areas: "intro sketch" "actions sketch";
  grid-template-rows: auto 1fr;
  column-gap: 48px;
  row-gap: 28px;
  align-items: start;
}
.hero-intro { grid-area: intro; display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.hero-intro h1 { font-size: clamp(40px, 3.9vw, 60px); line-height: 1.02; letter-spacing: -0.025em; }
.hero-promise { font-size: 19px; line-height: 1.55; color: var(--text-2); max-width: 34em; }
.hero-sketch { grid-area: sketch; min-width: 0; }
.hero-actions { grid-area: actions; display: flex; flex-direction: column; gap: 24px; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.reassure { list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 15px; color: var(--text-2); }
.reassure li { display: flex; align-items: center; gap: 10px; }
.reassure svg { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--accent); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.home-section { display: flex; flex-direction: column; gap: 24px; }
.home-section h2 { font-size: 34px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 22px; min-height: 180px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); color: var(--text); transition: border-color 130ms ease; }
.tile:hover { border-color: var(--field-border); }
.tile-title { font-family: var(--font-display); font-weight: 650; font-size: 20px; line-height: 1.2; letter-spacing: -0.01em; }
.tile-body { font-size: 15px; color: var(--text-2); flex: 1; }
.tile-link { font-size: 14px; font-weight: 600; color: var(--accent); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.steps li { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 2px solid var(--accent); }
.step-n { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.step-title { font-weight: 650; font-size: 18px; }
.step-body { font-size: 15px; color: var(--text-2); }
.builds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.build { display: flex; flex-direction: column; gap: 12px; padding: 28px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); }
.build h3 { font-size: 24px; }
.build p { font-size: 16px; color: var(--text-2); }
.build ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--text-2); }
.build .btn-text { align-self: flex-start; }
.also { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 28px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.also > div { display: flex; flex-direction: column; gap: 2px; }
.also-title { font-weight: 650; font-size: 17px; }
.also-body { font-size: 15px; color: var(--text-2); }
.about-line p { font-size: 17px; color: var(--text-2); max-width: 46em; }
.about-line a { font-weight: 600; white-space: nowrap; }
.closing { flex-direction: row; align-items: center; justify-content: space-between; gap: 32px; padding: 40px; border-radius: var(--r-xl); background: var(--bg-card); border: 1px solid var(--border); }
.closing > div:first-child { display: flex; flex-direction: column; gap: 8px; max-width: 620px; }
.closing h2 { font-size: 30px; }
.closing p { font-size: 16px; color: var(--text-2); }
.closing-ctas { display: flex; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }
.home-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 20px; margin-top: -40px; }
.home-footer a { color: var(--text-3); }

@media (max-width: 1099px) {
  .home { padding: 40px 32px 40px; gap: 72px; }
  /* Tablet and phone: headline, then the sketch, then the actions. */
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "sketch" "actions"; grid-template-rows: none; }
  .tiles, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .closing { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 699px) {
  .home { padding: 28px 20px 48px; gap: 56px; }
  .hero { row-gap: 24px; }
  .hero-intro { gap: 14px; padding-top: 0; }
  .hero-intro h1 { font-size: 38px; }
  .hero-promise { font-size: 17px; }
  .hero-ctas { flex-direction: column; }
  .hero-ctas .btn { width: 100%; }
  .home-section h2 { font-size: 26px; }
  .tiles, .steps, .builds { grid-template-columns: minmax(0, 1fr); }
  .tile { min-height: 0; }
  .also { flex-direction: column; align-items: flex-start; padding: 20px; }
  .closing { padding: 24px 20px; }
  .closing-ctas, .closing-ctas .btn { width: 100%; }
  .home-footer { margin-top: -24px; }
}

/* ============================================================
   AUTOMATION SKETCH
============================================================ */
.sketch { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-sm); }
.sketch-eyebrow { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }
.sketch h2 { font-size: 26px; line-height: 1.15; letter-spacing: -0.015em; }
.sketch-form { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.sketch-form textarea { width: 100%; resize: vertical; min-height: 78px; padding: 12px 14px; border: 1px solid var(--field-border); border-radius: var(--r-md); background: var(--bg-input); color: var(--text); font-size: 16px; line-height: 1.45; }
.sketch-form textarea::placeholder { color: var(--text-3); }
.sketch-error { font-size: 14px; color: var(--danger); min-height: 0; }
.sketch-error:empty { display: none; }
.sketch-examples { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.sketch-ex-label { font-size: 13px; color: var(--text-3); }
.sketch-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sketch-chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--field-border); border-radius: 999px; color: var(--text-2); font-size: 14px; }
.sketch-chip:hover { color: var(--text); background: var(--bg-card); }
.sketch-chip[aria-pressed="true"] { background: var(--accent-bg2); border-color: var(--accent); color: var(--text); }
.sketch-submit-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 6px; }
.sketch-note { font-size: 13px; color: var(--text-3); }
.sketch-result { border-top: 1px solid var(--border); padding-top: 18px; }

/* Signature visual: a real flow drawn as nodes and thin connectors. */
.sysline { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.sysline li { position: relative; display: flex; flex-direction: column; gap: 6px; padding-right: 12px; }
.sysline li:not(:last-child)::after { content: ""; position: absolute; left: 18px; right: 6px; top: 5px; height: 1px; background: var(--border-2); }
.sysline-dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg-panel); }
.sysline-label { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.sysline-sub { font-size: 12px; color: var(--text-3); }
.sk-idle p, .sk-pending { font-size: 14px; color: var(--text-2); }

.sk-card { display: flex; flex-direction: column; gap: 14px; }
.sk-label { align-self: flex-start; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; }
.sk-label-ai { color: var(--amber); background: var(--amber-bg); }
.sk-label-curated { color: var(--text-2); background: var(--bg-card); border: 1px solid var(--border-2); }
.sk-title { font-size: 20px; letter-spacing: -0.01em; }
.sk-steps { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 10px; }
.sk-step { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-card); }
.sk-step-n { font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.sk-step-title { font-weight: 650; font-size: 15px; line-height: 1.25; }
.sk-step-detail { font-size: 13px; line-height: 1.4; color: var(--text-2); }
.sk-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; font-size: 13px; }
.sk-meta dt, .sk-sub { color: var(--text-3); font-size: 13px; }
.sk-meta dd { margin-top: 2px; color: var(--text); }
.sk-meta ul, .sk-call ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sk-first p { font-size: 14px; color: var(--text); margin-top: 2px; }
.sk-call ul { font-size: 14px; margin-top: 2px; }
.sk-call li::before { content: "— "; color: var(--text-3); }
.sk-disclaimer { font-size: 12px; color: var(--text-3); }
.sk-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sk-unavailable { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--bg-card); }
.sk-unavailable-text { font-size: 15px; font-weight: 600; }
.sk-interim { font-size: 13px; color: var(--text-3); }

@media (max-width: 699px) {
  .sketch { padding: 20px 16px; border-radius: 16px; }
  .sketch h2 { font-size: 22px; }
  .sketch-chip { min-height: 44px; }
  .sysline { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .sysline li:nth-child(2)::after { display: none; }
  /* Steps read top to bottom on a phone, joined by a thin line. */
  .sk-steps { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sk-step { border: 0; border-left: 1px solid var(--border-2); border-radius: 0; background: none; padding: 0 0 14px 16px; position: relative; }
  .sk-step::before { content: ""; position: absolute; left: -6px; top: 3px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg-panel); }
  .sk-step:last-child { border-left-color: transparent; }
  .sk-meta { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}

/* ============================================================
   ASK MCTB — panel (≥700px), bottom sheet and compact button (phone)
============================================================ */
.ask-layer { position: fixed; inset: 0; z-index: 200; }
.ask-scrim { position: absolute; inset: 0; background: var(--scrim); }
.ask-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(440px, 100%);
  display: flex; flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: askIn 200ms cubic-bezier(.2,.8,.2,1);
}
@keyframes askIn { from { transform: translateX(24px); opacity: 0; } }
.ask-grabber { display: none; }
.ask-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.ask-title { font-size: 20px; }
.ask-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.ask-close { width: 44px; height: 44px; margin: -8px -10px 0 0; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.ask-close:hover { background: var(--bg-card); color: var(--text); }
.ask-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; fill: none; }
.ask-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.ask-sketch-ctx { font-size: 14px; color: var(--text-2); padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-card); }
.ask-interim { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1.5px dashed var(--border-2); border-radius: var(--r-md); font-size: 14px; color: var(--text-2); }
.ask-interim-title { font-weight: 650; color: var(--text); }
.ask-contact:empty { display: none; }
.ask-contact .contact-card { margin: 0; }
.ask-handoff { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 0; }
.ask-composer { display: flex; align-items: center; gap: 8px; margin: 12px 22px 22px; padding: 4px 4px 4px 14px; border: 1px solid var(--field-border); border-radius: 16px; background: var(--bg-input); }
.ask-composer input { flex: 1; min-width: 0; height: 40px; font-size: 15px; color: var(--text); }
.ask-composer input::placeholder { color: var(--text-3); }
.ask-composer[aria-disabled="true"] { opacity: 0.7; }
.ask-send { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.ask-send:disabled { background: var(--bg-card); color: var(--text-3); }
.ask-send svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ask-dock { display: none; }

@media (max-width: 699px) {
  .ask-btn { display: none; }
  .ask-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; height: min(640px, 86dvh);
    border-left: 0; border-top: 1px solid var(--border);
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    animation-name: sheetIn;
  }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .ask-grabber { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-2); margin: 10px auto 0; }
  .ask-head { padding: 10px 16px 12px 20px; }
  .ask-body { padding: 16px 20px; }
  .ask-handoff { padding: 10px 20px 0; }
  .ask-composer { margin: 10px 12px 16px; }
  .ask-composer input { font-size: 16px; height: 44px; }
  .ask-send { width: 44px; height: 44px; }
  /* Docked under the content (a flex item of .main), so it takes its own
     space and can't cover content or the top-bar Book button. */
  .ask-dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)) 20px; border-top: 1px solid var(--border); background: var(--bg-raised); }
  .ask-dock-hint { font-size: 13px; color: var(--text-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ask-pill {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    height: 44px; padding: 0 16px;
    border-radius: 999px;
    background: var(--bg-panel); color: var(--text);
    border: 1px solid var(--field-border);
    font-size: 14px; font-weight: 600;
  }
  .ask-pill svg { width: 18px; height: 18px; stroke: var(--accent); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
}

/* ============================================================
   CONTENT VIEWS (B3): service pages and How We Work
============================================================ */
.text-link { color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.hero-ctas { align-items: center; column-gap: 20px; row-gap: 12px; }
.demo-label-quiet { color: var(--text-2); background: var(--bg-card); }
.page { max-width: 1120px; padding: 52px 56px 64px; display: flex; flex-direction: column; gap: 56px; }
.page section { display: flex; flex-direction: column; gap: 18px; }
.page h2 { font-size: 26px; }
.page h3 { font-size: 17px; font-family: var(--font-body); font-weight: 650; letter-spacing: 0; line-height: 1.3; }
.page-head { display: flex; flex-direction: column; gap: 16px; max-width: 780px; }
.page-head h1 { font-size: 48px; }
.page-problem { font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); padding-left: 18px; border-left: 2px solid var(--accent); }
.page-lead { font-size: 18px; color: var(--text-2); }
.svc-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.svc-build { padding: 28px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); }
.svc-items { list-style: none; display: flex; flex-direction: column; gap: 18px; }
.svc-items li { display: flex; flex-direction: column; gap: 4px; padding-left: 22px; position: relative; }
.svc-items li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--accent); }
.svc-items p, .principle p, .way p, .price p, .svc-card p { font-size: 15px; color: var(--text-2); }
.svc-side { display: flex; flex-direction: column; gap: 16px; }
.svc-card { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.page .h-card { font-family: var(--font-body); font-size: 16px; font-weight: 650; letter-spacing: 0; }
.sysline-lg { max-width: 760px; }
.sysline-lg .sysline-label { font-size: 12px; }
.sysline-lg .sysline-sub { font-size: 13px; }
.principles, .ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.principle, .way { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); }
.way .text-link { margin-top: 4px; font-size: 14px; }
.tool-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.tool-list li { padding: 8px 14px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 14px; color: var(--text-2); }
.note { font-size: 14px; color: var(--text-3); }
.prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 720px; }
.price { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); }
.price .price-amount { font-family: var(--font-display); font-weight: 700; font-size: 30px; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.page .svc-presence { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.svc-presence > div { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }
.svc-presence p { font-size: 15px; color: var(--text-2); }
.svc-presence .btn { flex-shrink: 0; }
.page .cta-band { gap: 14px; padding: 32px; border-radius: var(--r-xl); background: var(--bg-card); border: 1px solid var(--border); }
.cta-copy { display: flex; flex-direction: column; gap: 6px; }
.cta-copy p { color: var(--text-2); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-assess { align-self: flex-start; }
.how-steps { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.how-steps li { display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; border-top: 2px solid var(--accent); background: var(--bg-panel); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.how-steps p { font-size: 15px; color: var(--text-2); }
.how-bottom { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.page .about, .page .contact { gap: 12px; padding: 28px; border: 1px solid var(--border); border-radius: var(--r-lg); }
.page .contact { background: var(--bg-card); }
.about-person { font-size: 15px; color: var(--text-2); }
.about-name { font-weight: 650; color: var(--text); }
.about p:last-child, .contact > p { font-size: 16px; color: var(--text-2); }
.contact-email { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }

@media (max-width: 1099px) {
  .page { padding: 40px 32px 56px; gap: 48px; }
  .svc-grid, .how-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 699px) {
  .page { padding: 28px 20px 48px; gap: 40px; }
  .page-head h1 { font-size: 34px; }
  .page-problem { font-size: 20px; padding-left: 14px; }
  .page-lead { font-size: 17px; }
  .page h2 { font-size: 22px; }
  .svc-build, .page .about, .page .contact { padding: 20px; }
  .prices, .how-steps { grid-template-columns: minmax(0, 1fr); }
  .page .svc-presence { flex-direction: column; align-items: flex-start; padding: 20px; }
  .page .cta-band { padding: 22px 20px; }
  .cta-actions { flex-direction: column; width: 100%; }
  .cta-actions .btn { width: 100%; }
  .sysline-lg { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .sysline-lg li:nth-child(2)::after { display: none; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-assess { text-align: center; padding: 6px 0; }
  .closing-ctas { flex-direction: column; align-items: stretch; }
  .closing-ctas .text-link { text-align: center; padding: 6px 0; }
}

/* ============================================================
   B4: Ask MCTB conversation, sketch outcomes, bring-to-call
============================================================ */
.ask-intro { font-size: 14px; color: var(--text-2); }
.ask-log { display: flex; flex-direction: column; gap: 12px; }
.ask-log:empty { display: none; }
.ask-msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; }
.ask-msg-user { align-self: flex-end; }
.ask-msg-ai { align-self: flex-start; }
.ask-msg-label { font-size: 11px; font-weight: 600; color: var(--text-3); }
.ask-msg-label.guide { color: var(--amber); }
.ask-bubble { padding: 11px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.ask-msg-user .ask-bubble { background: var(--accent); color: var(--on-accent); border-radius: 14px 4px 14px 14px; }
.ask-msg-ai .ask-bubble { background: var(--bg-card); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; }
.ask-typing .ask-bubble { display: flex; gap: 4px; align-items: center; min-height: 40px; }
.ask-notice { margin: 0; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip { min-height: 40px; padding: 0 14px; border: 1px solid var(--field-border); border-radius: 999px; font-size: 14px; color: var(--text-2); text-align: left; }
.ask-chip:hover { color: var(--text); background: var(--bg-card); }
.ask-clear { margin-left: auto; font-size: 14px; }
.ask-foot { font-size: 11px; color: var(--text-3); padding: 0 22px 16px; margin-top: -12px; }
.afield-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.sk-bring { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; border-top: 1px solid var(--border); }
.sk-bring-intro { font-size: 14px; color: var(--text-2); padding-top: 12px; }
.sk-sent { font-size: 14px; font-weight: 600; color: var(--success); }
@media (max-width: 699px) {
  .ask-foot { padding: 0 20px 12px; margin-top: -8px; }
  .ask-chip { min-height: 44px; }
}

/* ============================================================
   B5: Business Systems Assessment
============================================================ */
.assess-page { max-width: 860px; }
.assess { display: flex; flex-direction: column; gap: 20px; }
.assess-intro, .assess-actions, .assess-more { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.assess-q { display: flex; flex-direction: column; gap: 20px; padding: 28px; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--bg-panel); }
.assess-progress { display: flex; flex-direction: column; gap: 8px; }
.assess-step { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.assess-bar { height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.assess-bar span { display: block; height: 100%; background: var(--accent); }
.assess-q fieldset { border: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.assess-q legend { padding: 0 0 4px; }
.assess-legend { font-size: 26px; line-height: 1.2; }
.assess-legend:focus { outline: none; }
.assess-hint { font-size: 14px; color: var(--text-2); }
.assess-category { display: flex; flex-direction: column; gap: 6px; max-width: 420px; }
.assess-options { display: flex; flex-direction: column; gap: 10px; }
.assess-opt { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; border: 1.5px solid var(--field-border); border-radius: var(--r-md); background: var(--bg-input); cursor: pointer; font-size: 16px; }
.assess-opt:hover { border-color: var(--accent); }
.assess-opt input { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--accent); margin: 0; }
.assess-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.assess-opt:has(input:disabled) { opacity: 0.55; cursor: not-allowed; }
.assess-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.assess-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.assess-nav [type=submit] { margin-left: auto; }
.assess-nav [type=submit]:disabled { opacity: 0.5; cursor: not-allowed; }
.assess-results { display: flex; flex-direction: column; gap: 16px; }
.assess-results > h2 { font-size: 30px; }
.assess-results > h2:focus { outline: none; }
.assess-partial, .assess-message { font-size: 15px; color: var(--text-2); padding: 14px 16px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--bg-card); }
.assess-cards { display: flex; flex-direction: column; gap: 12px; }
.assess-card { display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-panel); }
.assess-card h3 { font-size: 18px; font-family: var(--font-body); font-weight: 650; letter-spacing: 0; }
.assess-card p { font-size: 15px; color: var(--text-2); }
.assess-pill { align-self: flex-start; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; }
.assess-card[data-kind="opportunity"] .assess-pill { color: var(--amber); background: var(--amber-bg); }
.assess-card[data-kind="review"] .assess-pill { color: var(--accent); background: var(--accent-bg); }
.assess-card[data-kind="working"] .assess-pill { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.assess-basis { font-size: 13px !important; color: var(--text-3) !important; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.assess-basis b { font-weight: 600; color: var(--text-2); }
.assess-first { padding: 20px 22px; border-radius: var(--r-lg); background: var(--bg-card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.assess-first h3 { font-size: 17px; font-family: var(--font-body); font-weight: 650; letter-spacing: 0; }
.assess-send { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 699px) {
  .assess-q { padding: 20px 16px; }
  .assess-legend { font-size: 22px; }
  .assess-nav { flex-direction: column-reverse; align-items: stretch; }
  .assess-nav .btn { width: 100%; }
  .assess-nav [type=submit] { margin-left: 0; }
  .assess-intro, .assess-actions { flex-direction: column; align-items: stretch; }
  .assess-intro .btn, .assess-actions .btn { width: 100%; }
  .assess-results > h2 { font-size: 24px; }
}

/* ============================================================
   PHASE C — scripted demos, written answers, self-check, Turnstile
============================================================ */
/* Scripted demos: reply chips where the composer used to be. They wrap, and
   are big enough to tap. */
.composer-scripted .composer-suggestions { flex-wrap: wrap; overflow: visible; padding-bottom: 8px; }
.composer-scripted .composer-suggest-chip { min-height: 40px; padding: 0 16px; font-size: 14px; white-space: normal; text-align: left; }
.composer-suggest-chip:focus-visible, .welcome-chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.composer-note { font-size: 12px; color: var(--text-3); padding: 0 2px; }
.msg-notice.info { border-color: var(--border-2); }

/* The fictional company's example estimate, inside a scripted reply. */
.estimate-card { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--bg-panel); display: flex; flex-direction: column; gap: 10px; white-space: normal; }
.estimate-head { display: flex; flex-direction: column; gap: 4px; }
.estimate-label { align-self: flex-start; font-size: 11.5px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border-radius: 999px; padding: 3px 10px; }
.estimate-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.estimate-table th { text-align: left; font-weight: 500; color: var(--text-2); padding: 6px 12px 6px 0; }
.estimate-table td { text-align: right; white-space: nowrap; padding: 6px 0; }
.estimate-table tbody tr + tr th, .estimate-table tbody tr + tr td { border-top: 1px solid var(--border); }
.estimate-table tfoot th, .estimate-table tfoot td { border-top: 1.5px solid var(--border-2); font-weight: 650; color: var(--text); }
.estimate-note { font-size: 12.5px; color: var(--text-3); }

/* Ask MCTB: topics, questions, written answers. */
.ask-suggest { flex-direction: column; flex-wrap: nowrap; gap: 12px; }
.ask-suggest-head { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.ask-questions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ask-questions .ask-chip { min-height: 40px; padding: 8px 14px; border-radius: var(--r-md); line-height: 1.35; }
.ask-topics { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; border-top: 1px solid var(--border); }
.ask-topic { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 13px; color: var(--text-2); }
.ask-topic:hover { color: var(--text); background: var(--bg-card); }
.ask-topic[aria-pressed="true"] { background: var(--accent-bg2); border-color: var(--accent); color: var(--text); }
.ask-qa { display: flex; flex-direction: column; gap: 8px; }
.ask-bubble:focus { outline: none; }
.ask-bubble:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ask-nomatch { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--bg-card); font-size: 14px; color: var(--text-2); }

/* Automation sketch: more examples, close matches. */
.sketch-more { min-height: 40px; padding: 0 14px; border-radius: 999px; color: var(--accent); font-size: 14px; font-weight: 600; }
.sketch-more:hover { background: var(--accent-bg); }
.sketch-chips-more { margin-top: 8px; }
.sk-match { font-size: 13px; color: var(--text-3); }
.sk-title:focus { outline: none; }
.sk-unavailable-text:focus { outline: none; }
.sk-others { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.sk-others .sk-sub { flex-basis: 100%; }
.sk-other { min-height: 36px; }

/* Online presence self-check. */
.presence-check { display: flex; flex-direction: column; gap: 16px; }
.presence-intro { font-size: 14px; color: var(--text-2); }
.presence-form { display: flex; flex-direction: column; gap: 14px; }
.presence-q { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.presence-q legend { font-size: 15px; font-weight: 600; padding: 0 0 6px; display: flex; gap: 8px; }
.presence-n { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.presence-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.presence-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; flex: 1 1 120px; padding: 8px 14px; border: 1.5px solid var(--field-border); border-radius: var(--r-md); background: var(--bg-input); cursor: pointer; font-size: 15px; }
.presence-opt:hover { border-color: var(--accent); }
.presence-opt input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); margin: 0; }
.presence-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.presence-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.presence-error { font-size: 13px; color: var(--danger); }
.presence-error:empty { display: none; }
.presence-results { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; border-top: 1px solid var(--border); }
.presence-results h2 { font-size: 22px; }
.presence-results h2:focus { outline: none; }
.presence-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.presence-send { display: flex; flex-direction: column; gap: 10px; }

/* Contact card: the optional message box and the Turnstile widget. */
.contact-message { margin-bottom: 10px; }
.contact-message textarea.cfield { min-height: 84px; resize: vertical; font: inherit; line-height: 1.45; }
.contact-turnstile:empty { display: none; }
.contact-verify { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.contact-verify:empty { display: none; }
.contact-turnstile { margin-top: 10px; max-width: 100%; overflow: hidden; }
@media (max-width: 699px) {
  .presence-opt { flex-basis: 100%; }
  .presence-actions { flex-direction: column; align-items: stretch; }
  .presence-actions .btn { width: 100%; }
}
