/* Form Builder. Tokens and rules: DESIGN.md. Each colour has a hex line first, for a browser with no oklch. */
:root {
	--bg: #f4f5fb;
	--bg: oklch(0.972 0.008 277);
	--panel: #fdfdff;
	--panel: oklch(0.995 0.003 277);
	--chat: #eaecf8;
	--chat: oklch(0.945 0.016 277);
	--line: #dadcec;
	--line: oklch(0.895 0.014 277);
	--ink: #20223a;
	--ink: oklch(0.25 0.03 277);
	--ink-2: #5d6080;
	--ink-2: oklch(0.48 0.03 277);
	--accent: #4a4dc0;
	--accent: oklch(0.48 0.17 277);
	--accent-deep: #3a3d9c;
	--accent-deep: oklch(0.40 0.15 277);
	--accent-ink: #f9f9ff;
	--accent-ink: oklch(0.985 0.006 277);
	--bad: #a8301f;
	--bad: oklch(0.50 0.17 25);
	--ease: cubic-bezier(0.25, 1, 0.5, 1);
	--fast: 180ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	display: flex;
	flex-direction: column;
}
[hidden] { display: none !important; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; font-weight: 600; }
h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0 0 12px; }
.small { font-size: 12px; color: var(--ink-2); margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- the splash ----------
 * On launch the icon fades in and out over the page (app.js, splash), as in Form Designer. */
.splash {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-bottom: 12vh;
	background: #15172d;
	background: oklch(0.21 0.045 277);
	color: var(--accent-ink);
	opacity: 0;
	pointer-events: none;
}
.splash.run { pointer-events: auto; animation: splash 4s ease-in-out forwards; }
.splash.gone { display: none; }
@keyframes splash { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
.splash img { width: 240px; height: 240px; object-fit: contain; margin-bottom: 24px; }
.splash-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.splash-copy { font-size: 15px; opacity: 0.85; margin-bottom: 4px; }
.splash-version { font-size: 12px; opacity: 0.7; }

/* ---------- top bar ---------- */
.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 20px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 26px; height: 26px; flex: none; }
.mark-tile { fill: var(--accent); }
.mark-dots rect { fill: var(--accent-ink); }
.brand-name { font-weight: 600; }
.brand-by { font-size: 12px; color: var(--ink-2); }
.who { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.who #business { font-weight: 600; }

.btn {
	display: inline-block;
	border: 0;
	border-radius: 8px;
	padding: 10px 18px;
	background: var(--accent);
	color: var(--accent-ink);
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--fast) var(--ease);
}
.btn:hover { background: var(--accent-deep); }
.btn:disabled { background: var(--line); color: var(--ink-2); cursor: default; }
.btn.small { padding: 6px 14px; font-size: 13px; }
/* The second choice beside a main button: the same size, an outline only. */
.btn.quiet { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.quiet:hover { background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
/* A control that is a picture only. It has a label for a screen reader and a title for the pointer. */
.icon-btn {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--panel);
	color: var(--ink-2);
	cursor: pointer;
	transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.download, .icon-btn.open { border-color: transparent; background: none; color: var(--accent); }
.icon-btn.download:hover, .icon-btn.open:hover { border-color: color-mix(in oklch, var(--accent) 35%, transparent); background: color-mix(in oklch, var(--accent) 8%, var(--panel)); }
.icon-btn.remove { border-color: transparent; background: none; color: var(--bad); }
.icon-btn.remove:hover { border-color: color-mix(in oklch, var(--bad) 35%, transparent); background: color-mix(in oklch, var(--bad) 8%, var(--panel)); color: var(--bad); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; text-decoration: underline; cursor: pointer; }
.link:disabled { color: var(--ink-2); cursor: default; }

.welcome { max-width: 600px; margin: 10vh auto; padding: 0 20px; }
.welcome .btn { margin: 8px 0 16px; }

/* ---------- the three stages ---------- */
/* The four stages are one strip, and three of them show: 1 to 3, or 2 to 4 with the preview open.
   Stage 1 and stage 4 have the same width, so the strip moves by that width and no stage changes
   its size: the chat and the form only move to the left. */
.stages {
	--side: 340px;
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: var(--side) minmax(340px, 1fr) minmax(380px, 1.2fr) var(--side);
	width: calc(100% + var(--side));
	transition: transform 300ms var(--ease);
}
.stages.previewing { transform: translateX(calc(-1 * var(--side))); }
.stage {
	min-height: 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--line);
}
.stage:last-child { border-right: 0; }
.s2 { background: var(--chat); }
.s3 { background: var(--panel); }

.stage-h {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 20px 12px;
	font-size: 15px;
}
.num {
	display: inline-grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--ink-2);
	color: var(--ink-2);
	font-size: 13px;
	transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.stage[data-state="active"] .num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* A finished stage, and one not reached, step back. A finished one comes back under the pointer or the keyboard. */
.stage > * { transition: opacity var(--fast) var(--ease); }
.stage[data-state="done"] > * { opacity: 0.55; }
.stage[data-state="todo"] > * { opacity: 0.4; }
.stage[data-state="done"]:hover > *, .stage[data-state="done"]:focus-within > * { opacity: 1; }
/* The way back into step 1's window stays clear: the heading's words step back by colour, not the link. */
.s1[data-state="done"] > .stage-h, .s2[data-state="done"] > .stage-h { opacity: 1; color: var(--ink-2); }
.s1[data-state="done"]:hover > .stage-h, .s1[data-state="done"]:focus-within > .stage-h { color: inherit; }
.stage[data-state="todo"] { pointer-events: none; }
/* Stage 3 beside the open preview: in full view, but the step that is active is stage 4. */

/* ---------- stage 1 in a window ----------
 * Step 1 opens over the page, so the other stages do not take the eye. The same controls: they
 * move into the window and back (app.js). The look has the left half, the name and type the right. */
.step1 {
	width: min(860px, calc(100vw - 32px));
	height: min(660px, calc(100dvh - 32px));
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--bg);
	color: var(--ink);
	overflow: hidden;
}
.step1[open] { display: flex; flex-direction: column; animation: step1-in var(--fast) var(--ease); }
.step1::backdrop { background: color-mix(in oklch, var(--ink) 45%, transparent); }
@keyframes step1-in { from { opacity: 0; transform: translateY(8px); } }
.step1-head { display: flex; align-items: center; justify-content: space-between; padding-right: 14px; }
.step1 .num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step1-lead { margin: -4px 0 0; padding: 0 20px 14px; font-size: 13px; color: var(--ink-2); }
.step1-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); border-top: 1px solid var(--line); }
.step1-body .carousel { min-height: 0; padding-top: 16px; border-bottom: 0; border-right: 1px solid var(--line); }
.step1-body .brief { max-height: none; }
.step1-foot { display: flex; justify-content: flex-end; padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.step1-foot[hidden] { display: none; }
/* Step 2's windows: one question each. */
.step2 { width: min(600px, calc(100vw - 32px)); height: fit-content; max-height: calc(100dvh - 32px); overflow-y: auto; }
.step2-count { margin-left: auto; margin-right: 12px; }
.step2-pane { display: flex; flex-direction: column; gap: 12px; padding: 4px 20px 18px; }
.step2-pane[hidden] { display: none; }
.step2-pane h3 { margin: 0; font-size: 18px; font-weight: 600; }
.step2-pane textarea { resize: vertical; min-height: 120px; }
#step2Reply { min-height: 84px; }
/* What the AI asked, as its bubble in the chat has it. */
.step2-said { max-height: 42vh; overflow-y: auto; padding: 12px 14px; border-radius: 14px; border-bottom-left-radius: 4px; background: var(--panel); overflow-wrap: anywhere; }
.step2-said p { margin: 0 0 10px; }
.step2-said ul { margin: 0 0 10px; padding-left: 18px; }
.step2-said > :last-child { margin-bottom: 0; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; border: 1px dashed var(--ink-2); border-radius: 8px; background: var(--panel); color: var(--accent); cursor: pointer; text-align: center; transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in oklch, var(--accent) 6%, var(--panel)); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.drop strong { font-weight: 600; }
/* The buttons are on the right; a link (Back) is on the left. */
.step2-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.step2-foot .link, .step2-foot .back { margin-right: auto; }
.btn.back { display: inline-flex; align-items: center; gap: 8px; }
.btn.back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stage-open { margin-left: auto; font-size: 13px; font-weight: 400; }
/* Too many forms that are not paid for: the forms, each with "Remove". */
.full-forms { margin: 0; padding: 0; list-style: none; max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--line); }
.full-forms li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.full-forms li > span { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.full-forms .small { display: block; font-weight: 400; }
.full-forms .btn { flex: none; }
.btn.quiet.sure, .btn.quiet.sure:hover { background: var(--bad); color: var(--accent-ink); box-shadow: none; }

/* Before a payment: what the purchase is subject to. */
.agree { width: min(520px, calc(100vw - 32px)); }
.agree .stage-h { font-size: 18px; }
.agree-terms { margin: 0; padding-left: 18px; }
.agree-terms li + li { margin-top: 6px; }
.agree .step2-pane p { margin: 0; }

/* An enquiry for a form that is larger than we sell online: who to answer. */
.enquiry .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.enquiry .optional { font-weight: 400; color: var(--ink-2); }
.enquiry input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: var(--panel); font: inherit; color: inherit; }
.enquiry textarea { min-height: 72px; }
@media (max-width: 480px) { .enquiry .pair { grid-template-columns: 1fr; } }

