/* Showroom skin: the assistant floats as a centred pill at the bottom of the viewport and grows
   upward into a card when it is used. The conversation itself is styled in ../af-shared/thread.css. */
.assistant { position: fixed; left: 50%; bottom: calc(var(--bar-gap) + env(safe-area-inset-bottom)); z-index: 40; width: min(var(--bar-w), 100% - 2 * var(--gutter)); transform: translateX(-50%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; max-height: min(78vh, 760px); background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.06), 0 2px 4px oklch(0 0 0 / 0.4), 0 24px 60px -20px oklch(0 0 0 / 0.9); overflow: hidden; transition: height 420ms var(--ease-out), border-radius var(--t-fast); }
.assistant.open { border-radius: 22px; }
/* On load the pill rises from below the viewport edge and settles; the keyframes carry the centring transform. */
.assistant { animation: as-enter 900ms var(--ease-out) 350ms both; }
@keyframes as-enter {
  from { opacity: 0; transform: translate(-50%, calc(100% + var(--bar-gap) + 24px)); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { .assistant { animation: none; } }
/* After the first page of a visit the pill is already there (layouts/default.vue sets .as-seen before the first paint). */
.as-seen .assistant { animation: none; }
/* While the first screen's own ask row is on screen and the panel is idle, the pill waits below the viewport
   edge (showroom.js). The entry animation is cleared here, or its end state would pin the transform. */
.assistant.tucked { animation: none; opacity: 0; transform: translate(-50%, calc(100% + var(--bar-gap) + 24px)); pointer-events: none; transition: opacity 400ms var(--ease-out), transform 600ms var(--ease-lift); }
.as-face { background: var(--black); }

/* Collapsed: only the ask row (and the chips as its second line, as in the reference bar). */
.assistant:not(.open) > :not(.as-form, .as-chips, .beam, .beam-halo) { display: none; }
.assistant.open.handoff > :not(.wa) { display: none; }
.assistant.open.handoff { grid-template-rows: minmax(0, 1fr); }
.assistant.open.busy .as-chips, .assistant.open.busy .as-foot { display: none; }
.assistant.open .as-form { order: 3; }

.as-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.as-face { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.as-face-btn { position: relative; display: grid; flex: none; border: 0; padding: 0; background: none; border-radius: 50%; cursor: pointer; }
.as-face-btn .as-face { width: 36px; height: 36px; }
.as-head b { display: block; font-weight: 700; font-size: 0.9375rem; line-height: 1.2; }
.as-head span { font-size: 0.8125rem; color: var(--ink-3); }
.as-head .as-live { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.as-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--wa); }
.as-close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); flex: none; }
.as-head .as-live + .as-close { margin-left: var(--s-2); }
.as-close:hover { border-color: var(--ink); color: var(--ink); }
.as-close svg { width: 16px; height: 16px; }
.as-thread { max-height: 100%; }

/* Ask row: the pill itself when collapsed, the composer when open. */
.as-form { display: flex; align-items: center; gap: var(--s-2); padding: 0.35rem 0.35rem 0.35rem 0.5rem; background: var(--card); }
.assistant.open .as-form { margin: var(--s-3) var(--s-4) var(--s-2); padding: 0.25rem 0.25rem 0.25rem 0.9rem; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--paper); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.assistant.open .as-form:focus-within { border-color: var(--navy-ink); box-shadow: 0 0 0 4px var(--navy-soft); }
.assistant.open .as-form .as-face-btn { display: none; }
.assistant.has-thread .as-face-btn::after { content: ""; position: absolute; top: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--wa); border: 2px solid var(--card); }
.as-form input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: clamp(0.875rem, 0.84rem + 0.15vw, 1rem); color: var(--ink); outline: none; padding: 0.3rem 0.3rem; min-height: 36px; }
.as-form input::placeholder { color: var(--ink-3); transition: opacity 320ms var(--ease-out); }
.as-form input.swap::placeholder { opacity: 0; } /* showroom.js fades the placeholder out, swaps the question, fades it in */
.as-resume { display: none; flex: none; color: var(--navy-ink); } /* a .chip; colour only */
.assistant.has-thread:not(.open) .as-resume { display: inline-flex; }
/* The send disc is white on black, the same move as the logo block and the primary button. */
.as-send { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); flex: none; transition: background var(--t-fast); }
.as-send:hover { background: oklch(0.88 0.008 268); }
.as-send:active { transform: scale(0.94); }
.as-send svg { width: 16px; height: 16px; transition: transform 500ms var(--ease-lift); }
.as-send:hover svg { transform: translateX(2px); }

