/*
 * Panel styling, built from the Figma design (node 7459:4141).
 *
 * Values are taken from the file rather than eyeballed: Brand/Primary #326295,
 * Brand/Secondary #041E42, Text/Gray #58585A, Text/Light Gray #818284, Mulish
 * at 32/40 for the heading, 18/26 for body, 16/16 for buttons, 24px modal
 * radius, a cream #FFF6E5 notice panel on a Brand/Accent hairline. The colour
 * tokens are still overridable from the General tab, so an admin can retheme
 * without a deploy.
 */

:root {
  --aisa-accent: #326295;        /* Brand/Primary */
  --aisa-navy: #041e42;          /* Brand/Secondary - headings, checked states */
  --aisa-panel-bg: #fff;
  --aisa-btn-bg: #326295;
  --aisa-btn-text: #fff;

  /*
   * The floating launcher, from Figma node 7620:5470. Its own tokens, not the
   * panel's button colours - those still follow the Button Background setting
   * and are used by the primary buttons inside the panel.
   */
  --aisa-launcher-bg: #041e42;   /* Brand/Secondary */
  --aisa-launcher-h: 60px;
  --aisa-ink: #58585a;           /* Text/Gray */
  --aisa-ink-2: #58585a;         /* Text/Gray */
  --aisa-ink-3: #818284;         /* Text/Light Gray - the quieter asides */
  --aisa-line: #e3e6ea;
  --aisa-accent-line: #b5bcd6;   /* Brand/Accent - the hairline on tinted panels */

  /* Cream, not the blue wash it used to be. Shared with the report page. */
  --aisa-notice-bg: #fff6e5;
  --aisa-radius: 24px;

  /* "basic - lite" in the design. Soft and blue-grey rather than black. */
  --aisa-shadow: -5px 10px 25px rgba(114, 128, 155, .1);

  /*
   * Scrollbars. Narrow enough to read as trim rather than furniture - the 12px
   * bar the card used to draw was wider than the gutter it sat in and pulled
   * the eye away from the report.
   *
   * Two sets, because the modal has a light card and a dark navy shell and one
   * thumb colour cannot serve both. The thumb follows --aisa-accent, so an
   * admin retheming from the General tab restyles these with it.
   */
  --aisa-scroll-size: 8px;
  --aisa-scroll-thumb: var(--aisa-accent);
  --aisa-scroll-track: var(--aisa-line);
  --aisa-scroll-thumb-dark: rgba(255, 255, 255, .38);
  --aisa-scroll-track-dark: rgba(255, 255, 255, .10);
  --aisa-font: "Mulish", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------------------------------------------------------------------------
   Scrollbars.

   Applied to every scroller the modal owns rather than to the report card
   alone, so the panel, the step and - on a phone, where the root is the
   scroller - the shell all draw the same bar instead of falling back to the
   browser's.

   Firefox takes the two-value `scrollbar-color`; WebKit needs the pseudo
   elements. Both are given, and neither is a fallback for the other.
   --------------------------------------------------------------------------- */

.aisa-root,
.aisa-panel,
.aisa-body,
.aisa-step,
.aisa-result__scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--aisa-scroll-thumb) var(--aisa-scroll-track);
}

.aisa-root::-webkit-scrollbar,
.aisa-panel::-webkit-scrollbar,
.aisa-body::-webkit-scrollbar,
.aisa-step::-webkit-scrollbar,
.aisa-result__scroll::-webkit-scrollbar {
  width: var(--aisa-scroll-size);
  height: var(--aisa-scroll-size);
}

.aisa-root::-webkit-scrollbar-track,
.aisa-panel::-webkit-scrollbar-track,
.aisa-body::-webkit-scrollbar-track,
.aisa-step::-webkit-scrollbar-track,
.aisa-result__scroll::-webkit-scrollbar-track {
  background: var(--aisa-scroll-track);
  border-radius: 999px;
}

.aisa-root::-webkit-scrollbar-thumb,
.aisa-panel::-webkit-scrollbar-thumb,
.aisa-body::-webkit-scrollbar-thumb,
.aisa-step::-webkit-scrollbar-thumb,
.aisa-result__scroll::-webkit-scrollbar-thumb {
  background: var(--aisa-scroll-thumb);
  border-radius: 999px;
}

/* Only the pointer can hover a scrollbar, so this costs a touch device nothing. */
.aisa-root::-webkit-scrollbar-thumb:hover,
.aisa-panel::-webkit-scrollbar-thumb:hover,
.aisa-body::-webkit-scrollbar-thumb:hover,
.aisa-step::-webkit-scrollbar-thumb:hover,
.aisa-result__scroll::-webkit-scrollbar-thumb:hover {
  background: var(--aisa-accent);
  filter: brightness(1.15);
}

.aisa-root::-webkit-scrollbar-corner,
.aisa-panel::-webkit-scrollbar-corner { background: transparent; }

/*
 * The navy shell. A brand-blue thumb on #041E42 is nearly invisible, so the
 * dark contexts swap to a translucent white - set as the same two tokens, so
 * the rules above need no dark variant of their own.
 */
.aisa-root:has(.aisa-step--result:not([hidden])),
.aisa-step--result {
  --aisa-scroll-thumb: var(--aisa-scroll-thumb-dark);
  --aisa-scroll-track: var(--aisa-scroll-track-dark);
}

/* ...but the report card inside it is white again. */
.aisa-step--result .aisa-result__scroll {
  --aisa-scroll-thumb: var(--aisa-accent);
  --aisa-scroll-track: var(--aisa-line);
}

/* ---------- launcher ---------- */

/*
 * Flush to the right edge with only the left corners rounded, so it reads as
 * a tab pulled out of the side rather than a pill floating near it. The right
 * corners are square on purpose - rounding them would leave a sliver of page
 * showing between the button and the viewport edge.
 */
.aisa-launcher {
  position: fixed;
  top: var(--aisa-launcher-top, auto);
  right: var(--aisa-launcher-right, 0);
  bottom: var(--aisa-launcher-bottom, 20px);
  left: var(--aisa-launcher-left, auto);
  z-index: var(--aisa-launcher-z, 99998);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: var(--aisa-launcher-h);
  padding: 0 24px;
  border: 0;
  border-radius: 600px 0 0 600px;
  background: var(--aisa-launcher-bg);
  color: var(--aisa-btn-text);
  font-family: var(--aisa-font);
  font-size: 16px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  /*
   * The design carries 80% on the button as a whole, label and icon included,
   * so the page tints it instead of it sitting over the page as a solid slab.
   * Full strength on hover, because a control that answers to the pointer
   * should not stay washed out once it has been found.
   */
  opacity: .8;
  transition: opacity .15s ease;
}
.aisa-launcher:hover,
.aisa-launcher:focus-visible { opacity: 1; }

/* 26px square, per the design - not the round avatar crop this used to be. */
.aisa-launcher img { width: 26px; height: 26px; flex: none; object-fit: contain; }
/*
 * Dropped into the page by the shortcode rather than pinned to the edge, so
 * it goes back to being a rounded button at full strength - the side-tab
 * shape only means anything against the viewport edge.
 */
.aisa-launcher--inline {
  position: static;
  inset: auto;
  border-radius: 999px;
  opacity: 1;
}
.aisa-launcher:focus-visible { outline: 3px solid var(--aisa-accent); outline-offset: 2px; }