/* ---------- the rules page (/rules: config/rules.md, drawn by server/rules.ts) ---------- */
.rules-page { display: block; height: auto; min-height: 100%; }
.rules-page .brand { color: inherit; text-decoration: none; }
.rules { max-width: 72ch; margin: 0 auto; padding: 28px 20px 72px; font-size: 16px; line-height: 1.6; }
.rules h1 { margin-bottom: 4px; }
.rules h1 + p { font-size: 13px; color: var(--ink-2); }
.rules h2 { margin: 36px 0 10px; font-size: 19px; scroll-margin-top: 16px; }
.rules ul { margin: 0 0 12px; padding-left: 20px; }
.rules li { margin-bottom: 6px; }
.rules-table { margin: 0 0 16px; overflow-x: auto; }
.rules table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rules th, .rules td { padding: 8px 16px 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rules th { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.rules th:last-child, .rules td:last-child { padding-right: 0; text-align: right; white-space: nowrap; }

/* ---------- stage 4: the preview ----------
 * While it is open the strip of stages is one stage to the left: stage 1 is out of view, and the
 * chat, the form and the preview show. The pages in stage 3 show the answers set here. */
/* The strip is wider than the window by one stage: what is out of view is cut off, with no way to scroll to it. */
html, body { overflow-x: clip; }
.s4 { background: var(--bg); }
/* While the AI answers, the preview waits: its form is about to change. */
.s4.wait > :not(.stage-h) { opacity: 0.5; pointer-events: none; }
.stage-next { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color var(--fast) var(--ease); }
.stage-next:hover { border-color: var(--accent); }
.stage-next .num, .stage[data-state="active"] .stage-next .num { width: 22px; height: 22px; font-size: 12px; background: none; border-color: var(--accent); color: var(--accent); }
.stage-next svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button { margin-bottom: -1px; padding: 8px 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.try-lead { padding: 12px 20px 0; }
.try-status { padding: 2px 20px 0; min-height: 20px; }
.try-error { margin: 0 20px; }
.try { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 8px 20px 24px; }
.try-q { display: flex; flex-direction: column; gap: 6px; }
.try-q.off > :not(.try-off) { opacity: 0.45; }
.try-label { font-size: 13px; font-weight: 600; }
.try-label .req { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--ink-2); }
.try-q .small { margin: 0; }
.try input[type="text"], .try input[type="date"], .try textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--panel); color: inherit; font: inherit; }
.try textarea { resize: vertical; display: block; }
.try input:disabled, .try textarea:disabled { background: transparent; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt:disabled { cursor: default; }
/* A run: the questions that are answered, each one line; then the one that is asked now. */
.try-done { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: border-color var(--fast) var(--ease); }
.try-done:hover { border-color: var(--accent); }
.try-done span { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.try-done strong { flex: none; max-width: 55%; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.try.try-run { gap: 8px; }
.try-now { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 12px; background: var(--panel); }
.try-now .try-label { font-size: 15px; }
.try-now > .link { align-self: flex-start; }
.try-now .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-main img.drawing { opacity: 0.5; }

/* ---------- stage 1: the look, then the name and type ---------- */
/* The look has the top half of the stage; the name and the type have the bottom half. */
.carousel { flex: 1 1 0; min-height: 200px; display: flex; flex-direction: column; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }
.car-frame { position: relative; flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); place-items: center; padding: 0 40px; }
.car-frame img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	min-height: 0;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 4px;
	transition: opacity var(--fast) var(--ease);
}
.carousel.wait img, .car-frame img.drawing { opacity: 0.5; }
.car-btn {
	position: absolute;
	top: 50%;
	translate: 0 -50%;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--panel);
	color: var(--ink);
	cursor: pointer;
	transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.car-btn:hover { border-color: var(--accent); color: var(--accent); }
.car-btn.prev { left: 0; }
.car-btn.next { right: 0; }
.car-btn svg, .attach svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.car-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 8px; }
.car-name { font-weight: 600; font-size: 13px; }
.car-dots { display: flex; gap: 2px; }
.car-dots button { width: 18px; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.car-dots button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background-color var(--fast) var(--ease); }
.car-dots button[aria-current="true"]::before { background: var(--accent); }

