/* Shared base for both pages (the board adds board.css), then the receptionist demo page. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #16202a;
  --muted: #5b6878;
  --faint: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ecfdf5;
  --brand-ink: #ffffff;
  --accent: #f59e0b;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 32, 42, 0.06), 0 8px 24px rgba(16, 32, 42, 0.06);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 15px; line-height: 1.45; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 650; line-height: 1.25; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; min-width: 0; }
.brand .logo { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 18px; }
.brand-text { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-text > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .sub { font-weight: 500; color: var(--muted); font-size: 13px; white-space: nowrap; }
.top .right { display: flex; align-items: center; gap: 14px; font-size: 14px; flex: none; }
.top .right a { white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: #065f46; font-size: 12px; font-weight: 600; border: 1px solid #a7f3d0; white-space: nowrap; }
.badge.mock { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn:disabled { opacity: 0.5; cursor: default; }
.empty-note { color: var(--faint); font-size: 13px; font-style: italic; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.feed li { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); }
.feed li b { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--brand); }
.feed li .args { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; word-break: break-word; }
.feed li.err b { color: var(--danger); }
.feed li.sms { border-left: 3px solid var(--brand); }
.feed li.sms.transfer { border-left-color: var(--accent); }
.feed li.sms .to { color: var(--muted); font-size: 12px; }
.feed li.empty-note { background: none; border: 0; padding: 0; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.tag.routine { background: #e2e8f0; color: #334155; }
.tag.urgent { background: #fef3c7; color: #92400e; }
.tag.emergency { background: #fee2e2; color: #991b1b; }

/* ---- receptionist demo page ---- */
.intro { max-width: 1400px; margin: 0 auto; padding: 22px 24px 0; }
.intro h1 { font-size: 24px; letter-spacing: -0.01em; margin-bottom: 6px; }
.intro-lede { margin: 0; max-width: 72ch; }
.intro-note { margin: 6px 0 0; color: var(--muted); font-size: 13px; max-width: 80ch; }

.demo { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 20px; padding: 18px 24px 24px; max-width: 1400px; margin: 0 auto; align-items: start; }
.phone { display: flex; flex-direction: column; height: 660px; padding: 0; overflow: hidden; }
.phone-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #f8fafc, #fff); }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.phone-head .grow { flex: 1; min-width: 0; }
.phone-head .grow > b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { opacity: 0.35; } }
.phone.ended .live-dot { background: #94a3b8; animation: none; }
.timer { font-variant-numeric: tabular-nums; margin-left: 4px; }
.timer:not(:empty)::before { content: "· "; }

.transcript { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #fafbfc; overscroll-behavior: contain; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 15px; white-space: pre-wrap; animation: pop 0.18s ease-out; }
.bubble.assistant { align-self: flex-start; background: #fff; color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.bubble.typing { display: flex; gap: 4px; padding: 14px 16px; }
.bubble.typing span { width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; animation: dot 1s ease-in-out infinite; }
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }

/* What Tom did, inline in the call */
.event { align-self: center; max-width: 92%; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; animation: pop 0.18s ease-out; }
.event::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.event.ev-check::before { background: #3b82f6; }
.event.ev-message::before { background: var(--brand); }
.event.ev-warn { background: #fffbeb; color: #92400e; }
.event.ev-warn::before { background: var(--accent); }
.event.ev-info { background: none; font-style: italic; }
.event.ev-booked, .event.ev-transfer { align-self: stretch; max-width: none; display: block; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; color: var(--ink); background: var(--brand-soft); border: 1px solid #a7f3d0; }
.event.ev-booked::before, .event.ev-transfer::before { display: none; }
.event.ev-transfer { background: #fffbeb; border-color: #fde68a; }
.event.ev-transfer.is-emergency { background: #fef2f2; border-color: #fecaca; }
.ec-title { font-weight: 700; color: #065f46; display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.ec-title::before { content: "✓"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 11px; }
.ev-transfer .ec-title { color: #92400e; }
.ev-transfer .ec-title::before { content: "→"; background: var(--accent); font-weight: 800; }
.ev-transfer.is-emergency .ec-title { color: #991b1b; }
.ev-transfer.is-emergency .ec-title::before { content: "!"; background: var(--danger); }
.ec-foot { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.linkish { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Suggested replies */
.suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px 0; background: #fff; border-top: 1px solid var(--line); }
.suggest:empty { display: none; }
.suggest-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.suggest button { border: 1px solid #99d5cc; background: #f0fdfa; color: #0f5e57; border-radius: 999px; padding: 5px 12px; font-size: 13px; line-height: 1.3; text-align: left; }
.suggest button:hover { background: #ccfbf1; border-color: var(--brand); }

.composer { display: flex; gap: 8px; padding: 12px; background: #fff; }
.suggest:empty + .composer { border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; font-size: 16px; }
.composer input:focus { outline: 2px solid #99f6e4; border-color: var(--brand); }
.composer input:disabled { background: #f8fafc; color: var(--faint); }
.mic { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); display: grid; place-items: center; }
.mic:disabled { opacity: 0.4; cursor: default; }
.mic.on { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); } 50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); } }
.phone-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 14px 12px; font-size: 12px; color: var(--muted); background: #fff; }
.phone-foot label { display: flex; align-items: center; gap: 6px; }

/* Behind the scenes */
.backstage { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.backstage .wide { grid-column: 1 / -1; }
.backstage h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.h-note { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; color: var(--faint); margin-left: 4px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.progress { font-size: 12px; font-weight: 650; color: var(--muted); }
.progress.done { color: #065f46; background: var(--brand-soft); border: 1px solid #a7f3d0; padding: 1px 9px; border-radius: 999px; }
.progress.transferred { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 1px 9px; border-radius: 999px; }
dl.details { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 7px 12px; margin: 4px 0 0; font-size: 14px; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; min-height: 20px; font-weight: 550; border-radius: 4px; overflow-wrap: anywhere; }
dl.details dd.empty::before { content: "Not yet"; color: #94a3b8; font-weight: 400; font-style: italic; font-size: 13px; }
dl.details dd.new { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: #fde68a; } to { background: transparent; } }
.captured .note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

.boardwrap { max-width: 1400px; margin: 0 auto; padding: 8px 24px 24px; scroll-margin-top: 70px; }
.boardhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.boardhead h2 { font-size: 20px; margin: 0; }
.boardwrap iframe { display: block; width: 100%; height: 760px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }

.foot { max-width: 1400px; margin: 0 auto; padding: 4px 24px 40px; color: var(--muted); font-size: 14px; }

@media (max-width: 960px) {
  .demo { grid-template-columns: minmax(0, 1fr); }
  .backstage { grid-template-columns: minmax(0, 1fr); }
  .phone { height: clamp(460px, 74vh, 640px); }
}
@media (max-width: 640px) {
  .top { padding: 10px 14px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand .logo { width: 30px; height: 30px; }
  .brand .sub { display: none; }
  .top .right { gap: 10px; font-size: 13px; }
  .intro { padding: 16px 14px 0; }
  .intro h1 { font-size: 20px; }
  .intro-lede { font-size: 14.5px; }
  .demo { padding: 14px 10px 18px; gap: 14px; }
  .boardwrap, .foot { padding-left: 10px; padding-right: 10px; }
  .boardwrap iframe { height: 680px; }
  .transcript { padding: 12px; }
  .bubble { max-width: 90%; }
  .suggest { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .suggest::-webkit-scrollbar { display: none; }
  .suggest button { flex: none; white-space: nowrap; }
  dl.details { grid-template-columns: 80px minmax(0, 1fr); }
}
@media (max-width: 420px) {
  #brainBadge { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
