/* business-assistants.css: the "AI suggests. You decide." approval queue and the
   "Pick your business" selector on services/business-assistants.html.
   Behaviour lives in business-assistants.js. Violet marks what the AI filled in,
   as in the real AIBA app; muted orange is the page's own accent. */

.aq, .bp {
  --ai: #7c3aed;
  --ai-line: #b9a6f7;
  --ai-glow: rgba(167, 139, 250, 0.20);
  --ink: var(--text-primary, #0f172a);
  --sub: var(--text-secondary, #475569);
  --mute: var(--text-muted, #94a3b8);
  --line: rgba(15, 23, 42, 0.08);
  --soft: #f6f7fa;
  --good: #059669;
  --warm: #b8632f;
}

/* ===================== AI approval queue ===================== */
.aq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px;
  margin-top: 40px;
  text-align: left;
}
.aq-queue, .aq-record {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px -22px rgba(15, 23, 42, 0.25);
  min-width: 0;
}
.aq-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font: 600 0.85rem var(--font-display);
  color: var(--ink);
}
.aq-head svg { width: 16px; height: 16px; color: var(--ai); }
.aq-count { margin-left: auto; font: 500 0.75rem var(--font-mono); color: var(--sub); }
.aq-list { list-style: none; margin: 0; padding: 6px; }
.aq-item + .aq-item { border-top: 1px solid rgba(15, 23, 42, 0.05); }
.aq-row {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border: 0; border-radius: 10px;
  background: transparent;
  text-align: left; cursor: pointer;
  font: inherit; color: inherit;
  transition: background-color 0.2s ease;
}
.aq-row:hover { background: var(--soft); }
.aq-row:focus-visible { outline: 2px solid var(--ai); outline-offset: -2px; }
.aq-row > svg { flex: none; width: 18px; height: 18px; color: var(--mute); transition: color 0.2s; }
.aq-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aq-row-text b { font: 600 0.88rem var(--font-display); color: var(--ink); }
.aq-row-text span { font-size: 0.78rem; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aq-state { flex: none; font: 500 0.7rem var(--font-mono); color: var(--mute); letter-spacing: 0.02em; }
.aq-item.is-active .aq-row { background: rgba(124, 58, 237, 0.06); }
.aq-item.is-active .aq-row > svg { color: var(--ai); }
.aq-item.is-accepted .aq-state { color: var(--good); }
.aq-item.is-changed .aq-state { color: var(--warm); }
.aq-item.is-accepted .aq-row > svg { color: var(--good); }
.aq-item.is-changed .aq-row > svg { color: var(--warm); }

/* the record AIBA filled in */
.aq-record {
  display: flex; flex-direction: column;
  padding: 20px 22px;
  min-height: 624px;                       /* the tallest scene (the receipt), so the panel never changes size */
}
.aq-rec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.aq-rec-title { margin: 0; font: 700 1.1rem var(--font-display); color: var(--ink); }
.aq-rec-tag { font-size: 0.72rem; color: var(--ai); white-space: nowrap; }
.aq-record.is-done .aq-rec-tag { color: var(--good); }
.aq-record.is-changed .aq-rec-tag { color: var(--warm); }
.aq-status {
  display: flex; align-items: center; gap: 7px;
  margin: 8px 0 16px;
  min-height: 1.4em;
  font-size: 0.84rem;
  color: var(--sub);
}
.aq-status svg { flex: none; width: 16px; height: 16px; color: var(--ai); }
.aq-record.is-reading .aq-status-text {
  font-weight: 600;
  background: linear-gradient(90deg, var(--ai) 0%, #c4b5fd 45%, var(--ai) 90%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: aqShimmer 1.4s linear infinite;
}
.aq-record.is-done .aq-status svg { color: var(--good); }
.aq-record.is-changed .aq-status svg { color: var(--warm); }
@keyframes aqShimmer { to { background-position: -200% 0; } }

.aq-stage { flex: 1; min-height: 0; }
.aq-fields { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.aq-field { display: flex; flex-direction: column; gap: 4px; }
.aq-field dt { font: 600 0.74rem var(--font-display); color: var(--ink); }
.aq-field dd {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.45;
  transition: border-color 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
}
.aq-field small { font-size: 0.7rem; color: var(--ai); }
/* filled in by AIBA, not yet accepted */
.aq-field.is-ai dd { border-color: var(--ai-line); box-shadow: 0 0 0 3px var(--ai-glow); background: #f4f5f8; }
/* the person editing (any scene) */
.aq-scene [contenteditable="true"] { border-radius: 6px; box-shadow: 0 0 0 2px rgba(184, 99, 47, 0.45); background: #fff; outline: none; cursor: text; }
.aq-field dd[contenteditable="true"] { border-color: var(--warm); box-shadow: 0 0 0 3px rgba(184, 99, 47, 0.12); }

.aq-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.aq-btn {
  padding: 10px 18px;
  border-radius: 10px;
  font: 600 0.86rem var(--font-display);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.12s, opacity 0.2s;
}
.aq-btn:active, .aq-btn.is-pressed { transform: scale(0.96); }
.aq-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.aq-btn--ghost { background: #fff; border: 1px solid rgba(15, 23, 42, 0.15); color: var(--ink); }
.aq-btn--ghost:hover:not(:disabled) { border-color: rgba(15, 23, 42, 0.3); }
.aq-btn--go { background: var(--accent-blue, #0062ff); border: 1px solid var(--accent-blue, #0062ff); color: #fff; }
.aq-btn--go:hover:not(:disabled) { background: #0052d6; }
.aq-btn:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
.aq-record.is-done .aq-actions, .aq-record.is-changed .aq-actions { visibility: hidden; }
.aq-why-out {
  margin: 16px 0 0; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem; line-height: 1.55; color: var(--sub);
}

/* ===================== The eight scenes =====================
   Every [data-s] element fades up when its step arrives (.on). The scene carries
   .at-1 … .at-n for effects that depend on how far it has got. */
.aq-scene { display: flex; flex-direction: column; gap: 12px; font-size: 0.86rem; color: var(--ink); }
.aq-scene [data-s] { opacity: 0; transform: translateY(6px); transition: opacity 0.35s ease, transform 0.35s ease; }
.aq-scene [data-s].on { opacity: 1; transform: none; }
.aq-scene ul, .aq-scene ol { list-style: none; margin: 0; padding: 0; }
.sc-label { margin: 0; font: 500 0.72rem var(--font-mono); letter-spacing: 0.04em; color: var(--sub); }

/* 1. Receipt: the file row from the real claim form, then violet fields fill */
.sc-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-file-label { font: 600 0.74rem var(--font-display); }
.sc-file-btn { padding: 3px 9px; border: 1px solid rgba(15, 23, 42, 0.25); border-radius: 5px; background: #f1f3f6; font-size: 0.76rem; }
.sc-file-name { font-size: 0.8rem; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 2. Contact: a search, a register match, then details tick in with their source */
.sc-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 8px; min-height: 40px; }
.sc-search svg { width: 16px; height: 16px; color: var(--mute); }
.sc-hit { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; background: var(--soft); }
.sc-hit svg { width: 18px; height: 18px; color: var(--sub); flex: none; }
.sc-hit b { display: block; font: 600 0.88rem var(--font-display); }
.sc-hit small { color: var(--sub); font-size: 0.74rem; }
.sc-facts { display: flex; flex-direction: column; }
.sc-facts li { display: grid; grid-template-columns: 18px 110px 1fr; align-items: baseline; column-gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(15, 23, 42, 0.06); }
.sc-facts svg { width: 15px; height: 15px; color: var(--good); align-self: center; }
.sc-facts span { color: var(--sub); font-size: 0.8rem; }
.sc-facts b { font-weight: 600; }
.sc-facts small { grid-column: 3; font-size: 0.7rem; color: var(--mute); }

/* 3. Cost: the cost, a scan down the scope, it lands on 3.2, reason and confidence */
.sc-cost { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 8px; }
.sc-cost svg { width: 17px; height: 17px; color: var(--sub); }
.sc-cost b { margin-left: auto; font-family: var(--font-mono); font-size: 0.84rem; }
.sc-scope { display: flex; flex-direction: column; border-left: 2px solid rgba(15, 23, 42, 0.08); }
.sc-scope li { position: relative; display: flex; justify-content: space-between; padding: 7px 12px; color: var(--sub); transition: color 0.3s, background-color 0.3s; }
.sc-scope li em { font-style: normal; font: 600 0.8rem var(--font-mono); color: var(--good); }
.sc-scope.on:not(.done) li { animation: scScan 1.4s ease both; }
.sc-scope li:nth-child(2) { animation-delay: 0.25s !important; }
.sc-scope li:nth-child(3) { animation-delay: 0.5s !important; }
.sc-scope li:nth-child(4) { animation-delay: 0.75s !important; }
@keyframes scScan { 0%, 100% { background: transparent; } 20%, 35% { background: rgba(15, 23, 42, 0.04); } }
.sc-scope li.sc-pick { opacity: 1; transform: none; }          /* the row is always there; only its marking waits */
.sc-scope li.sc-pick em { opacity: 0; transition: opacity 0.3s; }
.sc-scope li.sc-pick.on { color: var(--ink); font-weight: 600; background: rgba(5, 150, 105, 0.07); box-shadow: inset 2px 0 0 var(--good); }
.sc-scope li.sc-pick.on em { opacity: 1; }
.aq-scene.at-3 .sc-scope { animation: none; }
.sc-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 10px; }
.sc-row > span:first-child { color: var(--sub); font-size: 0.8rem; }
.sc-row b { font-weight: 600; grid-column: 2 / 4; }
.sc-row .sc-meter + b { grid-column: auto; }
.sc-meter { height: 6px; border-radius: 3px; background: rgba(15, 23, 42, 0.08); overflow: hidden; }
.sc-meter i { display: block; height: 100%; width: 0; background: var(--good); border-radius: 3px; transition: width 0.9s ease 0.2s; }
.sc-row.on .sc-meter i { width: 86%; }

/* 4. Bill: unbilled work fills past the 10% mark, a bell, the claim */
.sc-bar { position: relative; display: flex; height: 14px; border-radius: 7px; background: rgba(15, 23, 42, 0.07); margin-top: 18px; }
.sc-billed { width: 40%; background: #94a3b8; border-radius: 7px 0 0 7px; }
.sc-unbilled { width: 0; background: var(--accent-orange, #ff6b00); transition: width 1.6s cubic-bezier(0.3, 0.7, 0.3, 1); }
.aq-scene.at-2 .sc-unbilled { width: 12%; }
.sc-mark { position: absolute; left: 50%; top: -18px; bottom: -4px; width: 2px; background: var(--ink); }
.sc-mark em { position: absolute; top: -2px; left: 6px; font: 600 0.68rem var(--font-mono); font-style: normal; white-space: nowrap; }
.sc-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.76rem; color: var(--sub); }
.sc-legend i, .sc-key i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.k-billed { background: #94a3b8; }
.k-unbilled { background: var(--accent-orange, #ff6b00); }
.sc-grow { margin: 0; color: var(--sub); }
.sc-grow b { color: var(--ink); font-family: var(--font-mono); }
.sc-alert { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; color: var(--warm); }
.sc-alert svg { width: 17px; height: 17px; }
.sc-alert.on svg { animation: scRing 0.9s ease 0.1s 2; transform-origin: 50% 10%; }
@keyframes scRing { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 45% { transform: rotate(-14deg); } 70% { transform: rotate(8deg); } }
.sc-claim { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; padding: 12px 14px; border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 8px; }
.sc-claim span { color: var(--sub); font-size: 0.8rem; }
.sc-claim b { font-family: var(--font-mono); font-size: 0.84rem; }
.sc-claim q { quotes: none; }

/* 5. Numbers: actual against quote, labour overshoots, then AIBA explains */
.sc-bars { display: flex; flex-direction: column; gap: 9px; }
.sc-b { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
.sc-b > span { color: var(--sub); font-size: 0.8rem; }
.sc-track { position: relative; height: 10px; border-radius: 5px; background: rgba(15, 23, 42, 0.06); }
.sc-act { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px; background: var(--accent-blue, #0062ff); transition: width 0.9s ease; }
.sc-b.on .sc-act { width: var(--a); }
.sc-b--over .sc-act { background: #dc2626; }
.sc-quote { position: absolute; top: -4px; bottom: -4px; left: var(--q); width: 2px; background: var(--ink); }
.sc-key { display: flex; gap: 16px; margin: 2px 0 0 120px; font-size: 0.72rem; color: var(--sub); }
.k-act { background: var(--accent-blue, #0062ff); }
.k-quote { background: var(--ink); width: 2px !important; height: 11px !important; }
.sc-says { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.sc-says li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; padding-top: 6px; }
.sc-says svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--ai); }

/* 6. Chat: the question, typing dots, the answer and its source */
.aq-scene--chat { gap: 10px; }
.sc-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; line-height: 1.45; }
.sc-msg--you { align-self: flex-end; background: var(--accent-blue, #0062ff); color: #fff; border-bottom-right-radius: 4px; min-height: 2.6em; }
.sc-msg--aiba { align-self: flex-start; display: flex; gap: 8px; background: var(--soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.sc-msg--aiba svg { flex: none; width: 15px; height: 15px; margin-top: 2px; color: var(--ai); }
.sc-dots { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--soft); }
.sc-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: scDot 1s ease-in-out infinite; }
.sc-dots i:nth-child(2) { animation-delay: 0.15s; }
.sc-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes scDot { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
.aq-scene.at-3 .sc-dots { display: none; }
.sc-src { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.74rem; color: var(--sub); }
.sc-src svg { width: 13px; height: 13px; }

/* 7. Lead: what they did, the marker slides from Cold to Warming, next step */
.sc-events { display: flex; flex-direction: column; }
.sc-events li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(15, 23, 42, 0.06); }
.sc-events svg { width: 15px; height: 15px; color: var(--sub); }
.sc-events small { margin-left: auto; font: 500 0.72rem var(--font-mono); color: var(--mute); }
.sc-temp { padding-top: 6px; }
.sc-temp-track { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #93c5fd, #fdba74 50%, #f87171); }
.sc-temp-dot { position: absolute; top: 50%; left: 4%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); transition: left 0.8s cubic-bezier(0.3, 0.7, 0.3, 1); }
.aq-scene.at-2 .sc-temp-dot { left: 24%; }
.aq-scene.at-3 .sc-temp-dot { left: 42%; }
.aq-scene.at-4 .sc-temp-dot { left: 50%; }
.sc-temp-scale { display: flex; justify-content: space-between; margin-top: 6px; font: 500 0.7rem var(--font-mono); color: var(--sub); }
.sc-temp-say { margin: 0; font-weight: 600; color: var(--warm); }
.sc-next { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 8px; }
.sc-next svg { width: 16px; height: 16px; color: var(--good); }
.sc-next span { color: var(--sub); font-size: 0.8rem; }

/* 8. Message: it writes itself, then the checks tick in */
.sc-to { display: flex; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sc-to span { color: var(--sub); }
.sc-body { min-height: 5.4em; padding: 12px 14px; border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 8px; line-height: 1.55; }
.sc-checks { display: flex; flex-direction: column; gap: 8px; }
.sc-checks li { display: flex; align-items: center; gap: 8px; }
.sc-checks svg { width: 16px; height: 16px; color: var(--good); }

/* ===================== Pick your business ===================== */
.bp {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
  margin-top: 40px;
  text-align: left;
  align-items: stretch;
}
.bp-tabs { display: flex; flex-direction: column; gap: 2px; }
.bp-ask {
  margin: 0 0 10px 14px;
  font: 600 0.72rem var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sub);
}
.bp-tab {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 0; border-radius: 10px;
  background: transparent;
  text-align: left; cursor: pointer;
  font: 600 0.95rem var(--font-display);
  color: var(--sub);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.bp-tab svg { width: 18px; height: 18px; flex: none; color: var(--mute); transition: color 0.2s; }
.bp-tab:hover { color: var(--ink); background: rgba(15, 23, 42, 0.03); }
.bp-tab[aria-selected="true"] { color: var(--warm); background: rgba(255, 107, 0, 0.07); }
.bp-tab[aria-selected="true"] svg { color: var(--warm); }
.bp-tab:focus-visible { outline: 2px solid var(--warm); outline-offset: -2px; }
/* the auto-cycle timer: a thin line that fills under the selected row */
.bp-tab::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: 1px;
  background: rgba(184, 99, 47, 0.35);
  transform: scaleX(0); transform-origin: left;
}
.bp.is-cycling .bp-tab[aria-selected="true"]::after { animation: bpTimer var(--bp-ms, 5000ms) linear forwards; }
@keyframes bpTimer { to { transform: scaleX(1); } }

.bp-stage {
  display: grid;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px -22px rgba(15, 23, 42, 0.25);
  padding: 30px 32px;
  min-height: 300px;
}
/* All six panels share one grid cell, so the box is as tall as the tallest and never
   changes size; the hidden ones keep their space but can't be seen or read out. */
.bp-panel { grid-area: 1 / 1; min-width: 0; }
.bp-panel[hidden] { display: block; visibility: hidden; }
.bp-panel:not([hidden]) { animation: bpIn 0.4s ease both; }
@keyframes bpIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bp-icon {
  display: inline-grid; place-items: center;
  width: 46px; height: 46px; border-radius: 12px;
  background: rgba(255, 107, 0, 0.08);
  color: var(--warm);
}
.bp-icon svg { width: 22px; height: 22px; }
.bp-panel h3 { margin: 16px 0 4px; font: 700 1.35rem var(--font-display); color: var(--ink); }
.bp-who { margin: 0 0 18px; color: var(--sub); font-size: 0.95rem; }
.bp-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bp-points li { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 0.95rem; line-height: 1.45; }
.bp-points svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--good); }
.bp-sub {
  margin: 22px 0 10px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font: 600 0.72rem var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--sub);
}
.bp-shape { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bp-shape li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.9rem; line-height: 1.45; color: var(--sub); }
.bp-shape svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--warm); }
.bp-shape b { display: block; color: var(--ink); font-weight: 600; }
.bp-panel:not([hidden]) .bp-points li,
.bp-panel:not([hidden]) .bp-shape li { animation: bpIn 0.4s ease both; }
.bp-panel .bp-shape li:nth-child(1) { animation-delay: 0.3s; }
.bp-panel .bp-shape li:nth-child(2) { animation-delay: 0.38s; }
.bp-panel .bp-shape li:nth-child(3) { animation-delay: 0.46s; }
.bp-panel .bp-points li:nth-child(2) { animation-delay: 0.08s; }
.bp-panel .bp-points li:nth-child(3) { animation-delay: 0.16s; }
.bp-panel .bp-points li:nth-child(4) { animation-delay: 0.24s; }

/* ===================== Phones and tablets ===================== */
@media (max-width: 900px) {
  .aq { grid-template-columns: 1fr; }
  .aq-record { min-height: 0; }
  .aq-item > .aq-record { margin: 4px 2px 10px; box-shadow: 0 10px 26px -18px rgba(15, 23, 42, 0.3); animation: bpIn 0.3s ease both; }
  .bp { grid-template-columns: 1fr; gap: 16px; }
  .bp-tabs { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .bp-ask { width: 100%; margin-left: 4px; }
  .bp-tab { padding: 9px 12px; font-size: 0.85rem; }
  .bp-tab::after { left: 12px; right: 12px; bottom: 3px; }
  .bp-stage { padding: 24px 22px; min-height: 0; }
}
@media (max-width: 560px) {
  .aq-row-text span { white-space: normal; }
  .aq-record { padding: 18px 16px; }
  .aq-actions { flex-wrap: wrap; }
  .aq-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .aq-scene [data-s], .sc-unbilled, .sc-act, .sc-meter i, .sc-temp-dot { transition: none !important; }
  .sc-scope li, .sc-alert svg, .sc-dots i { animation: none !important; }
  .bp-panel:not([hidden]), .bp-panel:not([hidden]) .bp-points li, .bp-panel:not([hidden]) .bp-shape li { animation: none; }
  .aq-record.is-reading .aq-status-text { animation: none; color: var(--ai); background: none; }
  .bp.is-cycling .bp-tab[aria-selected="true"]::after { animation: none; }
}

/* ===== Dark mode (html[data-theme="dark"]) =====
   Design: docs/plans/dark-mode-design-system.md (d, the DARK APP WINDOW). Replaces the draft that re-asserted the light tokens. */

/* both blocks define their ink and accents on the container; re-point only what is a literal (--ink/--sub/--mute already read the dark text tokens) */
:root[data-theme="dark"] :is(.aq,.bp){
  --ai:var(--violet-text); --ai-line:rgba(176,155,238,.55); --ai-glow:rgba(176,155,238,.10);
  --line:var(--dk-line-3); --soft:rgba(150,175,230,.07); --good:var(--green-text); --warm:var(--orange-text);
}

/* ---- AI approval queue (#cognitive-integrations is a band = s1): two windows, body s2, title bar s3, fields are s1 recesses ---- */
:root[data-theme="dark"] :is(.aq-queue,.aq-record){ background:var(--dk-s2); border-color:var(--dk-edge); box-shadow:inset 0 1px 0 var(--dk-edge-hi); color:var(--text-primary); }
:root[data-theme="dark"] .aq-head{ background:var(--dk-s3); border-bottom-color:var(--dk-line-3); border-radius:15px 15px 0 0; }
:root[data-theme="dark"] :is(.aq-queue,.aq-record) :focus-visible{ outline-color:var(--dk-focus); }
:root[data-theme="dark"] .aq-item + .aq-item{ border-top-color:var(--dk-line-2); }
:root[data-theme="dark"] .aq-item.is-active .aq-row{ background:rgba(176,155,238,.14); box-shadow:inset 2px 0 0 var(--violet-text); }
:root[data-theme="dark"] .aq-field dd{ background:var(--dk-s1); border-color:var(--dk-control); color:var(--text-primary); }
/* state rules are one class heavier than the rest rule (0,4,1 over 0,3,1) */
:root[data-theme="dark"] .aq-field.is-ai dd{ border-color:rgba(176,155,238,.55); box-shadow:none; background:var(--dk-s1); }
:root[data-theme="dark"] .aq-field dd[contenteditable="true"]{ border-color:var(--orange-text); box-shadow:0 0 0 1px rgba(243,157,94,.40); }
:root[data-theme="dark"] .aq-scene [contenteditable="true"]{ background:var(--dk-s1); box-shadow:0 0 0 1px rgba(243,157,94,.40); }
:root[data-theme="dark"] .aq-btn--ghost{ background:rgba(150,175,230,.05); border-color:var(--dk-line-3); color:var(--text-primary); }
:root[data-theme="dark"] .aq-btn--ghost:hover:not(:disabled){ border-color:var(--dk-edge); }
:root[data-theme="dark"] .aq-btn--go{ background:var(--btn-blue); border-color:var(--btn-blue); color:#fff; }
:root[data-theme="dark"] .aq-btn--go:hover:not(:disabled){ background:var(--btn-blue-hi); border-color:var(--btn-blue-hi); }
/* the eight scenes */
:root[data-theme="dark"] .sc-file-btn{ background:var(--dk-s3); border-color:var(--dk-line-3); }
:root[data-theme="dark"] .sc-search{ background:var(--dk-s1); border-color:var(--dk-control); }
:root[data-theme="dark"] .sc-facts li{ border-bottom-color:var(--dk-line-2); }
:root[data-theme="dark"] :is(.sc-cost,.sc-claim,.sc-next,.sc-body){ border-color:var(--dk-line-3); }
:root[data-theme="dark"] .sc-scope{ border-left-color:var(--dk-line-3); }
:root[data-theme="dark"] .sc-scope.on:not(.done) li{ animation-name:scScanD; }
@keyframes scScanD{ 0%,100%{ background:transparent; } 20%,35%{ background:rgba(150,175,230,.08); } }
:root[data-theme="dark"] .sc-scope li.sc-pick.on{ background:rgba(107,207,157,.09); }
:root[data-theme="dark"] :is(.sc-meter,.sc-bar,.sc-track){ background:rgba(150,175,230,.14); }
:root[data-theme="dark"] :is(.sc-billed,.k-billed){ background:var(--text-muted); }
:root[data-theme="dark"] :is(.sc-unbilled,.k-unbilled){ background:var(--orange-text); }
:root[data-theme="dark"] :is(.sc-act,.k-act){ background:var(--blue-text); }
:root[data-theme="dark"] .sc-b--over .sc-act{ background:var(--red-text); }
:root[data-theme="dark"] .sc-msg--you{ background:#183d86; color:#eef3ff; }
:root[data-theme="dark"] .sc-msg--aiba{ background:var(--dk-s3); border-color:var(--dk-line-3); }
:root[data-theme="dark"] .sc-dots{ background:var(--dk-s3); }
:root[data-theme="dark"] .sc-temp-track{ background:linear-gradient(90deg,var(--blue-text),var(--orange-text) 50%,var(--red-text)); }
:root[data-theme="dark"] .sc-temp-dot{ background:var(--dk-s2); border-color:var(--text-primary); }
/* phones and tablets: the record opens inside the queue row, so it is a window on an s2 host and shifts up one level */
@media (max-width:900px){
  :root[data-theme="dark"] .aq-item > .aq-record{ background:var(--dk-s3); border-color:var(--dk-edge); box-shadow:inset 0 1px 0 var(--dk-edge-hi); }
}

/* ---- "Pick your business": page content on the canvas, so a card (s1), not a window ---- */
:root[data-theme="dark"] .bp{ --line:var(--dk-line-1); }
:root[data-theme="dark"] .bp-stage{ background:var(--dk-s1); border-color:var(--dk-line-1); box-shadow:inset 0 1px 0 var(--dk-light-top); }
:root[data-theme="dark"] .bp-tab:hover{ background:rgba(150,175,230,.06); }
:root[data-theme="dark"] .bp-tab[aria-selected="true"]{ background:rgba(150,175,230,.08); }   /* a neutral slab: an orange tint on navy reads brown */
:root[data-theme="dark"] .bp-tab::after{ background:rgba(243,157,94,.45); }
:root[data-theme="dark"] .bp-tab:focus-visible{ outline-color:var(--dk-focus); }
:root[data-theme="dark"] .bp-icon{ background:rgba(150,175,230,.10); }

/* ---- inline brand colours on this page: tints. Inline styles beat any normal rule, so these two carry !important (colour/border only). ---- */
:root[data-theme="dark"] #cognitive-integrations .service-hero-badge{ color:var(--blue-text) !important; border-color:rgba(129,170,247,.35) !important; }
:root[data-theme="dark"] .service-hero-orange .service-hero-badge{ color:var(--orange-text) !important; border-color:rgba(243,157,94,.35) !important; }

/* ===================== Business Assistant on phones (Mars, 25 Nov): what worked on the home page =====================
   body.ba-page only (the Sandbox's copy of the AIBA demo is left alone). Desktop unchanged.
   1. One background: no navy bands behind the demo and the AI section, the grid runs behind every section.
   2. Every section holds at least one screen, content centred, the same 48px spacing. */
@media (max-width: 767px) {
  body.ba-page #aiba-presentation-suite, body.ba-page #cognitive-integrations {
    background: transparent !important; box-shadow: none !important; border-top: 0 !important; border-bottom: 0 !important;
  }
  body.ba-page main > section {
    min-height: calc(100vh - 96px); min-height: calc(100svh - 96px);
    display: flex; flex-direction: column; justify-content: center;
    padding-top: 48px !important; padding-bottom: 48px !important;
  }
  body.ba-page main > section > .container { width: 100%; }
  body.ba-page main > section .section-header { margin-bottom: 24px; }
}

/* ===================== Phones: the subscriptions card folds into a pile (Mars, 25 Nov) =====================
   business-assistants.js adds the "See all 5 subscriptions" button and .is-open. Folded, the rows sit as a
   pile (the top one readable, the edges of the rest behind it); open, they fan out as on desktop. The flip
   to the Rufen card (.active-collapse, app.js) is unchanged and gets the full height it needs. */
.saas-fold { display: none; }
@media (max-width: 767px) {
  body.ba-page .saas-simulator-card { min-height: 0 !important; gap: 14px !important; }
  body.ba-page .saas-simulator-card .saas-cards-stack { height: 80px; transition: height .5s cubic-bezier(0.16, 1, 0.3, 1); }
  body.ba-page .saas-simulator-card.is-open .saas-cards-stack,
  body.ba-page .saas-simulator-wrapper.active-collapse .saas-cards-stack { height: 200px; }

  body.ba-page .saas-simulator-wrapper:not(.active-collapse) .saas-simulator-card:not(.is-open) #saas-card-invoice  { top: 9px;  transform: scale(.96); }
  body.ba-page .saas-simulator-wrapper:not(.active-collapse) .saas-simulator-card:not(.is-open) #saas-card-schedule { top: 18px; transform: scale(.92); }
  body.ba-page .saas-simulator-wrapper:not(.active-collapse) .saas-simulator-card:not(.is-open) #saas-card-phone    { top: 27px; transform: scale(.88); }
  body.ba-page .saas-simulator-wrapper:not(.active-collapse) .saas-simulator-card:not(.is-open) #saas-card-report   { top: 36px; transform: scale(.84); }
  body.ba-page .saas-simulator-card .saas-bleed-card > * { transition: opacity .3s ease; }
  body.ba-page .saas-simulator-wrapper:not(.active-collapse) .saas-simulator-card:not(.is-open) .saas-bleed-card:not(#saas-card-crm) > * { opacity: 0; }

  body.ba-page .saas-fold {
    display: inline-flex; align-self: center; align-items: center; gap: 6px;
    padding: 6px 10px; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: .85rem; font-weight: 600; color: var(--accent-blue);
  }
  :root[data-theme="dark"] body.ba-page .saas-fold { color: var(--blue-text, #81aaf7); }
  body.ba-page .saas-fold svg { width: 16px; height: 16px; transition: transform .3s ease; }
  body.ba-page .saas-simulator-card.is-open .saas-fold svg { transform: rotate(180deg); }
  body.ba-page .saas-fold:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; border-radius: 6px; }
  body.ba-page .saas-simulator-wrapper.active-collapse .saas-fold { visibility: hidden; }
}

/* ===================== Phones: "AI suggests. You decide." one suggestion at a time (Mars, 25 Nov) =====================
   business-assistants.js adds the arrows and dots (.aq-pager). Only the open suggestion shows, with its record
   under it; steps still to come show as a faint blurred preview that comes into focus, so the form is never an
   empty box. Wider screens unchanged. */
.aq-pager { display: none; }
@media (max-width: 767px) {
  body.ba-page .aq-pager { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; align-items: center; gap: 6px; padding: 10px 12px 2px; }
  body.ba-page .aq-pager-arrow {
    display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(15, 23, 42, 0.12); background: rgba(255, 255, 255, 0.7); color: var(--text-primary);
  }
  body.ba-page .aq-pager-arrow svg { width: 16px; height: 16px; }
  body.ba-page .aq-pager-arrow:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
  body.ba-page .aq-pager-dots { display: flex; justify-content: center; gap: 5px; }
  body.ba-page .aq-pager-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted, #94a3b8); opacity: 0.4; transition: width 0.25s ease, opacity 0.25s ease; }
  body.ba-page .aq-pager-dots i.is-on { width: 14px; border-radius: 3px; opacity: 1; background: var(--ai); }
  body.ba-page .aq-item:not(.is-active) { display: none; }
  body.ba-page .aq-item + .aq-item { border-top: 0; }
  body.ba-page .aq-scene [data-s] { transition: opacity .35s ease, transform .35s ease, filter .35s ease; }
  body.ba-page .aq-scene [data-s]:not(.on) { opacity: 0.16; filter: blur(4px); transform: none; }
}
:root[data-theme="dark"] body.ba-page .aq-pager-arrow { background: var(--dk-s3); border-color: var(--dk-line-3); color: var(--text-primary); }

/* ===================== Phones: "One system, shaped to your business." (Mars, 25 Nov) =====================
   business-assistants.js wraps the list in .bp-pager with two arrows, adds the dots and a "Shaped for you"
   fold in each panel. One kind of business at a time; the panel's name and icon are already in the pager,
   so they're hidden here. Wider screens: the pager is display:contents and the extras are hidden. */
.bp-pager { display: contents; }
.bp-pager-arrow, .bp-dots, .bp-more { display: none; }
@media (max-width: 767px) {
  body.ba-page .bp-ask { display: block; text-align: center; margin: 0 0 10px; width: auto; }
  body.ba-page .bp-pager { display: grid; grid-template-columns: 30px minmax(0, 1fr) 30px; align-items: center; gap: 6px; }
  body.ba-page .bp-pager-arrow {
    display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(15, 23, 42, 0.12); background: rgba(255, 255, 255, 0.7); color: var(--text-primary);
  }
  body.ba-page .bp-pager-arrow { align-self: end; margin-bottom: 9px; }   /* level with the business name, under the question */
  body.ba-page .bp-pager-arrow svg { width: 16px; height: 16px; }
  body.ba-page .bp-pager-arrow:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
  body.ba-page .bp-tabs { display: block; }
  body.ba-page .bp-tab { display: none; }
  body.ba-page .bp-tab[aria-selected="true"] { display: flex; width: 100%; height: 48px; justify-content: center; }
  body.ba-page .bp-dots { display: flex; justify-content: center; gap: 5px; margin: 10px 0 4px; }
  body.ba-page .bp-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted, #94a3b8); opacity: 0.4; transition: width 0.25s ease, opacity 0.25s ease; }
  body.ba-page .bp-dots i.is-on { width: 14px; border-radius: 3px; opacity: 1; background: var(--warm); }
  body.ba-page .bp-panel > .bp-icon, body.ba-page .bp-panel > h3 { display: none; }
  body.ba-page .bp-more {
    display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 4px 0; border: 0; background: none;
    cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: var(--accent-blue);
  }
  body.ba-page .bp-more svg { width: 16px; height: 16px; transition: transform .3s ease; }
  body.ba-page .bp.is-shaped .bp-more svg { transform: rotate(180deg); }
  body.ba-page .bp:not(.is-shaped) .bp-panel :is(.bp-sub, .bp-shape) { display: none; }
  body.ba-page .bp-panel .bp-sub { display: none; }
}
:root[data-theme="dark"] body.ba-page .bp-pager-arrow { background: var(--dk-s3); border-color: var(--dk-line-3); color: var(--text-primary); }
:root[data-theme="dark"] body.ba-page .bp-more { color: var(--blue-text, #81aaf7); }

/* ===================== Phones, round 2 (Mars, 26 Nov) =====================
   1. "Stop renting software…": a two-line version (.saas-brief) in place of the two long paragraphs.
   2. "AI suggests. You decide.": smaller. The row that repeats the record's title and the note under the
      buttons are hidden, and the form is tighter. */
.saas-brief { display: none; }
@media (max-width: 767px) {
  body.ba-page .saas-brief { display: block; }
  body.ba-page .saas-long { display: none; }

  body.ba-page .aq-item.is-active > .aq-row { display: none; }
  body.ba-page .aq-item > .aq-record { margin: 6px 0 4px; }
  body.ba-page .aq-record { padding: 14px 14px 16px; }
  body.ba-page .aq-why-out { display: none; }
  body.ba-page .aq-status { margin: 6px 0 10px; font-size: 0.8rem; }
  body.ba-page .aq-fields { gap: 7px; }
  body.ba-page .aq-field { gap: 3px; }
  body.ba-page .aq-field dd { padding: 6px 10px; font-size: 0.84rem; }
  body.ba-page .aq-actions { margin-top: 12px; }
}