/*
 * The site's WhatsApp widget is a separate plugin (esm-whatsapp-widget) pinned
 * to bottom: 40px; right: 0 - the same corner the launcher now occupies. The
 * design stacks it directly above the scanner, so it is lifted by the
 * launcher's own height plus the 12px gap between them.
 *
 * Derived from the launcher's offset rather than written as a second fixed
 * number, which would silently drift apart the moment the offset is changed
 * in the settings.
 *
 * Kept here rather than in the widget's own stylesheet, which a plugin update
 * would overwrite. It fails safely in both directions: with the widget absent
 * the selector matches nothing, and with the launcher pinned to a top corner
 * --aisa-launcher-bottom is `auto`, the calc is invalid, the declaration is
 * dropped, and the widget keeps the position its own plugin gave it.
 */
.whatsapp-widget {
  bottom: calc(var(--aisa-launcher-bottom, 20px) + var(--aisa-launcher-h) + 12px);
}

/* Nothing is pinned to the corner while the panel is open. */
body.aisa-open .whatsapp-widget { display: none; }

/* ---------- shell ---------- */

/*
 * Above the launcher by construction. The launcher's z-index is an admin
 * setting - raised to clear a chat widget, say - and a fixed 99999 here meant
 * a launcher set any higher painted over the dialog it had just opened.
 */
.aisa-root {
  position: fixed;
  inset: 0;
  z-index: calc(var(--aisa-launcher-z, 99998) + 1);

  /*
   * The gutter around the panel on a phone. The panel is a dialog there too,
   * and with none of this it read as a page that had replaced the site rather
   * than something sitting over it.
   *
   * Top and bottom add the safe area, so the gutter is measured from below the
   * notch and above the home indicator rather than from the edge of the glass.
   */
  --aisa-panel-gutter: 20px;
  --aisa-panel-top: calc(env(safe-area-inset-top, 0px) + var(--aisa-panel-gutter));
  --aisa-panel-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--aisa-panel-gutter));
}
.aisa-root[hidden] { display: none; }

/*
 * Lock both, not just body. The scrollbar belongs to the root element on many
 * themes, so locking body alone left a live scrollbar beside the panel and a
 * 15px strip of page showing through at full-bleed widths.
 */
body.aisa-open { overflow: hidden; }
html:has(body.aisa-open) { overflow: hidden; }

/* The launcher has nothing to open while the panel is open. */
body.aisa-open .aisa-launcher:not(.aisa-launcher--inline) { display: none; }

.aisa-backdrop { position: absolute; inset: 0; background: rgba(12, 14, 18, .6); }

.aisa-panel {
  font-family: var(--aisa-font);
  position: relative;
  margin: auto;
  inset: 0;
  width: min(640px, calc(100vw - 48px));
  max-height: min(92vh, 840px);
  overflow-y: auto;
  background: var(--aisa-panel-bg);
  color: var(--aisa-ink);
  border-radius: var(--aisa-radius);
  box-shadow: var(--aisa-shadow);
  display: flex;
  flex-direction: column;
}
@media (min-width: 641px) {
  .aisa-root { display: grid; place-items: center; }
}
@media (max-width: 640px) {
  .aisa-panel { width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; }
}
.aisa-panel:focus { outline: none; }

.aisa-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  color: var(--aisa-ink-2);
  cursor: pointer;
}
.aisa-close:hover { background: rgba(0, 0, 0, .06); }

.aisa-body { padding: 0; }
/* Steps other than the designed split screen keep a readable measure. */
.aisa-step:not(.aisa-step--split) { padding: 32px 30px 34px; max-width: 620px; margin: 0 auto; }

/* ---------- steps ---------- */

.aisa-step { display: flex; flex-direction: column; gap: 14px; }
.aisa-step[hidden] { display: none; }
.aisa-step--center { align-items: center; text-align: center; padding: 32px 0; }

.aisa-banner { width: 100%; border-radius: 8px; object-fit: cover; }
.aisa-title { margin: 0; font-size: 1.4rem; line-height: 1.25; text-wrap: balance; }
.aisa-prose { margin: 0; color: var(--aisa-ink-2); line-height: 1.6; }
.aisa-prose p { margin: 0 0 .7em; }
.aisa-note { margin: 0; font-size: 18px; line-height: 26px; color: var(--aisa-ink-3); }

/* ---------- controls ---------- */

.aisa-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.aisa-actions .aisa-btn { flex: 1 1 auto; }
/*
 * [hidden] is a UA rule, so this author `display: flex` outranks it and the
 * row would stay on screen with the attribute set. Same trap that once left
 * the camera step painting over the result.
 */
.aisa-actions[hidden] { display: none; }

/*
 * Square, not rounded - the design draws every button in the modal as a plain
 * rectangle, and the outlined one carries the brand blue rather than the grey
 * hairline it used to, so it reads as the second choice rather than a
 * disabled one.
 */
.aisa-btn {
  padding: 20px 24px;
  border: 1px solid var(--aisa-accent);
  border-radius: 0;
  background: transparent;
  color: var(--aisa-accent);
  font-family: var(--aisa-font);
  font-size: 16px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}
.aisa-btn--primary { background: var(--aisa-btn-bg); color: var(--aisa-btn-text); border-color: transparent; }
.aisa-btn--link { border: 0; background: none; color: var(--aisa-accent); text-decoration: underline; padding: 8px 0; }
.aisa-btn:disabled { opacity: .45; cursor: not-allowed; }
.aisa-btn:focus-visible { outline: 3px solid var(--aisa-accent); outline-offset: 2px; }

/* ---------- consent ---------- */

.aisa-consents { display: flex; flex-direction: column; gap: 10px; }
.aisa-consent { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; font-size: .925rem; }
.aisa-consent input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.aisa-consent p { margin: 0; }

/* ---------- how it works ---------- */

.aisa-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.aisa-steps li { line-height: 1.5; }
.aisa-steps strong { display: block; }
.aisa-steps span { color: var(--aisa-ink-2); font-size: .925rem; }

/* ---------- capture stage ---------- */

.aisa-stage {
  position: relative;
  /* Ratio and size are set once, further down, from the element's height. */
  background: #0d0f12;
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.aisa-stage video,
.aisa-stage img { width: 100%; height: 100%; object-fit: cover; }
.aisa-stage video { transform: scaleX(-1); } /* mirror the selfie preview only */
.aisa-stage [hidden] { display: none; }

/* ---------- loading ---------- */

.aisa-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--aisa-line);
  border-top-color: var(--aisa-accent);
  animation: aisa-spin .9s linear infinite;
}
@keyframes aisa-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .aisa-spinner { animation-duration: 2.4s; }
}
.aisa-loading { margin: 0; color: var(--aisa-ink-2); }

/* ---------- result ---------- */

.aisa-section-label {
  margin: 6px 0 0;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--aisa-ink-2);
}
.aisa-features { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.aisa-assessment { margin: 0; line-height: 1.6; }
.aisa-meta,
.aisa-disclaimer { margin: 0; font-size: .8125rem; color: var(--aisa-ink-2); line-height: 1.55; }

.aisa-service { border: 1px solid var(--aisa-line); border-radius: 8px; overflow: hidden; }
.aisa-service__link { display: flex; flex-direction: column; gap: 6px; padding: 14px; text-decoration: none; color: inherit; }
.aisa-service__link:hover { background: rgba(0, 0, 0, .03); }
.aisa-service__link img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 6px; }
.aisa-service__link span { color: var(--aisa-ink-2); font-size: .9rem; line-height: 1.5; }

.aisa-footer { border-top: 1px solid var(--aisa-line); padding-top: 14px; }
.aisa-footer h3 { margin: 0 0 4px; font-size: 1.05rem; }
.aisa-footer p { margin: 0; color: var(--aisa-ink-2); }