/* align-content keeps the chips at natural height when they fall into the thread's flexible track (open, no thread yet). */
.as-chips { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: flex-start; gap: var(--s-2); padding: 0 var(--s-3) var(--s-3); }
.assistant.open .as-chips { padding: var(--s-4) var(--s-4) 0; order: 2; }
/* Suggestions in the bar are smaller than the site's chips: 13px text, a 36px target (also on touch screens). */
.as-chips .chip { min-height: 36px; padding: 0.25rem 0.75rem; font-size: 0.8125rem; }
/* The suggestions are .chip; only the change-over when the page scrolls to another section is theirs. */
.as-chips .chip { transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
.as-chips.swap .chip { opacity: 0; transform: translateY(4px); }
/* thread.css sets the handoff's transition without transform; the lift and press ease here like every other pill. */
.t-handoff .btn-wa { transition: opacity 400ms var(--ease-out), filter 400ms var(--ease-out), background var(--t-fast), transform 500ms var(--ease-lift); }
.as-foot { order: 4; padding: 0 var(--s-4) var(--s-4); font-size: 0.8125rem; color: var(--ink-3); }
.assistant.open.busy .as-form { margin-bottom: var(--s-4); }
.as-reset { order: 2; padding: var(--s-3) var(--s-4) 0; font-size: 0.8125rem; }
.as-reset button { border: 0; background: none; padding: 0; color: var(--ink-3); text-decoration: underline; text-underline-offset: 3px; }
.as-reset button:hover { color: var(--ink); }
.wa { order: 1; }

/* Live assistant (SiteAssistantLive): the answer as text, its sources, a failure, the way to a colleague. */
.as-answer { display: grid; gap: var(--s-3); line-height: 1.5; overflow-wrap: anywhere; }
.as-answer p, .as-answer ul { max-width: 56ch; }
.as-answer ul { display: grid; gap: var(--s-1); padding-left: 1.1rem; list-style: disc; }
.as-answer ul.as-sources { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0; list-style: none; } /* links are .chip */
.as-failure { margin-left: calc(28px + var(--s-3)); padding: var(--s-3) var(--s-4); border-radius: 12px; background: var(--paper-2); font-size: var(--step--1); color: var(--ink-2); }
.as-more { margin-left: calc(28px + var(--s-3)); font-size: var(--step--1); }
.as-more .link { color: var(--ink-2); font-weight: 600; }
/* Part of the thread, not a card in the panel: one rule above it marks the step to a person. */
.as-handoff { display: grid; gap: var(--s-3); justify-items: start; margin-left: calc(28px + var(--s-3)); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.as-handoff-lede, .as-handoff-ok { font-size: var(--step--1); color: var(--ink-2); max-width: 52ch; }
.as-handoff-toggle { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; font-size: var(--step--1); font-weight: 600; cursor: pointer; }
.as-handoff-toggle input { width: 18px; height: 18px; accent-color: var(--wa); }
.as-handoff .lead-grid { width: 100%; }
.as-handoff .btn-wa:disabled { opacity: 0.45; cursor: not-allowed; }
.as-send:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 640px) {
  .assistant { width: calc(100% - 2 * var(--s-3)); bottom: calc(var(--s-3) + env(safe-area-inset-bottom)); border-radius: 26px; }
  .assistant:not(.open) .as-chips { display: none; }
  /* Open, the panel grows from the pill with its content, as on desktop, and stops short of the top edge. */
  .assistant.open { max-height: calc(100dvh - 2 * var(--s-3) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 18px; }
  .as-head, .as-foot { padding-inline: var(--s-4); }
  .as-head .as-live { display: none; }
  .assistant.open .as-form { margin-inline: var(--s-4); }
  .assistant.open .as-chips { padding-inline: var(--s-4); }
  .as-reset { padding-inline: var(--s-4); }
  .as-resume { display: none !important; }
  .as-failure, .as-more, .as-handoff { margin-left: 0; }
}

/* A card the assistant proposed (SiteAssistantProposal): the fields use the lead form's own .lead-field (lead-form.css). */
.as-proposal { display: grid; gap: var(--s-3); padding: var(--s-3) var(--s-4) var(--s-4); border: 1px solid var(--line); border-radius: 14px; font-size: var(--step--1); }
.as-proposal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: 0; }
.as-proposal-head b { font-size: var(--step-0); color: var(--ink-1, inherit); }
.as-proposal-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s-3); margin: 0; }
.as-proposal-facts dt { color: var(--ink-3); }
.as-proposal-facts dd { margin: 0; overflow-wrap: anywhere; }
.as-proposal-consent { margin: 0; color: var(--ink-3); font-size: 0.8125rem; }
.as-proposal-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-3); margin: 0; }
.as-proposal-files { display: grid; gap: var(--s-2); }
/* Cloudflare draws its box here only when it asks the visitor for a click; otherwise it stays empty. */
.as-gate:empty { display: none; }
.as-gate { padding: 0 var(--s-4) var(--s-2); }

