/* webchat site & dashboard.
   Tokens: PY4L_DESIGN.md (obsidian, greywhite, burnt red, ChunkFive wordmark).
   Rules: DESIGN_DOS_AND_DONTS.md (8pt grid, 3 text tiers, one accent for the
   action, light from above, inner radius = outer - padding, 150-250ms
   ease-out, transform & opacity only). One dark theme for every page. */
@font-face {
  font-family: "ChunkFive";
  src: url("/static/fonts/chunkfive.woff2") format("woff2"), url("/static/fonts/chunkfive.woff") format("woff");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #090a0e;
  --bg-card: #11131a;
  --bg-sub: #171a23;
  --bg-hover: #1d212c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --fg: #eceef2;
  --fg2: #a3a8b5;   /* body, 7.6:1 on --bg */
  --fg3: #737887;   /* meta only */
  --accent: #ba2626;
  --accent-hi: #d32f2f;
  --ok: #10b981;
  --danger: #f43f5e;
  --radius: 24px;
  --radius-in: 12px;
  --ease: cubic-bezier(.2, .9, .3, 1);
  /* near-critical spring (damping ~0.8, ~1.5% overshoot): toggles & lifts only */
  --spring: linear(0, .3 8%, .62 18%, .86 30%, .98 42%, 1.015 55%, 1.005 70%, 1);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--sans); min-height: 100dvh; }
a { color: var(--fg); text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.01em; }
h1 { font-size: clamp(32px, 5vw, 56px); font-weight: 800; }
h2 { font-size: clamp(24px, 3vw, 36px); font-weight: 800; }
h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
p { margin: 0 0 16px; color: var(--fg2); }
code, pre { font-family: var(--mono); font-size: 14px; }
.dim { color: var(--fg2); }
.small { font-size: 14px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.wrap.narrow { width: min(760px, 100% - 32px); }
.lede { font-size: clamp(17px, 1.6vw, 20px); color: var(--fg2); max-width: 46ch; }
.center .lede { margin-inline: auto; }

/* wordmark */
.brand { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--fg); }
.wordmark { font-family: "ChunkFive", Georgia, serif; font-size: 28px; letter-spacing: 0.01em; line-height: 1; }
.wordmark .dot { color: var(--accent); }
.brand-sub { font-weight: 700; font-size: 15px; color: var(--fg2); }

/* buttons: pill = height / 2, one filled button per view */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border-radius: 24px; border: 1px solid transparent;
  font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 150ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:active { transform: scale(.97); transition-duration: 120ms; }