/* ---------- report form ---------- */



/* ==========================================================================
   Intro + consent, per the Figma design (1200x840, 560 / 640 split)
   ========================================================================== */

.aisa-step--split {
  display: grid;
  grid-template-columns: 560fr 640fr;
  gap: 0;
  min-height: 0; /* Height comes from the content; the panel caps it. */
}

/* ---- left: image with a blurred caption bar ---- */

.aisa-media { position: relative; overflow: hidden; background: #6f7276; }
.aisa-media__img { width: 100%; height: 100%; object-fit: cover; display: block; }

.aisa-media__bar {
  position: absolute;
  inset: auto 0 0 0;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 40px;
  background: rgba(0, 0, 0, .2);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  line-height: 16px;
  text-transform: uppercase;
}
.aisa-media__icon { width: 26px; height: 26px; flex: none; }

/*
 * Back to the intro, over the photo (Figma 7603:2199 / 7609:5349): a 30px
 * circle of #8C9EC2 at 70%, the layer itself at 70% too, with a white arrow.
 */
.aisa-mediaback {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(140, 158, 194, .7);
  opacity: .7;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity .15s ease;
}
.aisa-mediaback img { width: 12px; height: 10px; display: block; }
.aisa-mediaback:hover { opacity: 1; }
.aisa-mediaback:focus-visible { opacity: 1; outline: 3px solid #fff; outline-offset: 2px; }

/* ---- right: content pane ---- */

.aisa-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 60px;
  background: var(--aisa-panel-bg);
  min-width: 0;
}
.aisa-pane__body { display: flex; flex-direction: column; gap: 24px; }
/*
 * The text column scrolls as one - copy, gate and CTA together - rather than
 * the copy scrolling inside it. A scrollbar partway down the pane cut the
 * how-it-works list in half and read as a second, nested window; this is the
 * same behaviour the phone layout has always had.
 *
 * 1 0 auto, not 1 1 auto: it grows to push the gate and the CTA to the foot of
 * a short pane, but never shrinks below its content - shrinking with overflow
 * visible is what once painted the copy straight over the consent boxes.
 */
.aisa-step--split .aisa-pane { gap: 20px; overflow-y: auto; }
.aisa-step--split .aisa-pane__body { flex: 1 0 auto; }
.aisa-step--split .aisa-consents { flex: none; }

.aisa-step--split .aisa-close {
  position: static;
  align-self: flex-end;
  width: 26px;
  height: 26px;
  padding: 0;
  background: none;
  order: -1;
}
.aisa-step--split .aisa-close img { width: 100%; height: 100%; display: block; }
.aisa-close--float img { width: 16px; height: 16px; }
.aisa-root:has(.aisa-step--split:not([hidden])) .aisa-close--float { display: none; }

/*
 * On the designed screen the whole panel used to scroll, which pushed the
 * image's caption bar out of view - the bar is anchored to the bottom of a
 * column that had grown taller than the viewport. Giving the panel a definite
 * height and moving the scroll onto the text column keeps the image, its
 * caption and the CTA fixed, and scrolls only the copy that overflows.
 */
.aisa-root:has(.aisa-step--split:not([hidden])) .aisa-panel {
  width: min(1200px, calc(100vw - 48px));
  height: min(840px, 92vh);
  overflow: hidden;
}
.aisa-root:has(.aisa-step--split:not([hidden])) .aisa-body { height: 100%; }
.aisa-step--split { height: 100%; }
.aisa-pane, .aisa-media { min-height: 0; }
.aisa-pane__body { min-height: 0; }

.aisa-step--split .aisa-title {
  font-size: 32px;
  line-height: 40px;
  font-weight: 600;
  color: var(--aisa-accent);
  text-transform: capitalize;
  margin: 0;
}
.aisa-lede {
  font-size: 18px;
  line-height: 26px;
  color: var(--aisa-ink);
  margin: -4px 0 0;
}
.aisa-lede p { margin: 0 0 .6em; }
.aisa-lede p:last-child { margin-bottom: 0; }

.aisa-notice {
  background: var(--aisa-notice-bg);
  border: 1px solid var(--aisa-accent-line);
  border-radius: 8px;
  padding: 24px;
  color: var(--aisa-ink-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.aisa-notice__title { margin: 0; font-size: 18px; line-height: 26px; font-weight: 700; color: var(--aisa-navy); }
.aisa-notice__body { font-size: 16px; line-height: 24px; }
.aisa-notice__body p { margin: 0 0 1em; }
.aisa-notice__body p:last-child { margin-bottom: 0; }

.aisa-step--split .aisa-consents { gap: 12px; }
.aisa-step--split .aisa-consent {
  gap: 12px;
  font-size: 18px;
  line-height: 26px;
  color: var(--aisa-ink-2);
  align-items: flex-start;
}

/* A real checkbox, styled to the design, so keyboard and screen-reader
   behaviour stay native rather than being re-implemented on a div. */
.aisa-step--split .aisa-consent input {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  flex: none;
  margin: 0;
  border: 2px solid var(--aisa-accent);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.aisa-step--split .aisa-consent input:checked { background: var(--aisa-accent); }
.aisa-step--split .aisa-consent input:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 7px;
  height: 13px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.aisa-step--split .aisa-consent input:focus-visible {
  outline: 3px solid var(--aisa-accent);
  outline-offset: 2px;
}

.aisa-step--split .aisa-btn {
  border-radius: 0;
  padding: 20px 24px;
  font-size: 16px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  width: 100%;
}

/* ---- stack below the split's natural width ---- */
@media (max-width: 900px) {
  .aisa-step--split { grid-template-columns: 1fr; min-height: 0; }
  .aisa-media { height: 240px; }
  .aisa-media__bar { padding: 0 24px; }
  .aisa-pane { padding: 28px 24px 32px; gap: 24px; }
  .aisa-step--split .aisa-title { font-size: 26px; line-height: 32px; }
  .aisa-lede, .aisa-step--split .aisa-consent { font-size: 16px; line-height: 24px; }
}


/* ==========================================================================
   Remaining steps, on the same design language as the intro screen.
   No frames exist for these yet, so this applies the established tokens -
   Brand/Primary, Mulish, the cream notice panel, square uppercase buttons -
   rather than inventing a second visual system.
   ========================================================================== */

.aisa-step:not(.aisa-step--split) { gap: 20px; }

.aisa-step:not(.aisa-step--split) .aisa-title {
  font-size: 28px;
  line-height: 36px;
  font-weight: 600;
  color: var(--aisa-accent);
  margin: 0;
}
.aisa-step:not(.aisa-step--split) .aisa-prose { font-size: 18px; line-height: 26px; color: var(--aisa-ink); }

.aisa-close--float {
  width: 26px;
  height: 26px;
  top: 22px;
  right: 24px;
  padding: 0;
  display: grid;
  place-items: center;
}
.aisa-close--float:hover { background: rgba(50, 98, 149, .1); }

/* Buttons follow the design: square, uppercase, 16/16 semibold. */
.aisa-btn {
  border-radius: 0;
  padding: 20px 24px;
  font-size: 16px;
  line-height: 16px;
  font-weight: 600;
  text-transform: uppercase;
  border-color: var(--aisa-accent);
  color: var(--aisa-accent);
}
.aisa-btn--primary { color: var(--aisa-btn-text); }
.aisa-btn--link { text-transform: none; font-weight: 400; padding: 4px 0; }

.aisa-stage { border-radius: 20px; }

.aisa-spinner { border-width: 4px; border-top-color: var(--aisa-accent); width: 48px; height: 48px; }
.aisa-loading { font-size: 18px; line-height: 26px; }

/* ---- result ---- */

.aisa-section-label { color: var(--aisa-accent); font-weight: 700; font-size: 13px; letter-spacing: .1em; }
.aisa-features li { font-size: 17px; line-height: 26px; color: var(--aisa-ink); }
.aisa-assessment { font-size: 17px; line-height: 26px; color: var(--aisa-ink); }

.aisa-service { border: 0; border-radius: 20px; background: var(--aisa-notice-bg); }
.aisa-service__link { padding: 20px; gap: 10px; }
.aisa-service__link:hover { background: rgba(50, 98, 149, .07); }
.aisa-service__link img { border-radius: 12px; max-height: 190px; }
.aisa-service__link strong { font-size: 20px; line-height: 28px; color: var(--aisa-accent); }

.aisa-meta,
.aisa-disclaimer { font-size: 14px; line-height: 21px; }
.aisa-disclaimer { padding-top: 4px; border-top: 1px solid var(--aisa-line); }

.aisa-footer h3 { font-size: 20px; color: var(--aisa-accent); font-weight: 600; }
.aisa-footer p { font-size: 16px; line-height: 24px; }

/* ---- report form ---- */


/* ---- error ---- */

.aisa-step[data-aisa-step="error"] .aisa-title { color: #9E362F; }

@media (max-width: 640px) {
  .aisa-step:not(.aisa-step--split) { padding: 26px 22px 30px; }
  .aisa-step:not(.aisa-step--split) .aisa-title { font-size: 24px; line-height: 32px; }
}

/* Fields rendered from the configured contract, in the order configured. */
.aisa-fields { display: flex; flex-direction: column; gap: 14px; }
.aisa-fields .aisa-features { margin: 0; }
.aisa-fields .aisa-assessment { margin: 0; }
.aisa-fields > *:last-child { color: var(--aisa-ink-2); font-size: 14px; line-height: 21px; }


/* ==========================================================================
   Step 2: how it works (Figma node 7459:4719)
   ========================================================================== */

.aisa-pane__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: none;
}
/* Only one arrow when there is nothing to go back to. */
.aisa-pane__head:has(> :only-child) { justify-content: flex-end; }

.aisa-iconbtn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.aisa-iconbtn img { width: 100%; height: 100%; display: block; }
.aisa-iconbtn:focus-visible { outline: 3px solid var(--aisa-accent); outline-offset: 3px; }

.aisa-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 24px; }
.aisa-steps li { display: flex; align-items: center; gap: 16px; }

/*
 * 100px, and no circle of its own. The exported illustrations carry their own
 * cream ground, so the tinted disc this used to draw sat behind a second one
 * and showed as a ring around it. mix-blend-mode went with it: it existed to
 * sink a white-backed PNG into that tint, and on artwork that already has a
 * ground it just dirties the colours.
 */
.aisa-steps__icon {
  flex: none;
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
}
.aisa-steps__icon img { width: 100%; height: 100%; object-fit: contain; }

.aisa-steps__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--aisa-ink-2); }
.aisa-steps__text strong { font-size: 18px; line-height: 26px; font-weight: 700; }
.aisa-steps__text > span { font-size: 16px; line-height: 24px; }

/* Bottom group: outlined upload, filled selfie, then the reassurance line. */
.aisa-capture { display: flex; flex-direction: column; gap: 16px; align-items: center; flex: none; }
.aisa-capture__actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.aisa-capture__note {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  color: #818284;               /* Text/Light Gray */
  text-align: center;
}

@media (max-width: 900px) {
  .aisa-steps li { gap: 14px; }
  .aisa-steps__icon { width: 64px; height: 64px; }
  .aisa-steps__text strong { font-size: 16px; line-height: 24px; }
  .aisa-steps__text > span { font-size: 15px; line-height: 22px; }
  .aisa-capture__note { font-size: 15px; line-height: 22px; }
}

/*
 * The design is 860px tall. On a shorter viewport the panel caps at 92vh and
 * the third step falls below the scroll fold, which hides a third of the
 * explanation. Tighten the rhythm rather than let it be scrolled past.
 */
@media (min-width: 901px) and (max-height: 900px) {
  .aisa-steps { gap: 16px; }
  .aisa-steps__icon { width: 80px; height: 80px; }
  .aisa-step--split .aisa-pane { padding: 40px 48px; gap: 16px; }
  .aisa-step--split .aisa-title { font-size: 28px; line-height: 36px; }
  .aisa-steps__text > span { font-size: 15px; line-height: 22px; }
  .aisa-capture__note { font-size: 16px; line-height: 22px; }
  .aisa-btn { padding: 16px 24px; }
}


/* ==========================================================================
   Camera framing guide
   ========================================================================== */

.aisa-guide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.aisa-guide[hidden] { display: none; }

/*
 * The dim outside the oval is one element: a huge box-shadow spread from the
 * oval itself, so there is no second overlay to keep in sync and no mask
 * support to depend on.
 */
/* Sized from height too, so it can never grow past the frame it sits in. */
.aisa-guide__oval {
  height: 78%;
  aspect-ratio: 3 / 4;
  width: auto;
  max-width: 76%;
  border: 3px solid rgba(255, 255, 255, .95);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(12, 14, 18, .45);
}

.aisa-guide__hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

/*
 * Size the stage from its HEIGHT so the 3:4 portrait ratio survives. Setting a
 * width and clamping with max-height instead let the box flatten into a
 * landscape frame, which is the wrong shape for a face.
 */
.aisa-stage {
  height: min(52vh, 440px);
  aspect-ratio: 3 / 4;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}


/* The camera notice is the answer to a click, so it reads as a notice - not as
   fine print under the buttons. */
.aisa-note--camera {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--aisa-notice-bg);
  color: var(--aisa-ink-2);
  font-size: 15px;
  line-height: 22px;
  text-align: left;
}
.aisa-note--camera.is-flagged { animation: aisa-flag .45s ease; }