/* Display cards of a live answer (SiteAssistantCards): cars, promotions, locations, people, price tables. */
.as-artifacts { display: grid; gap: var(--s-3); }
.art-cars, .art-branches, .art-replies { display: flex; flex-wrap: wrap; gap: var(--s-3); padding: 0; list-style: none; }
.art-cars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.art-car { display: grid; grid-template-rows: auto 1fr; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--black); color: inherit; text-decoration: none; transition: border-color var(--t-fast); }
.art-car:hover, .art-car:focus-visible { border-color: var(--ink-3); }
.art-car img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.art-car-body { display: grid; gap: 2px; align-content: start; padding: var(--s-3) var(--s-4) var(--s-4); font-size: var(--step--1); color: var(--ink-3); }
.art-car-body small { font-size: 0.8125rem; color: var(--ink-2); }
.art-car-body b { font-size: var(--step-0); line-height: 1.25; color: var(--ink-1, inherit); }
.art-car-body strong { font-size: var(--step-1); color: var(--ink-1, inherit); }
.art-car-body strong em { font-size: var(--step--1); font-style: normal; font-weight: 400; color: var(--ink-3); }
.art-car-body .badge { justify-self: start; margin-top: var(--s-1); } /* the promotion label (.badge-promo, base.css) */
.art-branches li { flex: 1 1 200px; display: grid; gap: 2px; padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: 14px; font-size: var(--step--1); color: var(--ink-3); }
.art-branches b { color: var(--ink-1, inherit); font-size: var(--step-0); }
.art-tariff { display: grid; gap: var(--s-2); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: 14px; font-size: var(--step--1); }
.art-tariff p { margin: 0; }
.art-scroll { overflow-x: auto; }
.art-tariff table { width: 100%; border-collapse: collapse; }
.art-tariff th, .art-tariff td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.art-tariff thead th { color: var(--ink-3); font-weight: 600; }
.art-tariff .chip { justify-self: start; }

/* The RMB AI orb (SiteAiOrb.vue; app.js writes the same markup). utils/aiOrb.ts draws it in WebGL on a canvas that
   overhangs the slot, so the halo and the thinking sparks spill around the sphere. Until then, and without WebGL,
   the gradient below stands in. The size comes from the placement (.as-face, .ask-mark). */
