/* One design for the whole site (tokens and type as in CRAFTALLER). Light by default; dark when the visitor switches
   it (<html data-theme="dark">, public/theme.js). */
:root {
  --bg: #ffffff;
  --bg-2: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --ink: #15181d;
  --ink-2: #424955;
  --muted: #6b7380;
  --line: #e3e6ea;
  --line-2: #cfd5dc;
  --accent: #2c4a6e;
  --accent-2: #213a58;
  --accent-ink: #ffffff;
  --accent-soft: #eef2f7;
  --ok: #2f6f4e;
  --ok-soft: #e8f2ec;
  --warn-soft: #fff7e8;
  --warn-ink: #6a4a12;
  --err: #c0392b;
  --err-soft: #fdf0ee;
  --err-ink: #8a2e1c;
  --info-soft: #eef2f7;
  --user: #f0f2f5;
  --code-bg: #f5f6f8;
  --radius: 10px;
  --maxw: 1180px;
  --top-bg: rgba(255, 255, 255, 0.94);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1318;
  --bg-2: #161b22;
  --surface: #141920;
  --surface-2: #1a2028;
  --ink: #e8ebef;
  --ink-2: #b8bfc9;
  --muted: #8a93a0;
  --line: #252c35;
  --line-2: #364049;
  --accent: #9db8dc;
  --accent-2: #b8cce7;
  --accent-ink: #0f1318;
  --accent-soft: #1b2532;
  --ok: #7cc6a0;
  --ok-soft: #16261e;
  --warn-soft: #2a2416;
  --warn-ink: #e3c27e;
  --err: #ff8f80;
  --err-soft: #2c1a18;
  --err-ink: #ffb3a8;
  --info-soft: #1b2532;
  --user: #1d242d;
  --code-bg: #161b22;
  --top-bg: rgba(15, 19, 24, 0.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 Manrope, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { font-weight: 650; color: var(--ink); margin: 0; }
h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.08; letter-spacing: -0.03em; }
h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; }
h3 { font-size: 16px; line-height: 1.3; }
p { margin: 0; }
code, pre { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; font-size: 0.88em; }
code { background: var(--code-bg); border-radius: 4px; padding: 1px 5px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; overflow-x: auto; line-height: 1.5; margin: 12px 0; }
pre code { background: none; padding: 0; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
form.inline { display: inline; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: transparent; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { display: flex; width: 100%; white-space: normal; text-align: center; height: auto; min-height: 48px; padding: 10px 18px; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.textbtn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; }
.textbtn:hover { color: var(--ink); }
.textbtn.danger:hover { color: var(--err); }
.textlink { color: var(--accent); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.textlink:hover { text-decoration: underline; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: var(--top-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; height: 64px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.wordmark { font-size: 16px; font-weight: 800; letter-spacing: 0.3em; }
.wordmark.small { font-size: 13px; }
.brand .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.nav { display: flex; gap: 22px; height: 100%; }
.nav a { display: flex; align-items: center; text-decoration: none; color: var(--ink-2); font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.top-right { display: flex; align-items: center; gap: 14px; }
.pill { font-size: 13px; color: var(--ink-2); text-decoration: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; white-space: nowrap; }
.pill b { color: var(--ink); }
.theme-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); cursor: pointer; padding: 0; }
.theme-btn:hover { color: var(--ink); border-color: var(--line-2); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }

/* ---------- layout ---------- */
.main { max-width: var(--maxw); margin: 0 auto; padding: 0 24px 80px; }
.main > section { margin-top: 64px; }
.main > section.hero, .main > section.tight { margin-top: 0; }
.main > section.tight { margin-top: 28px; }
.hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 64px; align-items: end; padding: 80px 0 52px; border-bottom: 1px solid var(--line); }
.hero.small { display: block; padding: 52px 0 24px; border-bottom: 0; }
.hero.small h1 { font-size: clamp(28px, 3.6vw, 40px); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.lead { font-size: 18px; line-height: 1.55; color: var(--ink-2); margin-top: 16px; max-width: 640px; }
.cta { display: flex; gap: 12px; margin: 30px 0 14px; flex-wrap: wrap; }
.hint { font-size: 14px; font-weight: 600; color: var(--ok); }
.hero-file { grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr); align-items: center; gap: 40px; padding: 44px 0 40px; }
.hero-file .lead { font-size: 17px; }
.mini-stats { display: flex; gap: 28px; margin: 26px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats dt { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mini-stats dd { margin: 0; font-size: 13px; color: var(--muted); }
.file-wrap { display: flex; justify-content: center; }
.stats { display: grid; border-top: 1px solid var(--line); }
.stat { display: flex; align-items: baseline; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.stat b { font-size: 32px; font-weight: 650; letter-spacing: -0.03em; min-width: 80px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 14px; }
.shead { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.shead p { color: var(--muted); margin-top: 6px; font-size: 15px; max-width: 640px; }
.shead.plain { border-bottom: 0; padding-bottom: 0; margin-bottom: 14px; align-items: center; }
.narrow { max-width: 520px; margin: 64px auto 0; }
.narrow h1 { font-size: 34px; }
.crumbs { margin: 28px 0 0; font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }

/* ---------- avatars (portrait or monogram) ---------- */
.arole { color: var(--accent); font-size: 13px; font-weight: 600; }
.arole.big { font-size: 16px; margin-top: 4px; }
.avatar { flex: none; display: grid; place-items: center; border-radius: 10px; color: #fff; font-weight: 800; overflow: hidden; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 55%, #000)); }
.avatar.photo { background: #e9e6df; }
.avatar.photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.avatar.sm { width: 36px; height: 36px; font-size: 15px; border-radius: 8px; }
.avatar.md { width: 48px; height: 48px; font-size: 20px; }
.avatar.lg { width: 76px; height: 76px; font-size: 32px; border-radius: 14px; }
.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; }

/* ---------- index cards (views/rolodex.js): the site's surface and type, a full-height photo, a name tab ---------- */
.rolodex, .ic-single, .card-table { --card-w: 600px; --card-h: 316px; }
.ic { position: relative; width: var(--card-w); max-width: 100%; height: var(--card-h); padding-top: 22px; }
.ic-tab {
  position: absolute; top: 0; z-index: 1; left: calc(5% + var(--tab, 0) * 17.5%); height: 23px; padding: 0 12px;
  display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 8px 8px 0 0; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
.ic-face {
  position: relative; display: grid; grid-template-columns: 37% 1fr; height: 100%; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s;
}
a.ic-face:hover { border-color: var(--accent); }
/* depth on the drum: cards further back fade into the page */
.ic-face::after, .ic-tab::after { content: ''; position: absolute; inset: 0; background: var(--bg); opacity: var(--shade, 0); pointer-events: none; border-radius: inherit; }
.ic-photo { position: relative; overflow: hidden; background: var(--fig-bg, var(--bg-2)); border-right: 1px solid var(--line); }
.ic-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transition: transform 0.35s ease; user-select: none; }
a.ic-face:hover .ic-photo img { transform: scale(1.03); }
.ic-mono { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.ic-body { display: flex; flex-direction: column; min-width: 0; padding: 18px 22px 16px; }
.ic-no { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.ic-name { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; margin-top: 8px; }
.ic-role { font-size: 13px; font-weight: 600; color: var(--accent); margin-top: 4px; }
.ic-quote { font-size: 15px; line-height: 1.45; font-weight: 500; color: var(--ink); margin-top: 14px; padding-left: 12px; border-left: 2px solid var(--accent); }
.ic-desc { font-size: 13.5px; line-height: 1.5; color: var(--ink-2); margin-top: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ic-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.ic-status { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--ok-soft); color: var(--ok); }
.ic-taken .ic-status { background: var(--bg-2); color: var(--muted); }
.ic-mine .ic-status { background: var(--accent-soft); color: var(--accent); }
.ic-price { font-size: 13px; font-weight: 600; color: var(--ink-2); }
/* EU AI Act Art. 50(1): every agent is marked as an AI system where people first meet it */
.ic-ai { position: absolute; top: 10px; left: 10px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: #fff; background: rgba(21, 24, 29, 0.72); border-radius: 4px; padding: 2px 6px; }
.ic-stamp {
  position: absolute; right: 10px; bottom: 12px; transform: rotate(-7deg); padding: 3px 10px; border: 2px solid currentColor; border-radius: 6px;
  color: var(--err); background: color-mix(in srgb, var(--surface) 88%, transparent); font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
}
.ic-mine .ic-stamp { color: var(--accent); }
.ic-taken .ic-photo img { filter: grayscale(0.6); }
/* a single card on an agent page */
.ic-single .ic { width: 100%; height: auto; }
.ic-single .ic-face { min-height: 316px; }
.ic-single .ic-desc { -webkit-line-clamp: unset; display: block; }

/* ---------- the drum ---------- */
.rolodex { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: 0; }
.rdx-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 640px; }
.rdx-tabs button {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 8px 8px 3px 3px;
  padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline;
}
.rdx-tabs button span { font-size: 11px; color: var(--muted); font-weight: 600; }
.rdx-tabs button:hover { border-color: var(--accent); color: var(--ink); }
.rdx-tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rdx-tabs button.on span { color: inherit; opacity: 0.7; }
.rdx-stage { position: relative; width: var(--card-w); max-width: 100%; outline: none; }
.rdx-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 12px; }
.rdx-rod, .rdx-controls { display: none; }
.rolodex:not(.rdx-on) .rdx-drum { display: flex; flex-direction: column; gap: 18px; }
.rolodex:not(.rdx-on) .rdx-hint { display: none; }
/* with JavaScript (public/app.js): cards stand on a rod and turn around it */
.rdx-on .rdx-stage { height: calc(var(--card-h) + 168px); touch-action: pan-y; cursor: grab; user-select: none; }
.rdx-on .rdx-stage.dragging { cursor: grabbing; }
.rdx-on .rdx-drum { position: absolute; inset: 0; }
.rdx-on .ic { position: absolute; left: 0; right: 0; bottom: 28px; transform-origin: 50% 100%; backface-visibility: hidden; will-change: transform, opacity; }
.rdx-on .ic-face { box-shadow: 0 1px 2px rgba(15, 20, 30, 0.05), 0 14px 30px -20px rgba(15, 20, 30, 0.45); }
.rdx-on .rdx-rod { display: block; position: absolute; left: -18px; right: -18px; bottom: 21px; height: 8px; border-radius: 4px; background: var(--ink-2); z-index: 2000; }
.rdx-knob { position: absolute; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 2px 6px rgba(15, 20, 30, 0.12); }
.rdx-knob::after { content: ''; position: absolute; left: 50%; top: 4px; width: 2px; height: 8px; margin-left: -1px; border-radius: 1px; background: var(--ink-2); }
.rdx-knob.l { left: -15px; }
.rdx-knob.r { right: -15px; }
.rdx-on .rdx-stage::after { content: ''; position: absolute; left: 8%; right: 8%; bottom: 4px; height: 16px; border-radius: 50%; background: radial-gradient(closest-side, rgba(15, 20, 30, 0.14), transparent); z-index: -1; }
.rdx-on .rdx-controls { display: flex; align-items: center; gap: 16px; }
.rdx-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; display: grid; place-items: center; }
.rdx-btn:hover { border-color: var(--accent); }
.rdx-counter { font: 600 14px ui-monospace, Consolas, monospace; letter-spacing: 0.08em; color: var(--ink-2); min-width: 72px; text-align: center; }
.rdx-hint { font-size: 12.5px; color: var(--muted); text-align: center; }
:root[data-theme="dark"] .rdx-on .ic-face { box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.8); }

/* /agents: every card laid out on the table */
.card-table { display: flex; flex-direction: column; gap: 26px; }
.rdx-tabs.left { justify-content: flex-start; max-width: none; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
.card-grid .ic { width: 100%; height: 300px; }
/* tabs step across only in the drum, where cards stand behind each other */
.card-grid .ic-tab, .ic-single .ic-tab { left: 16px; }
.card-grid .ic[hidden] { display: none; }

/* ---------- home ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.steps h3 { margin-bottom: 6px; font-size: 18px; }
.steps p { color: var(--ink-2); font-size: 15px; }
.pnum { display: block; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 12px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan .price { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.plan .price span { font-size: 15px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.plan .btn { margin-top: auto; }
.ticks { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 8px; }
.ticks li { position: relative; padding-left: 22px; font-size: 14.5px; color: var(--ink-2); }
.ticks li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 10px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.faq { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.faq details { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: '+'; color: var(--muted); font-weight: 400; font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { color: var(--ink-2); margin-top: 10px; font-size: 15px; }

/* ---------- agent page ---------- */
.agent-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; margin-top: 24px; align-items: start; }
.profile { display: flex; flex-direction: column; gap: 16px; }
.profile-head { display: flex; gap: 18px; align-items: center; }
.profile > p { color: var(--ink-2); }
.profile .lead { margin-top: 0; color: var(--ink); font-weight: 500; }
.ai-note { font-size: 13px; line-height: 1.5; color: var(--ink-2); background: var(--bg-2); border-radius: 8px; padding: 10px 12px; }
.ai-note .ai { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--bg); background: var(--ink); border-radius: 4px; padding: 2px 6px; margin-right: 4px; }
.facts { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.buy { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.buy-title { font-weight: 700; font-size: 17px; }
.buy-price { font-size: 15px; color: var(--ink-2); }
.buy-price b { font-size: 22px; color: var(--ink); letter-spacing: -0.02em; }
.buy form { display: flex; flex-direction: column; gap: 12px; }
.waiver { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); cursor: pointer; }
.waiver input { margin-top: 3px; flex: none; accent-color: var(--accent); }

/* ---------- chat ---------- */
.chat { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - 110px); position: sticky; top: 84px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head b { display: block; font-size: 15px; }
.chat-head span { display: block; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.msg p + p, .msg ul, .msg ol { margin-top: 8px; }
.msg ul, .msg ol { padding-left: 20px; margin-bottom: 0; }
.msg li + li { margin-top: 3px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.agent { align-self: flex-start; background: var(--user); border-bottom-left-radius: 4px; }
.msg.greeting { background: var(--accent-soft); }
.msg.err { background: var(--err-soft); color: var(--err-ink); }
.msg.typing::after { content: ''; display: inline-block; width: 6px; height: 14px; margin-left: 2px; vertical-align: -2px; background: currentColor; opacity: 0.5; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.msg.wait { color: var(--muted); }
.msg.wait span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 4px; animation: pulse 1.2s infinite ease-in-out; }
.msg.wait span:nth-child(2) { animation-delay: 0.15s; }
.msg.wait span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 12px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--ink-2); text-align: left; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chat-form { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); line-height: 1.45; }
.chat-form textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.chat-form .btn { height: 42px; }
.chat-locked { padding: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; background: var(--surface-2); font-size: 14.5px; }
.chat-meter { padding: 0 16px 12px; margin-top: -2px; }
.chat-meter:empty { display: none; }

/* ---------- notices, forms, panels ---------- */
.notice { padding: 12px 16px; border-radius: 8px; font-size: 14.5px; margin: 20px 0 0; background: var(--info-soft); color: var(--ink); }
.notice a { font-weight: 700; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.err { background: var(--err-soft); color: var(--err-ink); }
.buy .notice { margin: 0; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.form.wide { margin-top: 24px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.form label .muted { font-weight: 400; }
input[type="email"], input[type="text"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); font-size: 15px; font-weight: 400; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="color"] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); }
input[type="file"] { font-size: 14px; font-weight: 400; }
input.xs { width: 72px; padding: 5px 8px; font-size: 13px; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; line-height: 1.55; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form.row { flex-direction: row; }
.form.row input { flex: 1; min-width: 180px; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; margin-top: 12px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; align-items: start; }
.cols.wide-left { grid-template-columns: 1.4fr 1fr; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.main > .panel { margin-top: 20px; }
.panel h2 { font-size: 19px; }
.panel h3 { margin-top: 10px; }
.big-number { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.big-number span { font-size: 22px; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li a { flex: 1; text-decoration: none; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.err { background: var(--err-soft); color: var(--err-ink); }
.badge.info { background: var(--info-soft); color: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table tbody th { color: var(--ink); width: 34%; }
.table.compact th, .table.compact td { padding: 7px 8px; }
.table tr.flag td { background: var(--warn-soft); }
.signout { margin-top: 28px; }
.empty { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 8px; }
.meter { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; min-width: 140px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- studio ---------- */
.studio-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.srow { display: flex; align-items: center; gap: 16px; padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.srow:hover b { color: var(--accent); }
.srow .grow { display: flex; flex-direction: column; }
.srow-meta { display: flex; align-items: center; gap: 12px; }
.studio-head { display: flex; gap: 18px; align-items: center; margin-top: 18px; }
.studio-head h1 { font-size: 32px; }
.studio-usage { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.tabs { display: flex; gap: 4px; margin-top: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; font-size: 14px; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.play { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
.play .chat { position: static; max-height: 70vh; }
.play-side { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding-top: 6px; }
.newkey { border: 1px solid var(--ok); background: var(--ok-soft); border-radius: var(--radius); padding: 16px 18px; margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.copyrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copyrow code { font-size: 14px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
.snippet { display: block; white-space: pre-wrap; word-break: break-all; font-size: 12.5px !important; line-height: 1.5; max-width: 100%; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 500 !important; color: var(--ink) !important; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check.big b { font-size: 15px; }
fieldset.plain { border: 0; padding: 0; gap: 8px; }
fieldset.plain legend { padding: 0; margin-bottom: 6px; font-size: 14px; color: var(--ink-2); }
.code-tabs { margin-top: 6px; }
.code-tab-bar { display: flex; gap: 4px; }
.code-tab-bar button { border: 1px solid var(--line); border-bottom: 0; background: var(--surface); padding: 6px 12px; border-radius: 6px 6px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.code-tab-bar button.on { color: var(--ink); background: var(--code-bg); }
.code-tabs pre { margin-top: 0; border-top-left-radius: 0; }

/* ---------- docs and legal ---------- */
.docs { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 48px; margin-top: 12px; }
.docs-nav { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 2px; }
.docs-nav a { text-decoration: none; color: var(--ink-2); font-size: 14px; padding: 6px 10px; border-radius: 6px; }
.docs-nav a:hover { background: var(--bg-2); color: var(--ink); }
.docs-body section { padding: 8px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 20px; scroll-margin-top: 80px; }
.docs-body h2 { margin-bottom: 10px; }
.docs-body p { color: var(--ink-2); margin: 10px 0; }
.legal { max-width: 760px; margin: 52px auto 0; }
.legal h1 { font-size: 36px; margin-bottom: 8px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--ink-2); }
.legal p { margin: 8px 0; }
.legal ul { padding-left: 20px; }

/* ---------- admin ---------- */
.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 20px; margin-top: 20px; border-top: 1px solid var(--line); }
.stats-row .stat { flex-direction: column; gap: 2px; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); margin-top: 40px; }
.foot-in { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 40px; display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.foot-in p { margin-top: 8px; max-width: 520px; }
.foot-nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.foot-nav a { text-decoration: none; color: var(--ink-2); font-size: 14px; }
.foot-nav a:hover { color: var(--accent); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.foot-nav .linkish { font-size: 14px; }
.legal .linkish, .linkish:hover { color: var(--accent); }

/* ---------- cookie consent (public/consent.js; only while PostHog is configured) ---------- */
/* above the agent widget (public/widget.js .anchor, z-index 2147483000) until a choice is made */
.consent {
  position: fixed; z-index: 2147483100; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(21, 24, 29, 0.14);
}
.consent[hidden] { display: none; }
.consent-text { flex: 1; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.consent-text b { color: var(--ink); }
.consent-text a { color: var(--accent); font-weight: 700; text-decoration: none; }
.consent-buttons { display: flex; gap: 8px; flex: none; }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 52px; }
  .grid, .plans { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .agent-page, .play, .cols, .cols.wide-left { grid-template-columns: 1fr; }
  .chat { position: static; max-height: none; min-height: 480px; }
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .faq { grid-template-columns: 1fr; }
  .hero-file { grid-template-columns: 1fr; padding-top: 36px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .consent { flex-direction: column; align-items: stretch; gap: 12px; left: 10px; right: 10px; padding: 14px; }
  .consent-buttons .btn { flex: 1; }
  .top-in { padding: 0 16px; gap: 12px; grid-template-columns: auto auto; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .nav { grid-column: 1 / -1; grid-row: 2; height: 34px; gap: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .nav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .tabs a { padding: 9px 10px; }
  .brand .sub, .hide-sm { display: none; }
  .top-right { justify-self: end; gap: 8px; }
  .main { padding: 0 16px 64px; }
  .grid, .plans, .steps, .two { grid-template-columns: 1fr; }
  .facts > div { grid-template-columns: 110px 1fr; }
  .studio-head { flex-wrap: wrap; }
  .studio-usage { align-items: flex-start; width: 100%; }
  .panel { padding: 18px; }
  .table { display: block; overflow-x: auto; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .shead { flex-direction: column; align-items: flex-start; gap: 10px; }
  .rolodex, .ic-single { --card-w: calc(100vw - 52px); --card-h: 400px; }
  .card-grid .ic { height: 400px; }
  .ic-single { --card-w: 100%; }
  .ic-face { grid-template-columns: 38% 1fr; }
  .ic-body { padding: 14px 14px 12px; }
  .ic-name { font-size: 22px; margin-top: 6px; }
  .ic-quote { font-size: 14px; margin-top: 10px; padding-left: 10px; }
  .ic-desc { -webkit-line-clamp: 5; font-size: 13px; }
  .ic-foot { flex-wrap: wrap; gap: 6px; }
  .ic-tab { left: calc(3% + var(--tab, 0) * 18%); padding: 0 8px; font-size: 9.5px; letter-spacing: 0.06em; }
  .rdx-on .rdx-rod { left: -10px; right: -10px; }
  .rdx-knob { width: 24px; height: 24px; margin-top: -12px; }
  .rdx-knob::after { top: 3px; height: 6px; }
  .rdx-knob.l { left: -12px; }
  .rdx-knob.r { right: -12px; }
  .mini-stats { gap: 20px; }
}