.btn { touch-action: manipulation; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(186, 38, 38, .28), inset 0 1px 0 rgba(255, 255, 255, .16); }
.btn.primary:hover { background: var(--accent-hi); color: #fff; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.small { height: 40px; padding: 0 16px; border-radius: 20px; font-size: 15px; }
.btn.full { width: 100%; }
.btn.danger { color: #ff8b9c; border-color: rgba(244, 63, 94, .4); }
.btn[aria-disabled="true"] { opacity: .6; cursor: default; }
.btn.is-busy { opacity: .7; pointer-events: none; }
.textlink { background: none; border: 0; padding: 8px 0; color: var(--fg2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.textlink:hover { color: var(--fg); }

/* nav */
.site-nav { position: sticky; top: 0; z-index: 10; background: rgba(9, 10, 14, .88); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.nav-row { display: flex; align-items: center; gap: 24px; height: 72px; }
.nav-links { display: flex; gap: 4px; margin-left: 16px; }
.navlink { color: var(--fg2); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.navlink:hover { color: var(--fg); background: var(--bg-hover); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
@media (max-width: 767px) { .nav-links { display: none; } .nav-right .navlink { padding-inline: 8px; } }

/* hero */
.hero { position: relative; padding: 40px 0 64px; overflow: hidden; }
.hero > .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero h1 { max-width: 18ch; font-size: clamp(34px, 4.4vw, 54px); }
.cta-row { display: flex; align-items: center; gap: 24px; margin-top: 32px; flex-wrap: wrap; }
.demo-frame {
  /* fits under the nav without scrolling, so a visitor sees the message box */
  height: clamp(420px, calc(100svh - 72px - 96px), 540px); border-radius: var(--radius); padding: 8px; background: linear-gradient(180deg, #161922, #0d0f15);
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.demo-mount { height: 100%; border-radius: 16px; overflow: hidden; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 24px; } .hero { padding-top: 24px; } .demo-frame { height: clamp(380px, calc(100svh - 440px), 480px); } }

/* steps band */
.steps-band { padding: 88px 0; border-top: 1px solid var(--line); background: linear-gradient(180deg, #0c0d12, var(--bg)); }
.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 20px; counter-reset: s; }
.steps li { counter-increment: s; padding: 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); min-width: 0; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 16px; background: var(--bg-hover); color: var(--fg); font-weight: 700; margin-bottom: 16px; }
.steps p { margin-bottom: 0; }
.code { margin: 16px 0 0; padding: 16px; border-radius: var(--radius-in); background: #07080b; border: 1px solid var(--line); color: #d7dae2; overflow-x: auto; white-space: pre; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }

/* features bento: 6 items, 6 cells */
.features { padding: 96px 0; }
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; }
.cell { padding: 24px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-card); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); min-width: 0; }
.cell p:last-child { margin-bottom: 0; }
.cell-wide { grid-column: span 2; }
.cell-knowledge { background: radial-gradient(120% 140% at 100% 0%, rgba(186, 38, 38, .14), transparent 55%), var(--bg-card); }
.kb-sample { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.kb-sample span { font: 13px var(--mono); padding: 8px 12px; border-radius: 10px; background: var(--bg-sub); border: 1px solid var(--line); color: var(--fg2); }
.cell-leads { background: linear-gradient(160deg, #13161f, #0e1016); }
.cell-handoff { background: repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 12px), var(--bg-card); }
.lang-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lang-row span { padding: 6px 12px; border-radius: 16px; border: 1px solid var(--line-strong); color: var(--fg); font-size: 14px; }
.cell-gaps { grid-column: 1 / -1; background: linear-gradient(90deg, rgba(16, 185, 129, .08), transparent 60%), var(--bg-card); }
@media (max-width: 900px) { .bento { grid-template-columns: 1fr; } .cell-wide { grid-column: auto; } }

/* pricing: price speaks first, one picked plan, raised */
.price-band { padding: 96px 0; border-top: 1px solid var(--line); }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; align-items: start; }
.plan { position: relative; padding: 24px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1); transition: transform 150ms var(--ease); display: flex; flex-direction: column; }
.plan:hover { transform: translateY(-4px); transition: transform 200ms var(--spring); }
.plan-pick { border: 2px solid var(--accent); transform: translateY(-16px); box-shadow: 0 24px 48px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .1); }
.plan-pick:hover { transform: translateY(-20px); }
.badge { position: absolute; top: -12px; left: 24px; background: var(--accent); color: #fff; font: 700 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: 12px; }
.plan-name { font-size: 14px; font-variant: small-caps; text-transform: lowercase; letter-spacing: .08em; color: var(--fg2); font-weight: 700; margin: 0; }
.plan-price { margin: 8px 0 16px; color: var(--fg); }
.plan-price .num { font-size: 52px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-price .per { font-size: 16px; color: var(--fg2); margin-left: 4px; }
.checks { list-style: none; padding: 0; margin: 0 0 32px; display: grid; gap: 14px; flex: 1; }
.checks li { display: flex; gap: 10px; color: var(--fg2); font-size: 15px; }
.tick { color: var(--fg); font-weight: 700; }
.fine { margin-top: 32px; font-size: 14px; color: var(--fg3); }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } .plan-pick { transform: none; } .plan-pick:hover { transform: translateY(-4px); } }

/* faq */
.faq { padding: 96px 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 20px 0; font-weight: 600; font-size: 18px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--fg2); font-weight: 400; font-size: 22px; line-height: 1; transition: transform 200ms var(--spring); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: 8px; }
.final { position: relative; overflow: hidden; padding: 96px 0 112px; border-top: 1px solid var(--line); }
.final > .wrap { position: relative; z-index: 1; }
.final .btn { margin-top: 8px; }

/* footer */
.site-foot { border-top: 1px solid var(--line); padding: 32px 0; font-size: 14px; }
.foot-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: space-between; }
.foot-row nav { display: flex; gap: 20px; }
.foot-row a { color: var(--fg2); text-decoration: none; }
.foot-row a:hover { color: var(--fg); }
.site-foot .wordmark { font-size: 20px; }
.page { padding: 64px 0 96px; }

/* forms */
label { display: block; font-weight: 600; font-size: 15px; margin: 24px 0 8px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), input[inputmode], textarea, select {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg-sub); border: 1px solid var(--line-strong);
  border-radius: var(--radius-in); padding: 0 16px; height: 52px;
}
textarea { height: auto; padding: 14px 16px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--fg3); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--fg); outline-offset: 1px; border-color: transparent; }
input[type=color] { width: 64px; height: 44px; padding: 4px; border-radius: 10px; background: var(--bg-sub); border: 1px solid var(--line-strong); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
input[type=file] { color: var(--fg2); }
form .btn[type=submit] { margin-top: 32px; }
.hint { font-size: 14px; color: var(--fg3); margin: 8px 0 0; }
.form-error, .flash-err { background: rgba(244, 63, 94, .1); border: 1px solid rgba(244, 63, 94, .35); color: #ffc2cc; padding: 12px 16px; border-radius: var(--radius-in); }
.flash-ok { background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .3); color: #b7f0db; padding: 12px 16px; border-radius: var(--radius-in); }

/* auth */
.auth-body { display: grid; place-items: center; padding: 32px 16px; background: radial-gradient(60% 50% at 50% 0%, #141720, var(--bg)); }
.auth { width: min(440px, 100%); display: grid; gap: 24px; justify-items: center; }
.auth-card { width: 100%; }
.auth-card h1 { font-size: 32px; }
.swap { text-align: center; margin: 24px 0 0; font-size: 15px; }

/* cards */
.card { padding: 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); margin-bottom: 20px; min-width: 0; }
.card h2 { font-size: 20px; }
.card.empty { text-align: center; padding: 48px 24px; }
.card.list { padding: 8px; }

/* dashboard */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
.side { border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; gap: 32px; position: sticky; top: 0; height: 100dvh; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--fg2); text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--bg-hover); color: var(--fg); }
.side-nav a[aria-current="page"] { background: var(--bg-sub); color: var(--fg); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; display: inline-grid; place-items: center; }
.side-foot { margin-top: auto; display: grid; gap: 4px; overflow-wrap: anywhere; }
.app-main { padding: 40px clamp(16px, 4vw, 48px) 80px; max-width: 1200px; width: 100%; min-width: 0; }
.app-main h1 { font-size: 32px; }
.section-h { font-size: 20px; margin-top: 40px; }
.crumb { font-size: 14px; color: var(--fg3); margin-bottom: 8px; }
.crumb a { color: var(--fg2); }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { grid-auto-flow: column; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .side-foot { margin: 0 0 0 auto; grid-auto-flow: column; align-items: center; gap: 12px; }
  .side-foot .dim { display: none; }
  .app-main { padding-top: 24px; }
}
.tiles { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 20px; margin: 24px 0; }
.tile { padding: 20px 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
.tile-label { font-size: 14px; color: var(--fg2); }
.tile-num { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-loud .tile-num { font-size: 44px; }
.tile-num.small-num { font-size: 22px; }
@media (max-width: 1000px) { .tiles { grid-template-columns: 1fr 1fr; } }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--bg-hover); overflow: hidden; margin: 8px 0; }
.meter-fill { display: block; height: 100%; width: 100%; background: var(--fg); border-radius: 3px; transform-origin: left; transform: scaleX(0); transition: transform 300ms var(--ease); }
.bot-row, .chat-row { display: grid; align-items: center; gap: 4px 16px; padding: 14px 16px; border-radius: 16px; text-decoration: none; color: var(--fg); min-height: 56px; }
.bot-row { grid-template-columns: 16px auto 1fr 16px; }
.bot-row:hover, .chat-row:hover { background: var(--bg-hover); }
.bot-name { font-weight: 700; }
.swatch { width: 14px; height: 14px; border-radius: 7px; background: var(--accent); }
.chev { color: var(--fg3); font-size: 22px; }
.chat-row { grid-template-columns: auto 1fr auto; grid-template-areas: "who meta when" "last last tag"; }
.chat-row .who { grid-area: who; font-weight: 700; }
.chat-row .dim:not(.when) { grid-area: meta; }
.chat-row .when { grid-area: when; }
.chat-row .last { grid-area: last; color: var(--fg2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .tag { grid-area: tag; }
.chat-row.unread .who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px; background: var(--bg-hover); color: var(--fg2); white-space: nowrap; }
.tag-wait { background: rgba(186, 38, 38, .18); color: #ffb4b4; }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.seg a { padding: 8px 14px; border-radius: 12px; text-decoration: none; color: var(--fg2); font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; }
.seg a[aria-current="page"] { background: var(--bg-hover); color: var(--fg); }
.gaps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.gaps li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.gaps li:last-child { border-bottom: 0; }
.bot-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; margin-top: 24px; }
.preview-col { position: sticky; top: 24px; }
.preview-card .demo-mount { height: 540px; margin-top: 16px; border: 1px solid var(--line); border-radius: 20px; }
@media (max-width: 1100px) { .bot-grid { grid-template-columns: 1fr; } .preview-col { position: static; } }
.copy-row { display: flex; gap: 12px; align-items: flex-start; }
.copy-row .code { flex: 1; margin: 0; white-space: pre-wrap; word-break: break-all; }
.docs { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.doc { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; border-radius: 16px; background: var(--bg-sub); border: 1px solid var(--line); }
.doc > div { display: grid; min-width: 0; }
.doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc form .btn { margin: 0; }
.empty-line { margin: 16px 0; padding: 16px; border-radius: 16px; border: 1px dashed var(--line-strong); }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--bg-sub); border: 1px solid var(--line); margin-top: 16px; flex-wrap: wrap; }
.tabs button { all: unset; cursor: pointer; padding: 8px 14px; min-height: 24px; border-radius: 12px; color: var(--fg2); font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--bg-hover); color: var(--fg); }
.tabs button:focus-visible { outline: 2px solid var(--fg); }
.danger-zone { border-color: rgba(244, 63, 94, .25); }
.danger-zone form .btn[type=submit] { margin-top: 8px; }
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.chat-head form .btn[type=submit] { margin-top: 0; }
.thread { display: flex; flex-direction: column; max-height: 60dvh; overflow-y: auto; }
.thread .msg { max-width: 75%; margin-top: 18px; align-self: flex-start; animation: enter 240ms var(--ease) both; }
.thread .msg:first-child { margin-top: 0; }
.thread .msg p { margin: 0; padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.thread .them p { background: var(--bg-sub); border: 1px solid var(--line); }
.thread .bot { align-self: flex-end; }
.thread .bot p { background: var(--bg-hover); }
.thread .me { align-self: flex-end; }
.thread .me p { background: var(--accent); color: #fff; }
.thread .sys { align-self: center; }
.thread .sys p { background: none; color: var(--fg3); font-size: 13px; }
.thread .by { display: block; font-size: 12px; color: var(--fg3); margin: 0 6px 4px; text-align: right; }
.reply { display: flex; gap: 12px; align-items: flex-end; }
.reply textarea { flex: 1; }
.reply .btn[type=submit] { margin-top: 0; }
.teach { margin-top: 20px; }
.teach .btn[type=submit] { margin-top: 16px; }
.upsell { margin-top: 20px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form select, .inline-form input { height: 40px; width: auto; min-width: 120px; }
.inline-form .btn[type=submit] { margin-top: 0; }
.admin-tiles { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .admin-tiles { grid-template-columns: 1fr 1fr; } }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; margin-top: 16px; }
.bar { flex: 1; min-width: 4px; background: var(--fg); border-radius: 3px 3px 0 0; height: 100%; opacity: .85; transform-origin: bottom; transform: scaleY(.01); transition: transform 250ms var(--ease); }
.row-gap { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-gap form .btn[type=submit] { margin-top: 0; }
.plan form .btn[type=submit] { margin-top: 0; }
.plan .hint { margin-top: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.row-between p { margin: 0; }
.table-wrap { overflow-x: auto; padding: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 600; color: var(--fg2); padding: 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  thead { display: none; }
  tr { display: grid; padding: 12px 0; border-bottom: 1px solid var(--line); }
  td { border: 0; padding: 2px 12px; }
  td.num { text-align: left; }
}

/* tickets */
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-bar input { flex: 1 1 260px; }
.search-bar select { width: auto; flex: 0 0 auto; }
.search-bar .btn[type=submit] { margin-top: 0; }
.howto { margin: 0; padding-left: 20px; display: grid; gap: 12px; color: var(--fg2); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin: 0; }
.meta-grid dt { font-size: 13px; color: var(--fg3); }
.meta-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.transcript { margin: 0; padding: 16px; border-radius: var(--radius-in); background: #07080b; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 70dvh; overflow-y: auto; color: #d7dae2; }

/* ---------------------------------------------------------------------------
   Motion. Engines: anime.js 3.2.2 (static/vendor) for staggers, count-ups &
   tickers; CSS keyframes for particles; IntersectionObserver for reveals.
   Rules: DESIGN_DOS_AND_DONTS.md section 5. */

/* hero: copy enters in a 40ms stagger, the demo rises last */
.hero-copy > * { animation: enter 220ms var(--ease) both; }
.hero-copy > *:nth-child(2) { animation-delay: 40ms; }
.hero-copy > *:nth-child(3) { animation-delay: 80ms; }
.hero .demo-frame { animation: enter 250ms var(--ease) 140ms both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ambient particles: the wordmark's red dot, now & then a chat bubble */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.particle {
  position: absolute; left: var(--x, 50%); bottom: -12px;
  width: var(--size, 4px); height: var(--size, 4px); border-radius: 50%;
  background: var(--accent); opacity: 0;
  animation: float var(--dur, 9s) ease-in-out var(--delay, 0s) infinite;
}
.particle-bubble { background: none; border-radius: 0; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
@keyframes float {
  0% { transform: translateY(0) scale(.7); opacity: 0; }
  15% { opacity: var(--peak, .4); }
  50% { transform: translateY(-180px) scale(1); opacity: var(--peak, .4); }
  85% { opacity: 0; }
  100% { transform: translateY(-300px) scale(.7); opacity: 0; }
}

/* scroll reveal: hidden only when scripts run, so crawlers see content */
@media (scripting: enabled) {
  [data-reveal] {
    opacity: 0; transform: translateY(12px);
    transition: opacity 250ms var(--ease), transform 250ms var(--ease);
    transition-delay: calc(var(--i, 0) * 40ms);
  }
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* cards lift on hover with the near-critical spring, sink on press */
.cell, .steps li { transition: transform 200ms var(--spring), border-color 150ms var(--ease); }
.cell:hover, .steps li:hover { transform: translateY(-3px); border-color: var(--line-strong); }

/* steps: a line joins the cards, a dot travels it */
.steps { position: relative; }
.steps::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 40px; height: 1px; z-index: 0;
  background: linear-gradient(90deg, var(--accent), var(--line-strong));
  transform: scaleX(0); transform-origin: left; transition: transform 600ms var(--ease) 200ms;
}
.steps.drawn::before { transform: scaleX(1); }
.steps li { position: relative; z-index: 1; }
.steps li::before { transition: background-color 200ms var(--ease), color 200ms var(--ease); }
.steps.drawn li:nth-child(1)::before { background: var(--accent); color: #fff; }
@media (max-width: 900px) { .steps::before { display: none; } }

/* leads ticker: fixed height, rows swap in place, nothing around it moves */
.lead-feed { display: grid; grid-auto-rows: 66px; gap: 8px; margin-top: 16px; height: 140px; overflow: hidden; }
/* knowledge: a read bar fills, then says it's ready */
.kb-read { display: flex; align-items: center; gap: 12px; margin-top: 20px; font-size: 14px; color: var(--fg2); }
.kb-bar { flex: 1; max-width: 280px; height: 4px; border-radius: 2px; background: var(--bg-hover); overflow: hidden; }
.kb-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(1); }
.kb-read.ready .kb-note { color: var(--ok); }
/* bookings: slots, one gets picked */
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.slots span { padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line-strong); font: 13px var(--mono); color: var(--fg2); transition: background-color 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease); }
.slots span.on { background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .5); color: #b7f0db; }

.lead-row { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 10px 12px; border-radius: var(--radius-in); background: var(--bg-sub); border: 1px solid var(--line); font-size: 14px; }
.lead-row strong { color: var(--fg); }
.lead-how { color: var(--fg2); font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-why { grid-column: 1 / -1; color: var(--fg3); font-size: 13px; }

/* hand-off mini thread */
.handoff-play { display: grid; gap: 6px; margin-top: 16px; min-height: 104px; align-content: start; }
.hp-line { justify-self: start; max-width: 90%; padding: 8px 12px; border-radius: 16px; background: var(--bg-sub); border: 1px solid var(--line); font-size: 14px; color: var(--fg); }
.hp-line.hp-sys { justify-self: center; background: none; border: 0; color: var(--ok); font-size: 13px; font-weight: 600; }
.hp-line.hp-me { justify-self: end; background: var(--accent); border-color: transparent; color: #fff; }

/* languages: one word lit at a time */
.lang-row span { transition: background-color 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--spring); }
.lang-row span.on { background: var(--accent); border-color: var(--accent); color: #fff; transform: translateY(-2px); }

/* auth & dashboard cards enter once */
.auth-card { animation: enter 220ms var(--ease) both; }
.app-main > h1 { animation: enter 200ms var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  /* fade in place: no travel, no particles, no loops */
  [data-reveal] { transform: none; transition: opacity 200ms linear; transition-delay: 0s; }
  .particles { display: none; }
  .cell:hover, .steps li:hover, .lang-row span.on { transform: none; }
  .steps::before { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .plan:hover, .plan-pick, .plan-pick:hover { transform: none; }
  [data-reveal] { transition-duration: 200ms !important; }
}