@keyframes aisa-flag {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-4px); }
  55%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .aisa-note--camera.is-flagged { animation: none; outline: 2px solid var(--aisa-accent); outline-offset: 2px; }
}


/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 640px) {
  /*
   * One scroll model on a phone: the sheet fills the screen and never scrolls
   * itself; the media strip is fixed; the text column is the only scroller;
   * the actions stick to its bottom edge. Restated against the split-step
   * selector because that carries higher specificity than the base panel rule,
   * so the earlier full-bleed declaration never reached the designed screens.
   *
   * Width is 100% of the fixed-position root, not 100vw - 100vw includes the
   * scrollbar and left a 15px sliver of backdrop down one side.
   */
  /*
   * A gutter all round rather than full bleed, and the root scrolls so a step
   * taller than the screen can still be reached from its very top.
   *
   * The sheet takes its height from its content. It used to carry a
   * min-height of very nearly the viewport so a short step would not float as
   * a small card on a dark backdrop - but the steps here are mostly shorter
   * than a phone screen, so what that actually produced was a band of empty
   * white under the last button on every one of them.
   */
  .aisa-root {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .aisa-root:has(.aisa-step--split:not([hidden])) .aisa-panel,
  .aisa-panel {
    width: auto;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: var(--aisa-panel-top) var(--aisa-panel-gutter) var(--aisa-panel-bottom);
    border-radius: 24px;
    overflow: hidden;
  }

  /*
   * The backdrop stays. Hiding it was what made the modal look like the whole
   * site - there was nothing behind the panel to say otherwise. Fixed, not
   * absolute, so it covers the viewport while the root scrolls under it.
   */
  .aisa-backdrop { display: block; position: fixed; inset: 0; }
  .aisa-body { height: auto; }

  .aisa-step--split {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .aisa-media { flex: none; height: 180px; }
  .aisa-media__bar { height: 60px; padding: 0 20px; font-size: 14px; }
  .aisa-media__icon { width: 20px; height: 20px; }
  .aisa-mediaback { top: 12px; left: 12px; }

  /*
   * flex:none and no scroller of its own. Growing the pane was what pushed the
   * sheet to full height, and a scroller inside a sheet that the root also
   * scrolls gives a fifty-fifty chance the wrong one moves under a thumb.
   */
  .aisa-pane,
  .aisa-step--split .aisa-pane {
    flex: none;
    min-height: 0;
    overflow: visible;
    padding: 20px 20px 0;
    gap: 16px;
  }
  /*
   * Matched against .aisa-step--split .aisa-pane__body, which sets flex:1 0 auto
   * at (0,2,0) for the desktop two-column layout. A bare .aisa-pane__body here
   * is (0,1,0) and lost, so the body was squeezed to 254px while its content
   * measured 429px - and with overflow visible it painted straight over the
   * consent boxes below it.
   *
   * flex:none rather than the desktop grow: on a phone the copy should sit
   * directly above the gate, not be stretched away from it.
   */
  .aisa-step--split .aisa-pane__body { flex: none; }

  /*
   * No sticky action rail. Pinning the consents and the CTA to the bottom of
   * the scrolling column put opaque blocks on top of the notice they refer to,
   * so the text they gate was half hidden behind them. A phone sheet scrolls
   * naturally instead: the gate and the CTA sit together at the end of the
   * copy, which is where someone reading it arrives anyway.
   */
  .aisa-step--split .aisa-consents { padding: 4px 0; }
  .aisa-step--split > .aisa-pane > .aisa-ctas { margin-bottom: 20px; }
  .aisa-capture { padding-bottom: 20px; }

  .aisa-step--split .aisa-title { font-size: 22px; line-height: 30px; }
  .aisa-notice { padding: 18px; border-radius: 14px; }
  .aisa-notice__body { font-size: 15px; line-height: 22px; }
}


/* ==========================================================================
   Live camera (Figma node 7461:8865)
   ========================================================================== */

/* This screen owns the whole panel: black ground, no white chrome around it. */
.aisa-root:has(.aisa-step--camera:not([hidden])) .aisa-panel {
  width: min(720px, calc(100vw - 32px));
  height: min(92vh, 800px);
  background: #000;
  border-radius: 20px;
  overflow: hidden;
}
.aisa-root:has(.aisa-step--camera:not([hidden])) .aisa-close--float { display: none; }
.aisa-root:has(.aisa-step--camera:not([hidden])) .aisa-body { height: 100%; padding: 0; }

.aisa-step.aisa-step--camera:not([hidden]) {
  height: 100%;
  padding: 0;
  max-width: none;
  display: grid;
  place-items: center;
  background: #000;
}

.aisa-cam {
  display: flex;
  flex-direction: column;
  align-items: flex-end;   /* the close button sits above the frame's right edge */
  gap: 12px;
  width: min(480px, calc(100vw - 48px));
}

.aisa-cam__close {
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  flex: none;
}
.aisa-cam__close img { width: 100%; height: 100%; display: block; }
.aisa-cam__close:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 50%; }

.aisa-cam__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 480 / 600;
  border-radius: 20px;
  background: #14161a;
  /* Room for the shutter, which straddles the bottom edge. */
  margin-bottom: 40px;
}
.aisa-cam__frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  display: block;
  transform: scaleX(-1);   /* mirror the preview only; the capture is unflipped */
}