.brief { flex: 0 1 auto; max-height: 68%; min-height: 0; overflow-y: auto; padding: 14px 20px 16px; display: flex; flex-direction: column; gap: 12px; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; padding: 0; }
.field > legend { margin-bottom: 6px; }
.brief input[type="text"], .brief select, .composer textarea, .step2-pane textarea {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 9px 12px;
	background: var(--panel);
	font: inherit;
	color: inherit;
}
.brief input[type="text"]:disabled { background: transparent; color: var(--ink-2); }
::placeholder { color: var(--ink-2); opacity: 0.75; }
/* The type list: the browser's own menu, drawn as the name's field is, with an arrow of our own. */
.brief select {
	appearance: none;
	padding-right: 34px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235d6080' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	cursor: pointer;
}
.brief select:invalid { color: var(--ink-2); }
.brief select:disabled { background-color: transparent; background-image: none; color: var(--ink-2); cursor: default; opacity: 1; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-box { flex: none; width: 104px; height: 40px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 8px; background: var(--panel); font-size: 12px; color: var(--ink-2); overflow: hidden; }
.logo-box.has { border-style: solid; }
.logo-box img { display: block; box-sizing: border-box; max-width: 104px; max-height: 40px; padding: 4px; object-fit: contain; }
.logo-box img[hidden] { display: none; }
#logoField.wait, #colourField.wait { opacity: 0.6; pointer-events: none; }
/* The customer's colour: the main one opens the browser's colour picker; its light shade is shown beside it. */
.colour-row { display: flex; align-items: center; gap: 8px; }
.swatch { flex: none; display: block; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
label.swatch { cursor: pointer; }
label.swatch:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch input { display: block; width: 100%; height: 100%; padding: 3px; border: 0; background: none; cursor: pointer; }
.swatch input::-webkit-color-swatch-wrapper { padding: 0; }
.swatch input::-webkit-color-swatch { border: 0; border-radius: 5px; }
.swatch input::-moz-color-swatch { border: 0; border-radius: 5px; }
.swatch.pale { box-shadow: inset 0 0 0 3px var(--panel); }
.colour-row .small { margin-left: 4px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.check input:disabled, .check input:disabled + span { cursor: default; }
/* Continue stays in view when the list is longer than its half of the stage. */
/* Continue stays in view; what is longer than the stage scrolls under its bar. */
.brief-foot { position: sticky; bottom: -16px; margin: 0 -20px -16px; padding: 10px 20px 16px; background: var(--bg); border-top: 1px solid var(--line); }
.brief-foot:has(.btn[hidden]) { display: none; }
.brief-foot:has(.btn[hidden]) + .small { margin-top: -4px; }
.note.bad, .msg.bad { color: var(--bad); border: 1px solid color-mix(in oklch, var(--bad) 35%, transparent); background: color-mix(in oklch, var(--bad) 8%, var(--panel)); }
.note { margin: 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* ---------- stage 2: the chat ---------- */
.log { flex: 1; overflow-y: auto; padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(82%, 46ch); padding: 9px 13px; border-radius: 14px; overflow-wrap: anywhere; }
.msg.builder { align-self: flex-start; background: var(--panel); border-bottom-left-radius: 4px; }
.msg.you { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.bad { align-self: flex-start; font-size: 13px; }
.msg p:last-child, .msg ul:last-child { margin-bottom: 0; }
.msg ul { margin: 0 0 12px; padding-left: 18px; }
.msg.typing { display: flex; gap: 5px; align-items: center; padding: 14px 14px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); animation: dot 1.2s var(--ease) infinite; }
.msg.typing i:nth-child(2) { animation-delay: 0.15s; }
.msg.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.composer { padding: 12px 20px 16px; }
.composer textarea { resize: none; display: block; }
.composer .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.attach { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent); cursor: pointer; border-radius: 4px; }
.attach:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips:empty { display: none; }
.chip { font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; }
.chip button { border: 0; background: none; font: inherit; color: var(--ink-2); cursor: pointer; padding: 0 6px; }

/* ---------- stage 3: the form, and the price at its foot ---------- */
.result { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 0 0 20px; }
.empty { color: var(--ink-2); text-align: center; margin-top: 18vh; padding-right: 20px; }
.build { padding-right: 20px; }
.formhead { margin-bottom: 12px; padding-right: 20px; }
.formhead h3 { font-size: 18px; }
/* One page at a time, and a narrow strip of the pages on the right to go from one to another. */
.pageview { flex: 1; min-height: 0; display: flex; transition: opacity var(--fast) var(--ease); }
.page-main { flex: 1; min-width: 0; overflow-y: auto; padding: 0 20px 20px 0; }
.page-main img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); }
/* The picture and, over it, where the last answer changed the page (app.js, flashBoxes). The wrap is exactly as large as the picture. */
.page-wrap { position: relative; display: block; }
.page-flash { position: absolute; border-radius: 2px; background: rgba(255, 196, 0, 0.45); pointer-events: none; animation: page-flash 2s ease-out forwards; }
@keyframes page-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes page-flash-still { from { opacity: 1; } to { opacity: 0; } }
.rail { flex: none; width: 84px; overflow-y: auto; padding: 0 12px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.rail button { display: block; width: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; text-align: center; }
.rail img { display: block; width: 100%; height: auto; margin-bottom: 3px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); transition: border-color var(--fast) var(--ease); }
.rail button:hover img { border-color: var(--accent); }
.rail button { position: relative; }
/* A page that an answer changed, and that is not the page in view: a dot for 2 seconds. */
.rail button.changed::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: rgb(255, 196, 0); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; animation: page-flash 2s ease-out forwards; }
.rail button[aria-current="true"] { color: var(--ink); font-weight: 600; }
.rail button[aria-current="true"] img { border-color: var(--accent); outline: 1px solid var(--accent); }
.result.working .pageview, .result.working .formhead { opacity: 0.35; }

