/* Tasteloom: warm paper look with one terracotta accent. System fonts only, so the page makes no third-party requests.
   Text pairs are checked for contrast by test/contrast.test.ts, which reads the :root tokens below (keep them plain hex). */
:root {
  color-scheme: light;
  --bg: #faf6f0;
  --surface: #fffdfa;
  --sand: #f3ebdf;
  --ink: #2a211c;
  --ink-2: #5a4d44;
  --line: #e6dac9;
  --edge: #8a7a68;
  --accent: #b03f17;
  --accent-hover: #923210;
  --accent-strong: #8f3210;
  --accent-soft: #f8e4d7;
  --ok: #1e6b40;
  --ok-soft: #e2f1e7;
  --warn: #7a4f06;
  --warn-soft: #fbeece;
  --bad: #a3231f;
  --bad-soft: #fbe3df;
  --r-lg: 18px;
  --r: 14px;
  --r-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(74 48 24 / 0.06);
  --shadow: 0 1px 2px rgb(74 48 24 / 0.06), 0 10px 28px rgb(74 48 24 / 0.08);
  --serif: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
}

/* ---- base ----------------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; scrollbar-color: #cdbfae var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
main { flex: 1; padding: 36px 0 80px; }
main:focus, h1:focus { outline: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font: 700 clamp(2rem, 1.35rem + 2.2vw, 2.875rem)/1.1 var(--serif); }
h2 { font: 700 1.375rem/1.25 var(--serif); }
h3 { font: 600 1rem/1.3 var(--sans); letter-spacing: 0; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
code { font-family: var(--mono); font-size: 0.92em; }
ul, ol { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; color: #fff; }
.spinner { display: inline-block; flex: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---- header: brand, step indicator, badges ---------------------------------------------------------------------------- */
.top { background: #fdfaf5; border-bottom: 1px solid var(--line); }
.top-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; color: var(--ink); text-decoration: none; font: 700 1.5rem/1 var(--serif); border-radius: var(--r-sm); }
.brand:hover { color: var(--accent-strong); }
.brand img { display: block; }
.badges { display: flex; justify-content: flex-end; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border: 1px solid transparent; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.pill.sandbox { background: var(--warn-soft); color: var(--warn); border-color: #e6cd96; }
.pill.sandbox::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #c98a0a; }
.pill.demo { order: -1; background: var(--sand); color: var(--ink); border-color: var(--line); }
.pill .short { display: none; }

.steps { display: flex; align-items: center; justify-content: center; list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; color: var(--ink-2); font-size: 0.875rem; }
.step + .step::before { content: ''; width: 36px; height: 2px; margin: 0 10px; border-radius: 2px; background: var(--line); }
.step.done + .step::before, .step.current + .step::before { background: var(--accent); }
.step a, .step .step-text { display: inline-flex; align-items: center; gap: 8px; padding: 2px; color: inherit; text-decoration: none; border-radius: 999px; }
.step a:hover .label { text-decoration: underline; }
.dot { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--edge); border-radius: 50%; background: var(--surface); font-size: 0.8125rem; font-weight: 700; }
.step.current .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.done .dot { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.step.current .label { color: var(--ink); font-weight: 700; }

/* ---- controls ------------------------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  font: 600 1rem/1 var(--sans); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--surface); border: 1.5px solid var(--edge); border-radius: 999px;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { background: var(--sand); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 0 rgb(0 0 0 / 0.08), 0 6px 14px rgb(176 63 23 / 0.22); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.big { min-height: 54px; padding: 0 28px; font-size: 1.0625rem; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; transform: none; }
.btn[aria-busy='true']:disabled { opacity: 1; cursor: progress; box-shadow: none; }
.btn.primary:disabled:not([aria-busy='true']) { opacity: 1; color: var(--ink-2); background: var(--sand); border-color: var(--line); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; color: var(--ink-2); background: transparent; border: 1.5px solid transparent; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { background: var(--sand); color: var(--ink); border-color: var(--line); }

input, select { width: 100%; min-height: 48px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--edge); border-radius: var(--r-sm); }
input::placeholder { color: var(--ink-2); opacity: 0.85; }
input:focus-visible, select:focus-visible { border-color: var(--accent); }
input[aria-invalid='true'] { border-color: var(--bad); }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
.label { display: block; margin-bottom: 4px; font-weight: 700; }
.hint { margin: 0 0 12px; color: var(--ink-2); font-size: 0.9375rem; }
.hint.tight { margin: 14px 0 0; font-size: 0.875rem; }
.error { min-height: 1.4em; margin: 4px 0 0; color: var(--bad); font-size: 0.9375rem; font-weight: 600; }

.switch { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0; font: 500 0.9375rem var(--sans); color: var(--ink); background: none; border: 0; cursor: pointer; border-radius: 999px; }
.switch-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--edge); transition: background-color 0.15s; flex: none; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); transition: transform 0.15s; }
.switch[aria-checked='true'] .switch-track { background: var(--accent); }
.switch[aria-checked='true'] .switch-knob { transform: translateX(16px); }

/* ---- panels and notes ----------------------------------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.panel.bad, .panel.warn { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; box-shadow: var(--shadow-sm); }
.panel.bad { border-color: #e8b9b3; background: #fffaf9; }
.panel.warn { border-color: #e6cd96; background: #fffcf3; }
.panel-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--bad-soft); color: var(--bad); }
.panel.warn .panel-icon { background: var(--warn-soft); color: var(--warn); }
.panel-body { flex: 1; min-width: 0; }
.panel-body h2 { margin-bottom: 6px; font-size: 1.25rem; }
.panel-body p { margin: 0; color: var(--ink-2); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.panel-actions .btn, .receipt-actions .btn { max-width: 100%; white-space: normal; line-height: 1.25; text-align: center; padding-block: 10px; }
.note { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 16px; font-size: 0.9375rem; color: var(--ink); background: var(--sand); border: 1px solid var(--line); border-radius: var(--r-sm); }
.note svg { flex: none; margin-top: 2px; color: var(--accent); }
.note.warn { background: var(--warn-soft); border-color: #e6cd96; }
.note.warn svg { color: var(--warn); }
.note.bad { background: var(--bad-soft); border-color: #e8b9b3; }
.note.bad svg { color: var(--bad); }
.notices:empty { display: none; }
.notices { margin-bottom: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.notices .note { margin: 0; }

/* ---- shared screen header --------------------------------------------------------------------------------------------- */
.screen-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.screen-head > :first-child { flex: 1 1 0; min-width: min(100%, 420px); }
.screen-head .lead { margin: 10px 0 0; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.checkout:has(.notices a[href='#/ideas']) .head-actions { display: none; } /* the banner already offers the way back: one "Back to ideas", not two */
@supports not selector(:has(*)) { /* no :has(): the header button stays and the banner's twin goes, so there is still exactly one "Back to ideas" */
  .checkout .notices a[href='#/ideas'] { display: none; }
}
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.lead { max-width: 58ch; margin: 14px 0 0; color: var(--ink-2); font-size: 1.1875rem; line-height: 1.5; }

/* ---- screen 1: their taste ---------------------------------------------------------------------------------------------- */
.taste { display: grid; gap: 36px; }
.taste .lead { margin-bottom: 30px; }
.panel.form { max-width: 760px; }
.field { margin-bottom: 24px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 230px) auto; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 42px; margin: 12px 0 0; padding: 0; list-style: none; }
.chips:empty { padding: 0 14px; border: 1.5px dashed var(--line); border-radius: var(--r-sm); }
.chips:empty::before { content: 'Their favourites will show up here'; color: var(--ink-2); font-size: 0.9375rem; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 6px 4px 16px; background: var(--sand); border: 1px solid var(--line); border-radius: 999px; font-weight: 600; }
.chip-type { padding: 2px 9px; background: var(--surface); border-radius: 999px; color: var(--ink-2); font-size: 0.75rem; font-weight: 600; }
.chip-x { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; color: var(--ink-2); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.chip-x:hover { background: var(--surface); color: var(--bad); }
.count { margin: 8px 0 0; min-height: 1.4em; color: var(--ink-2); font-size: 0.9375rem; }
.count[data-ok='true'] { color: var(--ok); font-weight: 600; }
.budget-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 10px; }
.money-input { position: relative; width: 150px; }
.money-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 700; }
.money-input input { padding-left: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { min-height: 44px; padding: 0 18px; font: 600 1rem var(--sans); color: var(--ink); background: var(--surface); border: 1.5px solid var(--edge); border-radius: 999px; cursor: pointer; font-variant-numeric: tabular-nums; }
.chip-btn:hover { background: var(--sand); }
.chip-btn[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.how { padding: 26px; background: var(--sand); border: 1px solid var(--line); border-radius: var(--r-lg); align-self: start; }
.how ol { display: grid; gap: 20px; margin: 18px 0 0; padding: 0; list-style: none; counter-reset: s; }
.how li { display: grid; grid-template-columns: 34px minmax(0, 1fr); column-gap: 14px; counter-increment: s; }
.how li::before { content: counter(s); grid-row: 1 / span 2; display: grid; place-items: center; width: 34px; height: 34px; border: 1.5px solid var(--accent); border-radius: 50%; background: var(--surface); color: var(--accent-strong); font-weight: 700; }
.how li span { color: var(--ink-2); font-size: 0.9375rem; }
.how .sent { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.9375rem; }
.how .sent + .sent { margin-top: 12px; padding-top: 0; border-top: 0; }
.how .demo-note { margin-top: 20px; }

/* ---- screen 2: gift ideas ----------------------------------------------------------------------------------------------- */
.loves { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 32px; margin: 12px 0 0; color: var(--ink-2); }
.loves .pill-soft, .seeds .pill-soft { background: var(--sand); color: var(--ink); border: 1px solid var(--line); }
.loves .budget { font-weight: 700; color: var(--ink); }
.ideas-layout { display: grid; gap: 20px; }
.col-main { min-width: 0; }

.agent { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.agent-h { margin: 0; font: inherit; letter-spacing: 0; }
.agent-head, .agent-toggle { display: flex; flex-direction: column; gap: 4px; }
.agent-title { font: 700 1.25rem/1.2 var(--serif); }
.agent-status { display: inline-flex; align-items: center; gap: 8px; min-height: 22px; color: var(--ink-2); font: 500 0.875rem var(--sans); }
.agent-status .spinner { color: var(--accent); }
.agent-status svg { color: var(--ok); }
.agent-status[data-state='error'] svg { color: var(--bad); }
.agent-status[data-state='empty'] svg { color: var(--ink-2); }
.agent-body { margin-top: 16px; }
.phases { display: grid; margin: 0; padding: 0; list-style: none; }
.phase { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.phase:last-child { padding-bottom: 0; }
.phase::before { content: ''; position: absolute; left: 11px; top: 28px; bottom: 4px; width: 2px; background: var(--line); }
.phase:last-child::before { display: none; }
.ph-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); }
.ph-icon .spinner { width: 12px; height: 12px; border-width: 2px; }
.phase[data-state='running'] .ph-icon { border-color: var(--accent); color: var(--accent); }
.phase[data-state='done'] .ph-icon { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.phase[data-state='error'] .ph-icon { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.phase[data-state='skipped'] .ph-icon { border-style: dashed; }
.ph-label { margin: 0; font-size: 0.9375rem; font-weight: 600; line-height: 24px; }
.phase[data-state='pending'] .ph-label, .phase[data-state='skipped'] .ph-label { color: var(--ink-2); font-weight: 500; }
.ph-note { margin: 2px 0 0; color: var(--ink-2); font-size: 0.8125rem; }
.seeds { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.seeds:empty { display: none; }
.pill-type { color: var(--ink-2); font-size: 0.75rem; font-weight: 600; text-transform: capitalize; }
.calls { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.call { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'tool meta' 'arg arg' 'out out'; gap: 1px 8px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 0.8125rem; line-height: 1.4; }
.call .tool { grid-area: tool; color: var(--accent-strong); font-size: 0.75rem; font-weight: 700; }
.call .meta { grid-area: meta; color: var(--ink-2); font-size: 0.75rem; white-space: nowrap; }
.call .arg { grid-area: arg; overflow-wrap: anywhere; }
.call .out { grid-area: out; color: var(--ink-2); overflow-wrap: anywhere; }
.call[data-ok='false'] .out { color: var(--bad); }
.via { font-weight: 700; }
.via-live { color: var(--ok); }
.via-mock { color: var(--warn); }
.via-cache { color: var(--ink-2); }
.demo-note { margin: 16px 0 0; padding: 10px 12px; background: var(--warn-soft); border-radius: var(--r-sm); color: var(--ink); font-size: 0.8125rem; line-height: 1.45; }

.ideas-list { display: grid; gap: 44px; }
.idea-head { max-width: 72ch; }
.kind { margin: 0 0 6px; color: var(--accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.idea h2 { font-size: 1.75rem; }
.because { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 10px; }
.because-lbl { color: var(--ink-2); font-size: 0.9375rem; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pill-soft { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; font-size: 0.875rem; font-weight: 600; }
.reason { min-height: 3em; margin: 0; font-size: 1.0625rem; }
.sk-line { display: block; height: 14px; margin: 8px 0; border-radius: 7px; }
.sk-line, .sk-card { background: linear-gradient(90deg, var(--sand) 25%, #fbf4ea 50%, var(--sand) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.w40 { width: 40%; } .w55 { width: 55%; } .w60 { width: 60%; } .w70 { width: 70%; } .w100 { width: 100%; }
.sk-card { height: 330px; border-radius: var(--r); }
.sk-card.tall { height: 260px; }
.assure { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0 0; color: var(--ink-2); font-size: 0.875rem; }
.assure svg { flex: none; margin-top: 2px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 20px 0 0; padding: 0; list-style: none; }
.card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s; }
.card:hover { box-shadow: var(--shadow); }
.card[data-selected='true'] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.media { position: relative; flex: none; overflow: hidden; aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--sand), #f8e9da); }
.media .ph, .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #d9a98c; font: 700 3rem var(--serif); }
.media img, .thumb img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: contain; background: #fff; opacity: 0; transition: opacity 0.2s; }
.media img[data-ok], .thumb img[data-ok] { opacity: 1; }
html[data-images='off'] .media img, html[data-images='off'] .thumb img { display: none; }
.sel-tag { position: absolute; left: 10px; top: 10px; z-index: 2; display: none; align-items: center; gap: 4px; padding: 3px 10px 3px 8px; background: var(--accent); color: #fff; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.card[data-selected='true'] .sel-tag { display: inline-flex; }
.card-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.card-title { display: -webkit-box; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow-wrap: anywhere; }
.card[data-kind='product'] .card-title { flex: 1 0 auto; } /* keeps price rows level across a row of cards */
.card-meta { display: flex; flex-direction: column; gap: 2px; margin: 0; color: var(--ink-2); font-size: 0.875rem; } /* price on its own line, then the shop: a long shop name can never push the price around */
.card-meta .shop { min-width: 0; overflow-wrap: anywhere; }
.price { color: var(--ink); font-size: 1.1875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.price.none { color: var(--ink-2); font-size: 0.875rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ok); font-size: 0.8125rem; font-weight: 600; }
.check[data-state='paused'] { color: var(--ink-2); }
.idea .note.paused { margin: 20px 0 0; max-width: 72ch; }
.snippet { display: -webkit-box; margin: 0; overflow: hidden; color: var(--ink-2); font-size: 0.875rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.snippet.trail { font-size: 0.8125rem; overflow-wrap: anywhere; } /* a link card without a blurb: where the link goes, from its own address */
.card-actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-top: 10px; }
.shop-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 600; }
.hint-inline { color: var(--ink-2); font-size: 0.8125rem; }
.pick { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 16px; font: 700 0.9375rem var(--sans); color: var(--accent-strong); background: var(--surface); border: 1.5px solid var(--accent); border-radius: 999px; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.pick:hover:not(:disabled) { background: var(--accent-soft); }
.card[data-selected='true'] .pick { color: var(--ink); border-color: var(--edge); }
.pick:disabled { color: var(--ink-2); background: var(--sand); border-color: var(--line); cursor: not-allowed; }

.bar { position: sticky; bottom: 14px; z-index: 20; margin-top: 32px; }
.bar-main { display: flex; align-items: center; gap: 24px; padding: 14px 18px 14px 24px; color: #fff; background: var(--ink); border-radius: var(--r-lg); box-shadow: 0 12px 32px rgb(42 33 28 / 0.3); }
.bar-sum { flex: 1; min-width: 0; }
.bar-count { margin: 0 0 8px; font-size: 0.9375rem; }
.bar-count .of { color: #dccfc2; }
.meter { height: 8px; overflow: hidden; background: rgb(255 255 255 / 0.2); border-radius: 999px; }
.fill { display: block; width: calc(var(--p, 0) * 1%); height: 100%; background: #f2a67b; border-radius: inherit; transition: width 0.3s ease; }
.meter[data-level='high'] .fill { background: #f5c15a; }
.bar .btn.primary { border-color: rgb(255 255 255 / 0.4); }
.bar :focus-visible { outline-color: #fff; } /* the accent ring is only 2.7:1 on the dark bar */
.bar .btn.primary:disabled { opacity: 1; background: rgb(255 255 255 / 0.14); border-color: transparent; color: #d8ccc0; }

/* ---- screen 3: checkout and receipt ------------------------------------------------------------------------------------ */
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.panel h2 { margin-bottom: 14px; }
.lines { margin: 0; padding: 0; list-style: none; }
.line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.thumb { position: relative; overflow: hidden; width: 64px; height: 64px; background: linear-gradient(135deg, var(--sand), #f8e9da); border: 1px solid var(--line); border-radius: var(--r-sm); }
.thumb .ph { font-size: 1.5rem; }
.line-title { display: -webkit-box; margin: 0; overflow: hidden; font-weight: 600; line-height: 1.3; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.line-shop { margin: 2px 0 0; color: var(--ink-2); font-size: 0.875rem; }
.line-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.lines.plain .line { grid-template-columns: minmax(0, 1fr) auto; }
.totals { display: grid; gap: 6px; margin: 8px 0 0; padding-top: 14px; border-top: 2px solid var(--ink); }
.totals .row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.totals dd { margin: 0; }
.totals .row.total { color: var(--ink); font-size: 1.375rem; font-weight: 700; }
.totals .row.over { color: var(--bad); font-weight: 700; }
.sandbox-note { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 8px 12px; background: var(--warn-soft); border: 1px solid #e6cd96; border-radius: var(--r-sm); color: var(--warn); font-size: 0.875rem; }
.sandbox-note svg { flex: none; }
.pay-steps { display: grid; gap: 8px; margin: 0; padding-left: 22px; color: var(--ink-2); font-size: 0.9375rem; }
.pay-steps strong, .tip strong { color: var(--ink); }
.testcard { margin: 18px 0; padding: 4px 16px; background: var(--bg); border: 1.5px dashed var(--edge); border-radius: var(--r); }
.tc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.tc-row:first-child { border-top: 0; }
.tc-row dt { grid-column: 1; color: var(--ink-2); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tc-row dd { grid-column: 1; margin: 0; }
.tc-row code { font-size: 1.125rem; font-weight: 700; letter-spacing: 0.02em; }
.tc-row .btn.copy { grid-column: 2; grid-row: 1 / span 2; min-width: 6.25rem; } /* as wide as "Copied" (and above the coarse-pointer .btn.small rule), so the label change moves nothing */
.tip { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; color: var(--ink-2); font-size: 0.9375rem; }
.tip svg { flex: none; margin-top: 3px; color: var(--accent); }
.pay-btn { width: 100%; margin-top: 18px; white-space: normal; line-height: 1.25; padding-block: 8px; }
.pay-btn .spinner { width: 18px; height: 18px; }
.pay-status { min-height: 1.4em; margin: 10px 0 0; color: var(--ink-2); font-size: 0.875rem; text-align: center; }

.receipt-card { max-width: 760px; margin: 0 auto; }
.hero { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.hero h1 { font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.25rem); }
.hero .lead { margin-top: 6px; font-size: 1.0625rem; }
.hero-icon { display: grid; place-items: center; flex: none; width: 60px; height: 60px; border-radius: 50%; background: var(--sand); color: var(--ink-2); }
.hero-icon[data-tone='ok'] { background: var(--ok-soft); color: var(--ok); }
.hero-icon[data-tone='warn'] { background: var(--warn-soft); color: var(--warn); }
.hero-icon[data-tone='bad'] { background: var(--bad-soft); color: var(--bad); }
.hero-icon .spinner { width: 24px; height: 24px; }
.facts { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); }
.fact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; }
.fact dt { color: var(--ink-2); font-size: 0.9375rem; }
.fact dd { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; min-width: 0; font-variant-numeric: tabular-nums; }
.fact code { overflow-wrap: anywhere; font-size: 1rem; font-weight: 700; }
.status-pill { display: inline-block; padding: 3px 12px; border: 1px solid #e6cd96; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; }
.status-pill[data-status='COMPLETED'] { background: var(--ok-soft); border-color: #a9d3b8; color: var(--ok); }
.status-pill[data-status='CAPTURE_FAILED'] { background: var(--bad-soft); border-color: #e8b9b3; color: var(--bad); }
.small-h { margin: 26px 0 4px; color: var(--ink-2); font: 700 0.8125rem var(--sans); letter-spacing: 0.08em; text-transform: uppercase; }
.trace { margin-top: 22px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); }
.trace summary { cursor: pointer; font-weight: 600; }
.trace ul { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 0.875rem; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.receipt-body .note { margin: 0 0 18px; }
.foot { border-top: 1px solid var(--line); padding: 26px 0; color: var(--ink-2); font-size: 0.875rem; }
.foot p { margin: 0; max-width: 70ch; }
.on-receipt .foot-sandbox { display: none; }

/* ---- wide screens -------------------------------------------------------------------------------------------------------- */
@media (min-width: 1000px) {
  .taste { grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; }
  .taste .how { position: sticky; top: 24px; margin-top: 56px; }
  .ideas-layout { grid-template-columns: 330px minmax(0, 1fr); gap: 36px; align-items: start; }
  .agent { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; scrollbar-width: thin; scrollbar-gutter: stable both-edges; } /* the gutter is reserved, so the steps do not re-wrap when the scrollbar appears */
  .checkout-layout { grid-template-columns: minmax(0, 1fr) 430px; align-items: start; }
  .panel.pay { position: sticky; top: 16px; }
}

/* ---- tablets and phones ---------------------------------------------------------------------------------------------------- */
@media (max-width: 999px) {
  .agent-toggle { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; width: 100%; min-height: 44px; padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; border-radius: var(--r-sm); cursor: pointer; }
  .agent-toggle > * { grid-column: 1; }
  .agent-toggle::after { content: ''; grid-column: 2; grid-row: 1 / span 2; width: 9px; height: 9px; margin: 0 4px 3px 0; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform 0.15s; }
  .agent-toggle[aria-expanded='true']::after { transform: rotate(-135deg); margin-bottom: -3px; }
  .agent[data-open='false'] .agent-body { display: none; }
  .agent-toggle .agent-title { font-size: 1.125rem; }
}
@media (max-width: 960px) {
  /* brand, steps and the two badges no longer fit in one row: steps drop under the brand */
  .top-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'brand badges' 'steps steps'; gap: 6px 12px; min-height: 0; padding-top: 12px; padding-bottom: 10px; }
  .brand { grid-area: brand; }
  .badges { grid-area: badges; }
  .steps-nav { grid-area: steps; }
  .steps { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .brand { font-size: 1.375rem; }
  main { padding: 24px 0 64px; }
  .panel { padding: 22px 18px; }
  .panel.bad, .panel.warn { padding: 16px; }
  .screen-head { margin-bottom: 20px; }
  .lead { font-size: 1.0625rem; }
  .add-row { grid-template-columns: minmax(0, 1fr) auto; }
  .add-row input { grid-column: 1 / -1; }
  .idea h2 { font-size: 1.5rem; }
  .line { grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 12px; }
  .thumb { width: 52px; height: 52px; }
}
@media (max-width: 560px) {
  .pill .long { display: none; }
  .pill .short { display: inline; }
  .step:not(.current) .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .step + .step::before { width: 22px; margin: 0 6px; }
  .actions .btn { width: 100%; }
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { flex-direction: row; }
  .media { width: 108px; aspect-ratio: auto; align-self: stretch; }
  .media .ph { font-size: 2rem; }
  .sel-tag { display: none !important; }
  .card[data-selected='true'] { box-shadow: inset 4px 0 0 var(--accent), var(--shadow-sm); }
  .card-body { padding: 12px 14px 14px; min-width: 0; }
  .sk-card { height: 150px; }
  .bar-main { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .bar .btn { width: 100%; }
  .bar { bottom: 8px; }
  .hero { align-items: flex-start; }
  .hero-icon { width: 48px; height: 48px; }
  .receipt-actions .btn { width: 100%; }
  .testcard { padding: 4px 12px; }
  .tc-row { column-gap: 10px; }
  .tc-row code { font-size: clamp(0.75rem, 3.5vw, 1rem); } /* the card number stays on one line down to 360 px */
  .panel-actions .btn { flex: 1 1 100%; }
  /* a checkout line: picture and name on top, the price and the remove button side by side under the name */
  .lines:not(.plain) .line { grid-template-columns: 52px minmax(0, 1fr) auto; grid-template-areas: 'thumb body body' 'thumb price remove'; gap: 4px 12px; }
  .lines:not(.plain) .thumb { grid-area: thumb; align-self: start; }
  .lines:not(.plain) .line-body { grid-area: body; }
  .lines:not(.plain) .line-price { grid-area: price; }
  .lines:not(.plain) .icon-btn { grid-area: remove; justify-self: end; }
}
@media (max-width: 360px) {
  /* the brand and both badges no longer fit side by side: the badges get a row of their own */
  .top-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'brand' 'badges' 'steps'; }
  .badges { justify-content: flex-start; }
  /* the copy button moves up beside the label so a card number gets the full width of the test card */
  .tc-row .btn.copy { grid-row: 1; }
  .tc-row dd { grid-column: 1 / -1; }
  .tc-row code { font-size: 1rem; }
}

@media (pointer: coarse) {
  .btn.small, .icon-btn, .chip-x { min-height: 44px; min-width: 44px; }
  .chip { padding-right: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .sk-line, .sk-card { animation: none; }
  .spinner { animation-duration: 2.4s; } /* slower, but still shows that something is happening */
}