/*
 * 80px, centred on the frame's bottom edge: half inside, half below, matching
 * the design's 560px offset on a 600px frame.
 */
.aisa-shutter {
  position: absolute;
  left: 50%;
  bottom: -40px;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  border: 0;
  border-radius: 50%;
  background: #FB0A0A;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.aisa-shutter::before {
  /* Camera glyph: body plus lens, drawn rather than shipped as an image. */
  content: "";
  width: 34px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 6px;
  box-shadow: 0 -6px 0 -3px #fff inset;
}
.aisa-shutter::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 3px solid #fff;
  border-radius: 50%;
  margin-top: 2px;
}
.aisa-shutter:hover { background: #e00808; }
.aisa-shutter:active { transform: translateX(-50%) scale(.94); }
.aisa-shutter:disabled { opacity: .6; cursor: wait; }
.aisa-shutter:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/*
 * The guide overlays the camera frame. Sized to sit above the hint pill, which
 * in turn sits above the shutter - three overlays stacked in one frame, so each
 * one has to clear the next rather than be layered on top of it.
 */
.aisa-cam__frame .aisa-guide__oval { height: 62%; margin-bottom: 56px; }

@media (max-width: 640px) {
  /*
   * The camera is the exception. It is a viewfinder, and a gutter round it
   * just shrinks the thing the visitor is trying to line their face up in.
   */
  .aisa-root:has(.aisa-step--camera:not([hidden])) .aisa-panel {
    width: 100%; height: 100%; min-height: 0; margin: 0; border-radius: 0;
  }
  .aisa-root:has(.aisa-step--camera:not([hidden])) { overflow-y: hidden; }
  .aisa-cam { width: calc(100vw - 32px); }
  .aisa-cam__close { width: 48px; height: 48px; }
  .aisa-shutter { width: 72px; height: 72px; bottom: -36px; }
  .aisa-cam__frame { margin-bottom: 36px; }
}


/* The shutter straddles the frame's bottom edge, so the hint has to clear it
   rather than sit at the frame's foot where it lands underneath. */
.aisa-cam__frame .aisa-guide__hint { bottom: 74px; }

/* A cleaner camera glyph: body with a viewfinder bump, plus a lens. */
.aisa-shutter::before {
  width: 32px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 5px;
  box-shadow: none;
}
.aisa-shutter::after {
  width: 11px;
  height: 11px;
  border: 3px solid #fff;
  border-radius: 50%;
  margin-top: 1px;
}


/* ==========================================================================
   Result (Figma node 7477:2563)
   ========================================================================== */

.aisa-root:has(.aisa-step--result:not([hidden])) .aisa-panel {
  width: min(1200px, calc(100vw - 40px));
  height: min(92vh, 884px);
  background: #041E42;              /* Brand/Secondary */
  border-radius: 40px;
  overflow: hidden;
}
.aisa-root:has(.aisa-step--result:not([hidden])) .aisa-body { height: 100%; padding: 0; }
.aisa-root:has(.aisa-step--result:not([hidden])) .aisa-close--float { filter: invert(1); }

/*
 * Qualified with .aisa-step to reach (0,2,0). The generic
 * .aisa-step:not(.aisa-step--split) rule caps plain steps at 620px, and this
 * screen is 1200 wide - at (0,1,0) the cap won and squeezed the whole layout.
 */
.aisa-step.aisa-step--result:not([hidden]) {
  height: 100%;
  max-width: none;
  padding: 48px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  overflow-y: auto;
  color: #fff;
}

.aisa-result__title {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 52px);
  line-height: 1.23;
  font-weight: 400;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
}