.ai-orb { position: relative; display: block; width: 36px; height: 36px; flex: none; border-radius: 50%; background: radial-gradient(circle at 36% 30%, oklch(0.92 0.06 215), oklch(0.6 0.2 262) 42%, oklch(0.3 0.15 285) 78%, oklch(0.15 0.06 270)); }
.ai-orb.is-gl { background: none; }
.ai-orb canvas { position: absolute; inset: -15%; width: 130%; height: 130%; pointer-events: none; }

/* Border beam on every chat field (SiteLaserBorder.vue in the home ask row, the collapsed pill and the panel's field).
   A gradient square runs the border on an offset-path (even speed round the curves) and a border-only mask shows
   just the strip; .beam-halo is a blurred copy for the glow. It sits on the field's own 1px border. Hover runs it
   slowly in blue, focus faster in cyan, and while RMB AI thinks or answers (the orb's data-state) two beams race in
   magenta. The pill shows its own beam while collapsed, the field's while open. Each state only sets variables. */
.ask-form, .assistant.open .as-form { position: relative; --beam-r: 999px; }
.assistant { --beam-r: 28px; }
.beam, .beam-halo { position: absolute; inset: -1px; z-index: 1; border-radius: inherit; pointer-events: none; }
.assistant > .beam, .assistant > .beam-halo { inset: 0; } /* the panel clips at its padding edge */
.beam-halo { filter: blur(5px); opacity: calc(var(--beam-on, 0) * 0.9); transition: opacity 450ms var(--ease-out); }
.beam-halo > .beam { inset: 0; --beam-w: 4px; }
.beam { border: var(--beam-w, 1.5px) solid transparent; opacity: var(--beam-on, 0); transition: opacity 450ms var(--ease-out);
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0) border-box; -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0) border-box; }
.beam-halo > .beam { opacity: 1; }
.beam::after, .beam::before { content: ""; position: absolute; width: var(--beam-size, 160px); height: 12px; /* a bar, not a square: a square taller than the pill lights both long edges */
  background: linear-gradient(to left, #fff, var(--beam-from, transparent) 6%, var(--beam-to, transparent) 45%, transparent);
  offset-path: rect(0 auto auto 0 round var(--beam-r)); offset-anchor: 90% 50%;
  animation: beam-run var(--beam-dur, 8s) linear infinite; }
.beam::before { display: var(--beam-twin, none); animation-delay: calc(var(--beam-dur, 8s) * -0.5); }
.assistant.open > .beam, .assistant.open > .beam-halo, .assistant:not(.open) .as-form > :is(.beam, .beam-halo) { display: none; }
.ask-form:hover, .assistant:not(.open):hover, .assistant.open .as-form:hover {
  --beam-on: 1; --beam-dur: 8s; --beam-from: oklch(0.76 0.17 255); --beam-to: oklch(0.55 0.22 295);
}
.ask-form:focus-within, .assistant:not(.open):focus-within, .assistant.open .as-form:focus-within {
  --beam-on: 1; --beam-dur: 3.5s; --beam-from: oklch(0.88 0.14 205); --beam-to: oklch(0.6 0.2 258);
}
.assistant:has(.ai-orb:is([data-state="thinking"], [data-state="answering"])),
.assistant:has(.ai-orb:is([data-state="thinking"], [data-state="answering"])) .as-form {
  --beam-on: 1; --beam-dur: 1.8s; --beam-size: 130px; --beam-twin: block; --beam-from: oklch(0.75 0.24 335); --beam-to: oklch(0.56 0.25 295);
}
@keyframes beam-run { from { offset-distance: 0%; } to { offset-distance: 100%; } }
@media (prefers-reduced-motion: reduce) { .beam::after, .beam::before { animation: none; } }