/* The build animation: the app icon's tile, its squares flying in from the top right to make the grid. */
.build { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 14vh 0 24px; color: var(--ink-2); }
.result.has-form .build { flex-direction: row; justify-content: center; padding: 6px 0 18px; }
.tile {
	--size: 132px;
	width: var(--size);
	height: var(--size);
	padding: calc(var(--size) * 0.17);
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: calc(var(--size) * 0.035);
	border-radius: 23%;
	background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
.result.has-form .tile { --size: 44px; }
.tile i { border-radius: 24%; background: var(--accent-ink); opacity: 0; animation: square 2.6s var(--ease) infinite; }
/* The wave runs from the bottom left corner to the top right one, as the icon's squares thin out. */
.tile i:nth-child(13) { animation-delay: 0s; }
.tile i:nth-child(9), .tile i:nth-child(14) { animation-delay: 0.1s; }
.tile i:nth-child(5), .tile i:nth-child(10), .tile i:nth-child(15) { animation-delay: 0.2s; }
.tile i:nth-child(1), .tile i:nth-child(6), .tile i:nth-child(11), .tile i:nth-child(16) { animation-delay: 0.3s; }
.tile i:nth-child(2), .tile i:nth-child(7), .tile i:nth-child(12) { animation-delay: 0.42s; }
.tile i:nth-child(3), .tile i:nth-child(8) { animation-delay: 0.56s; }
.tile i:nth-child(4) { animation-delay: 0.72s; }
@keyframes square {
	0% { opacity: 0; transform: translate(60%, -60%) scale(0.4); }
	28%, 72% { opacity: 1; transform: none; }
	100% { opacity: 0; transform: scale(0.85); }
}
.build p { margin: 0; font-size: 13px; }

.price { border-top: 1px solid var(--line); padding: 10px 20px 14px; background: var(--panel); }
.lines { margin-bottom: 8px; }
.lines summary { cursor: pointer; font-size: 13px; color: var(--accent); width: fit-content; border-radius: 4px; }
.quote { width: 100%; border-collapse: collapse; margin: 8px 0 6px; font-size: 13px; }
.quote td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.quote td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; font-variant-numeric: tabular-nums; }
.quote .detail { display: block; font-size: 12px; color: var(--ink-2); }
.price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.total-label { width: 100%; font-size: 12px; color: var(--ink-2); }
.total-amount { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.total-gst { font-size: 12px; color: var(--ink-2); }
.pay { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
/* What a paid form still has of its changes. Plain while there are some; in a box when it matters (the last one, or a price). */
.changes-note { margin: 0 0 10px; font-size: 12px; color: var(--ink-2); }
.changes-note.loud { padding: 8px 12px; border-radius: 8px; font-size: 13px; color: var(--ink); border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent); background: color-mix(in oklch, var(--accent) 7%, var(--panel)); }
.changes-note a, .msg a, .welcome .small a { color: var(--accent); font-weight: 600; }
.msg .btn { margin-top: 8px; }
.paid { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.paid p { margin: 0; }

/* The forms that are paid for: in the top bar, so they are in reach at every step. */
.myforms { position: relative; }
.myforms summary { cursor: pointer; list-style: none; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font-weight: 600; transition: border-color var(--fast) var(--ease); }
.myforms summary::-webkit-details-marker { display: none; }
.myforms summary:hover, .myforms[open] summary { border-color: var(--accent); }
.myforms .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: min(360px, 86vw); padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px color-mix(in oklch, var(--ink) 14%, transparent); }
.promo { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; transition: border-color var(--fast) var(--ease); }
.myforms a.promo { font-weight: 400; }
.promo:hover { border-color: var(--accent); }
.promo img { flex: none; width: 40px; height: 40px; }
.promo strong { display: block; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.myforms ul { margin: 0 0 10px; padding: 0; list-style: none; max-height: 50vh; overflow-y: auto; }
.myforms li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.myforms li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.myforms li .small { display: block; }
.myforms .acts { flex: none; display: flex; align-items: center; gap: 10px; }
.myforms li { align-items: center; }
.myforms a, .myforms .link { font-weight: 600; font-size: 13px; }
.myforms li.now > span:first-child { font-weight: 600; }
.myforms li.now .small { font-weight: 400; }

@media (max-width: 980px) {
	body { display: block; }
	.stages, .stages.previewing { display: block; width: auto; transform: none; transition: none; }
	/* One under the other: the preview shows only when it is open, and then in the place of stage 1. */
	.stages:not(.previewing) .s4, .stages.previewing .s1 { display: none; }
	.stage { border-right: 0; border-bottom: 1px solid var(--line); }
	.carousel, .brief { flex: none; overflow: visible; max-height: none; min-height: 0; }
	.brief-foot { position: static; margin: 0; padding: 0; border: 0; }
	.step1 { height: fit-content; max-height: calc(100dvh - 24px); overflow-y: auto; }
	.step1-body { display: block; }
	.step1-body .carousel { border-right: 0; border-bottom: 1px solid var(--line); }
	.car-frame img { height: auto; width: 100%; max-width: 220px; }
	.log { max-height: 60vh; min-height: 30vh; }
	.result { padding: 0 20px; }
	.pageview { flex-direction: column-reverse; }
	.page-main { overflow: visible; padding: 0 0 20px; }
	.rail { width: auto; flex-direction: row; border-left: 0; padding: 0 0 12px; overflow-x: auto; }
	.rail button { width: 56px; flex: none; }
	.formhead { padding-right: 0; }
	.empty { margin: 32px 0; }
	.build { padding: 32px 0 24px; }
	.who #business, .brand-by { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; }
	.tile i { animation: none; opacity: 1; }
	.splash.run { animation: none; opacity: 1; }
	.step1[open] { animation: none; }
	.msg.typing i { animation: none; opacity: 0.6; }
	/* The place of a change still shows for 2 seconds, but it does not fade. */
	.page-flash, .rail button.changed::after { animation: page-flash-still 2s steps(1, end) forwards; }
}