/*
 * Fills whatever height the panel has left after the title. It used to be a
 * fixed 600px capped at 58vh inside a 92vh panel, which left a band of empty
 * navy under the card on every screen tall enough to show it.
 *
 * min-height keeps it from collapsing on a short viewport - below that the
 * step scrolls instead, which is the honest failure.
 */
.aisa-result__row {
  display: grid;
  grid-template-columns: 440fr 600fr;
  gap: 20px;
  width: 100%;
  max-width: 1060px;
  flex: 1 1 auto;
  min-height: 320px;
}

.aisa-result__photo {
  margin: 0;
  border-radius: 40px;
  overflow: hidden;
  background: #0b2c56;
}
.aisa-result__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.aisa-result__card {
  background: #fff;
  border-radius: 40px;
  padding: 40px;
  overflow: hidden;
  min-width: 0;
}

/* The card scrolls internally; the design draws its own scrollbar. */
.aisa-result__scroll {
  height: 100%;
  overflow-y: auto;
  /* Belt and braces with the scrollTop reset in renderResult: stop the browser
     compensating for content inserted above the current position at all. */
  overflow-anchor: none;
  /* Gutter for the bar plus a little air. Sized against --aisa-scroll-size:
     at the old 22px the 8px bar sat in a channel wide enough for two. */
  padding-right: calc(var(--aisa-scroll-size) + 8px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/*
 * The scroller is a fixed-height flex column, so its children would otherwise
 * shrink to fit rather than overflow - which silently crushes the report and
 * the card instead of letting the scrollbar do its job.
 */
.aisa-result__scroll > * { flex: none; }

.aisa-result__fields { display: flex; flex-direction: column; gap: 24px; }

.aisa-result__section { display: flex; flex-direction: column; gap: 12px; }
.aisa-result__section h3 {
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid #E3E6EA;
  font-size: clamp(20px, 2vw, 32px);
  line-height: 1.25;
  font-weight: 600;
  color: var(--aisa-accent);
  opacity: .8;
}
.aisa-result__text { margin: 0; font-size: 18px; line-height: 26px; color: #23201F; }

.aisa-findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.aisa-findings li { display: flex; gap: 8px; align-items: flex-start; }
.aisa-finding__icon { width: 26px; height: 26px; flex: none; }
.aisa-findings p { margin: 0; font-size: 18px; line-height: 26px; color: #23201F; }
.aisa-findings strong { font-weight: 700; }

.aisa-step--result .aisa-section-label { color: #9DB4CE; }
.aisa-step--result .aisa-service { background: rgba(255, 255, 255, .08); }
.aisa-step--result .aisa-service__link { color: #fff; }
.aisa-step--result .aisa-service__link strong { color: #fff; }
.aisa-step--result .aisa-service__link span { color: #C6D3E2; }
.aisa-step--result .aisa-service__link:hover { background: rgba(255, 255, 255, .06); }
.aisa-step--result .aisa-footer { border-top-color: rgba(255, 255, 255, .18); }
.aisa-step--result .aisa-footer h3 { color: #fff; }
.aisa-step--result .aisa-footer p { color: #C6D3E2; }
.aisa-btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.aisa-btn--ghost:hover { background: rgba(255, 255, 255, .1); }

/*
 * ...but the actions moved inside the white report card, where white on white
 * is invisible. Scoped rather than redefined, so a ghost button anywhere on
 * the dark ground keeps its original treatment.
 */
.aisa-result__scroll .aisa-btn--ghost { color: var(--aisa-accent); border-color: var(--aisa-accent); }
.aisa-result__scroll .aisa-btn--ghost:hover { background: rgba(50, 98, 149, .08); }

/* ==========================================================================
   Retake / face-not-detected (Figma node 7538:2043)
   ========================================================================== */

/*
 * Split steps default to 840px tall. This screen has less content, so cap
 * lower and keep the right column content vertically centered.
 */
.aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
  height: min(560px, 85vh);
}

.aisa-step--retake .aisa-media--retake {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aisa-step--retake .aisa-media--retake .aisa-media__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.aisa-step--retake .aisa-pane {
  position: relative;
  gap: 32px;
  justify-content: center;
}
/* Keep the close control out of the flex flow so the copy stays centered. */
.aisa-step--retake .aisa-pane__head {
  position: absolute;
  top: 24px;
  right: 24px;
  margin: 0;
  z-index: 1;
}
.aisa-step--retake .aisa-pane__body {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.aisa-step--retake .aisa-capture {
  flex: none;
  align-items: stretch;
  width: 100%;
}
.aisa-step--retake .aisa-title--retake {
  margin: 0;
  font-size: 42px;
  line-height: 54px;
  font-weight: 400;
  color: var(--aisa-accent);
  text-transform: capitalize;
  white-space: pre-line;
}
.aisa-step--retake .aisa-prose--retake {
  margin: 0;
  font-size: 18px;
  line-height: 26px;
  color: #47484C;
  white-space: pre-line;
}
.aisa-step--retake .aisa-capture__actions {
  width: 100%;
}
.aisa-step--retake .aisa-capture__note {
  text-align: center;
  color: #818284;
}

@media (max-width: 900px) {
  .aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
    height: min(100vh, 720px);
  }
  .aisa-step--retake .aisa-media--retake {
    min-height: 180px;
    max-height: 220px;
  }
  .aisa-step--retake .aisa-media--retake .aisa-media__img {
    object-fit: contain;
  }
  .aisa-step--retake .aisa-title--retake {
    font-size: 26px;
    line-height: 34px;
  }
  .aisa-step--retake .aisa-prose--retake {
    font-size: 16px;
    line-height: 24px;
  }
  .aisa-step--retake .aisa-pane {
    gap: 24px;
  }
  .aisa-step--retake .aisa-pane__head {
    top: 16px;
    right: 16px;
  }
}

@media (min-width: 901px) and (max-height: 900px) {
  .aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
    height: min(500px, 85vh);
  }
  .aisa-step--retake .aisa-title--retake {
    font-size: 32px;
    line-height: 40px;
  }
  .aisa-step--retake .aisa-pane {
    gap: 24px;
  }
}

@media (max-width: 900px) {
  /*
   * The root is the scroller at these widths, and its bar is hidden rather
   * than styled.
   *
   * A bar there takes width off one side, so the panel sat 20px from the left
   * and 31px from the right on exactly the steps whose content overflowed -
   * the modal shifted sideways as the visitor moved through the flow.
   * Reserving the gutter on both edges squared it up but widened every margin
   * to 31px and cost the camera its full bleed, since the gutter is reserved
   * even under overflow:hidden.
   *
   * Hiding it gives the asked-for 20px on every step, and costs nothing on a
   * real phone, where scrollbars are overlays that take no width at all. The
   * report card keeps its own styled bar.
   */
  .aisa-root { scrollbar-width: none; }
  .aisa-root::-webkit-scrollbar { width: 0; height: 0; }

  /*
   * Qualified to (0,3,0) to match the base rule. At a plain .aisa-step--result
   * this lost to .aisa-step.aisa-step--result:not([hidden]) and the desktop
   * 48px/60px padding survived all the way down to a 360px phone.
   */
  .aisa-step.aisa-step--result:not([hidden]) { padding: 28px 20px 32px; gap: 20px; }
  .aisa-result__row {
    grid-template-columns: 1fr;
    flex: none;
    min-height: 0;
  }

  /*
   * A selfie is portrait. Boxed at a fixed 260px tall the crop threw away the
   * face and kept the background, so the frame keeps a portrait ratio and is
   * capped in viewport terms instead.
   */
  .aisa-result__photo {
    width: min(100%, 260px);
    height: auto;
    aspect-ratio: 4 / 5;
    max-height: 40vh;
    margin-inline: auto;
    border-radius: 24px;
  }

  .aisa-result__card { border-radius: 24px; padding: 24px; }

  /*
   * One scroll region, not two. The step already scrolls at this width, and a
   * card scrolling inside a scrolling step gives two scrollbars and a
   * fifty-fifty chance the wrong one moves.
   */
  .aisa-result__scroll {
    height: auto;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  /*
   * Full bleed, and no 92vh cap from the base panel rule - but NOT flush to
   * the top.
   *
   * Pinned at height:100% the report had nowhere to put its heading: on a
   * phone the browser chrome eats into the fixed root, and "YOUR SKIN PROFILE"
   * was sliced in half against the top edge with no way to scroll up to it,
   * because the only scroller was inside the panel.
   *
   * So the panel starts below a margin, takes its natural height, and the ROOT
   * scrolls. The whole modal can now be scrolled from its very top, and the
   * margin doubles as somewhere to tap to dismiss.
   */
  .aisa-root:has(.aisa-step--result:not([hidden])) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .aisa-root:has(.aisa-step--result:not([hidden])) .aisa-panel {
    width: auto;
    height: auto;
    /* Natural height, which is what the note above describes - the floor that
       used to sit here contradicted it. */
    min-height: 0;
    max-height: none;
    margin: var(--aisa-panel-top) var(--aisa-panel-gutter) var(--aisa-panel-bottom);
    border-radius: 24px;
  }

  /*
   * The step no longer scrolls: the root does. Two nested scrollers give a
   * fifty-fifty chance the wrong one moves, and the outer one is the only one
   * that can reveal the heading.
   */
  .aisa-step.aisa-step--result:not([hidden]) {
    height: auto;
    overflow-y: visible;
  }

}


/* ---- recommended treatment: the last block inside the report card ---- */

.aisa-recommend { display: flex; flex-direction: column; gap: 12px; }
.aisa-recommend[hidden] { display: none; }

/* Matches the section headings it follows, so it reads as one more heading
   in the report rather than as a separate panel. */
.aisa-recommend__label {
  padding-bottom: 12px;
  border-bottom: 1px solid #E3E6EA;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--aisa-accent);
  font-weight: 700;
}

/*
 * The raised box. White on white, so the shadow is the only edge it has -
 * hence a hairline as well, which survives on displays and print styles that
 * flatten shadows away.
 */
.aisa-recommend__card {
  border: 1px solid #EDEFF2;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(4, 30, 66, .12), 0 1px 3px rgba(4, 30, 66, .08);
}

/*
 * The picture and the name are the links, not the box. Two named targets,
 * both reaching the same page, leave the button below them clickable and the
 * rest of the card as inert ground.
 */
.aisa-recommend__imglink { display: block; }
.aisa-recommend__namelink { text-decoration: none; color: inherit; }
.aisa-recommend__namelink:hover .aisa-recommend__name,
.aisa-recommend__namelink:focus-visible .aisa-recommend__name { color: var(--aisa-accent); }
.aisa-recommend__imglink:focus-visible,
.aisa-recommend__namelink:focus-visible {
  outline: 2px solid var(--aisa-accent);
  outline-offset: 2px;
}

/* The treatment button, under the details it belongs to. */
.aisa-recommend__cta { margin-top: 6px; width: 100%; }

/* Image on top, at a fixed ratio so two treatments' photos - one portrait,
   one landscape - still present at the same height. */
.aisa-recommend__img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #E0E7EF;
}

/* Details below the image. */
.aisa-recommend__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 18px;
  min-width: 0;
}
.aisa-recommend__name {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: #041E42;
}
.aisa-recommend__excerpt {
  margin: 0;
  font-size: 15px;
  line-height: 23px;
  color: #58585A;
}

/* The CTA is an anchor, so it needs the button's own layout explicitly. */
a.aisa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}
a.aisa-btn[hidden] { display: none; }

@media (max-width: 640px) {
  .aisa-recommend__body { padding: 14px 16px 16px; }
  .aisa-recommend__name { font-size: 18px; line-height: 26px; }
  .aisa-recommend__excerpt { font-size: 14px; line-height: 21px; }
}

/* ---------------------------------------------------------------------------
   Scored categories and the treatments they earn.

   Each row is text on the left, a star rating on the right. Severity is carried
   on the row and read by the stars through a custom property, so the whole row
   recolours from one place.

   1 is the bad end of this scale, so --attn is the LOW scorer.
   --------------------------------------------------------------------------- */

.aisa-result__section--bare { gap: 0; }

.aisa-cats { list-style: none; margin: 0; padding: 0; }

.aisa-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.aisa-cat:last-child { border-bottom: 0; }

.aisa-cat--good { --aisa-cat-tone: #4a8f6b; }
.aisa-cat--fair { --aisa-cat-tone: #c08a2e; }
.aisa-cat--attn { --aisa-cat-tone: #b4543f; }

/* min-width:0 lets a long note wrap instead of shoving the stars off the row. */
.aisa-cat__text { min-width: 0; flex: 1 1 auto; }

/*
 * Both colours are stated outright. Inheriting them is what made these rows
 * invisible: the row sets --aisa-cat-tone for the stars but no text colour, so
 * the label and note took whatever the surrounding card happened to be.
 */
.aisa-cat__label {
  display: block;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: #23201F;
}

.aisa-cat__note {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--aisa-ink-2);
}

/* Stars and their band label ride together, right-aligned against the text. */
.aisa-cat__rating {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.aisa-cat__stars {
  display: inline-flex;
  gap: 2px;
  line-height: 1.2;
  white-space: nowrap;
}

.aisa-cat__band {
  font-size: .78em;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--aisa-cat-tone, #666);
}

.aisa-star { color: rgba(0, 0, 0, .16); }
.aisa-star.is-on { color: var(--aisa-cat-tone, #c08a2e); }

@media (max-width: 420px) {
  /* Stars drop under the text rather than squeezing the note to one word. */
  .aisa-cat { flex-direction: column; gap: 6px; }
  .aisa-cat__rating { align-items: flex-start; flex-direction: row; gap: 8px; }
}

.aisa-treatments { display: grid; gap: 12px; margin-top: 18px; }

.aisa-treatment {
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 10px;
  background: #fff;
  /* The picture is clipped to the card's corners rather than given its own
     radius, so the top of the card is one shape and not a photo with rounded
     corners floating inside a rounded box. */
  overflow: hidden;
}

/* Padding lives here, not on the card - that is what lets the picture above
   run edge to edge instead of sitting inside a white border. */
.aisa-treatment__body { padding: 14px 16px; }

.aisa-treatment__imglink {
  display: block;
  /* A held aspect keeps three cards the same shape whether the clinic uploaded
     a portrait, a landscape or a square. */
  aspect-ratio: 16 / 9;
  background: var(--aisa-line);
}

.aisa-treatment__img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/*
 * The name is the thing being offered, so it is set at heading weight and
 * carries the accent - the same treatment the single-service card gives its
 * title. The description is deliberately a step down in size and colour so the
 * two never read as equals.
 */
.aisa-treatment__name {
  display: block;
  font-size: 20px;
  line-height: 27px;
  font-weight: 700;
  color: var(--aisa-accent);
  text-decoration: none;
}
a.aisa-treatment__name:hover { text-decoration: underline; }

.aisa-treatment__desc {
  margin: 6px 0 14px;
  font-size: 14px;
  line-height: 21px;
  color: var(--aisa-ink-2);
}

/* The card is not itself a link, so the button needs its own hit area. */
.aisa-treatment__cta { display: inline-block; }

@media (max-width: 767px) {
  .aisa-treatment__cta { display: block; width: 100%; text-align: center; }

  .aisa-treatment__body { padding: 12px; }
}

/*
 * The closing disclaimer. Quieter than the findings and separated from them by
 * a rule, so it reads as a footnote to the report rather than another section
 * of it - but it sits directly above the call to action, where it is the last
 * thing seen before the visitor acts.
 */
.aisa-result__disclaimer {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #E3E6EA;
  font-size: 13px;
  line-height: 19px;
  color: var(--aisa-ink-2);
}

/*
 * Phone-only controls in the results actions row.
 *
 * display:none rather than the hidden attribute or visibility, so the control
 * leaves the accessibility tree entirely on a desktop - a button a pointer
 * cannot see but a screen reader announces is worse than no button.
 *
 * It is also removed from the DOM when Scan Again has no link (see
 * scanAgainTarget in panel.js), so this rule only ever governs the case where
 * the button genuinely belongs on the row.
 */
.aisa-actions__phone-only { display: none; }

@media (max-width: 640px) {
  /*
   * Stacked, so Retake reads as sitting UNDER the enquiry link rather than
   * beside it - flex-wrap would put them side by side whenever both happen to
   * fit, which is most phones in landscape.
   */
  .aisa-actions { flex-direction: column; }
  .aisa-actions .aisa-btn { flex: 0 0 auto; width: 100%; }
  .aisa-actions__phone-only { display: block; }
}

/*
 * Cloudflare Turnstile, above the capture buttons.
 *
 * The widget is a fixed-size iframe Cloudflare owns, so there is nothing to
 * style inside it - this only reserves its place in the column and keeps it
 * from stretching under the flex rules the capture block uses.
 */
.aisa-turnstile {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  /* Holds the row height before the iframe arrives, so the buttons do not jump
     down the moment it renders. */
  min-height: 65px;
}
.aisa-turnstile[hidden] { display: none; }

/*
 * A capture button waiting on the check. Clearly inert rather than merely
 * greyed: a visitor who cannot tell a button is disabled just clicks it again.
 */
.aisa-capture__actions .aisa-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* ==========================================================================
   Modal top bar - the navy band the error screens wear
   Figma 7635:6644 (desktop) / 7635:6104 (mobile), shown on 7635:6110 / 7635:5835
   ========================================================================== */

/*
 * Last in the file on purpose: every rule below competes with one of the split
 * or retake rules above at identical specificity - `.aisa-root:has(.x:not([hidden])) .y`
 * is (0,4,0) either way - so source order is what decides, and the bar has to
 * be the one that wins.
 *
 * This lived in its own stylesheet while the report page wore the same bar.
 * The report page does not any more, so it is back here with its one consumer
 * - which also retires the `.aisa-panel >` guard that existed purely to make
 * the override independent of which of the two sheets loaded first.
 */

.aisa-topbar {
  /* Raised only by the two error screens, below. */
  display: none;
  align-items: center;
  gap: 20px;
  flex: none;
  padding: 16px 30px 16px 50px;
  background: var(--aisa-navy);
  box-shadow: var(--aisa-shadow);
  /* The modal is a card, so the bar sits flush in its rounded top corners. */
  border-radius: var(--aisa-radius) var(--aisa-radius) 0 0;
  /* Above what follows, so the shadow falls on the content rather than under it. */
  position: relative;
  z-index: 1;
}

.aisa-topbar__logo { flex: none; width: 70px; height: 50px; display: block; }

.aisa-topbar__title {
  flex: 1;
  min-width: 0;
  color: #fff;
  font-size: 30px;
  line-height: 38px;
  font-weight: 600;
  /*
   * The design token says capitalize; this does not apply it. The string is
   * already capitalised at the source, so the rendered result is identical -
   * but it is an editable field, and `capitalize` would turn an admin's "AI"
   * into "Ai". Letting the typed text through costs nothing and breaks nothing.
   */
}

.aisa-topbar__close {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: opacity .15s ease;
}
.aisa-topbar__close img { width: 100%; height: 100%; display: block; }
.aisa-topbar__close:hover { opacity: .75; }
.aisa-topbar__close:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* The phone's smaller draw of the same bar: 72px tall rather than 82px. */
@media (max-width: 900px) {
  .aisa-topbar {
    gap: 10px;
    padding: 16px 20px;
  }
  .aisa-topbar__logo { width: 57px; height: 40px; }
  .aisa-topbar__title { font-size: 22px; line-height: 30px; }
  .aisa-topbar__close { width: 30px; height: 30px; }
}

.aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-topbar,
.aisa-root:has([data-aisa-step="error"]:not([hidden])) .aisa-topbar {
  display: flex;
}

/*
 * The bar carries the close now, so the floating one would be a second,
 * smaller X a few pixels away. Split steps already stand it down; this covers
 * the plain error screen, which does not.
 */
.aisa-root:has([data-aisa-step="error"]:not([hidden])) .aisa-close--float {
  display: none;
}

/*
 * The split rules give .aisa-body the full height of the panel. That was right
 * when the body was the panel's only child; with the bar above it the two
 * together overflow by exactly the bar's height, and the panel clips the foot
 * of the pane - the reassurance note - without a scrollbar to say so.
 */
.aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-body {
  height: auto;
  flex: 1;
  min-height: 0;
}

/* 82px bar + 558px pane = the 640px the design draws. */
.aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
  height: min(640px, 92vh);
}

@media (min-width: 901px) and (max-height: 900px) {
  .aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
    height: min(582px, 92vh);
  }
}

/*
 * Tablets get no panel height of their own. The 640px above is stated outside
 * any query, so it governs them too, and that is wanted: it is the height the
 * design draws, and it fits the content without the ~100px of white the 720px
 * pin that band used to carry left under the note. Short viewports are already
 * held by .aisa-panel's own max-height of min(92vh, 840px), which caps both
 * numbers to the same value well before either could overflow.
 */

/*
 * Phones. The panel is inset with a 24px radius here, not full-bleed, so the
 * bar keeps its rounded top rather than squaring off against nothing.
 *
 * The height goes back to the content. Every other screen at this width is
 * already sized by what is in it; the retake screen was the one still pinned
 * to a flat 720px, which on a 375px phone left about 100px of white below the
 * reassurance note. Nothing about the bar requires this - it is the same rule
 * the rest of the panel follows, finally reaching the screen that missed it.
 */
@media (max-width: 640px) {
  .aisa-root:has(.aisa-step--retake:not([hidden])) .aisa-panel {
    height: auto;
  }
}

/* ==========================================================================
   Legal links - inside the consent labels
   ========================================================================== */

/*
 * No row of its own in the panel: these anchors are woven into the consent
 * labels, where the copy already names the documents. Only the link needs
 * styling - it inherits the label's size and colour and marks itself out by
 * being underlined, which is what a link inside a sentence should do.
 */
.aisa-legal__link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.aisa-legal__link:hover { color: var(--aisa-accent); }

/* ==========================================================================
   The intro screen's pair of buttons (Figma 7609:3583)
   ========================================================================== */

/*
 * Wrapped so the two keep their own 10px rather than inheriting the pane's
 * 20px gap. The second one is the sample report: an anchor, and outside the
 * consent gate, because it runs no scan and there is nothing to agree to.
 */
.aisa-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: none;
}
.aisa-ctas .aisa-btn { width: 100%; }
