/* Finesse assistant preview. Uses the site's own tokens (styles.css); loaded only on private preview pages. */
/* CP48 dock: one slim opaque rail across the bottom of the viewport holds the two pills, Call at the left and AI at the
   right (assistant.js; app.js and the static 404 page share it). It is styled here because this stylesheet is
   render-blocking on every page, so the rail is never painted unstyled. It stays in view while the page scrolls; it is
   hidden while the mobile navigation is open and in print. --fc-dock-h is its measured height (assistant.js), with this
   fallback until the first measure; --fc-dock-lift is the part an on-screen keyboard covers (0 otherwise). The padding
   takes the bottom safe area once; everything that clears the rail uses --fc-band, never a second inset. */
:root {
  --fc-dock-h: calc(65px + env(safe-area-inset-bottom, 0px));
  --fc-dock-lift: 0px;
  --fc-band: calc(var(--fc-dock-h) + var(--fc-dock-lift));
}
.fc-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--fc-dock-lift);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-sizing: border-box;
  padding: 8px max(20px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line-strong, rgba(12, 12, 12, .32));
  background: var(--paper, #F2EFE8);
}
body.nav-locked .fc-dock { display: none; }
@media (max-width: 640px) {
  .fc-dock { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}
/* The Call pill (its hover, tooltip and touch states are in styles.css §40). */
.fc-fab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-width: 48px;
  min-height: 48px;
  height: 48px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--amber, #E2A23B);
  border-radius: 999px;
  background: var(--ink-bg, #1A1A1A);
  color: var(--paper, #F2EFE8);
  font: 600 15px/1 var(--font-sans, Arial, sans-serif);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fc-fab svg { display: block; flex: none; width: 22px; height: 22px; fill: var(--paper, #F2EFE8); pointer-events: none; }
.fc-fab__label { display: block; white-space: nowrap; }
.fc-fab:focus-visible { outline: 2px solid transparent; outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--paper, #F2EFE8), 0 0 0 6px var(--amber, #E2A23B), 0 6px 18px rgba(0, 0, 0, .18); }
/* CP48: the AI pill, with the Call pill's geometry. */
.fa-launch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-width: 48px;
  min-height: 48px;
  height: 48px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--amber, #E2A23B);
  border-radius: 999px;
  background: var(--ink-bg, #1A1A1A);
  color: var(--paper, #F2EFE8);
  font: 600 15px/1 var(--font-sans, Arial, sans-serif);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* CP48: a 22px inline chat bubble (paper, with ink dots) and the visible label "AI", matching the Call pill. */
.fa-launch__icon { display: block; flex: none; width: 22px; height: 22px; fill: var(--paper, #F2EFE8); pointer-events: none; }
.fa-launch__icon circle { fill: var(--ink-bg, #1A1A1A); }
.fa-launch__label { display: block; white-space: nowrap; }
.fa-launch[aria-busy="true"] { cursor: progress; }
.fa-launch:focus-visible { outline: 2px solid transparent; outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--paper, #F2EFE8), 0 0 0 6px var(--amber, #E2A23B), 0 6px 18px rgba(0, 0, 0, .18); }
.fa-panel :focus-visible,
.fa-boot :focus-visible,
.fa-hub-ask:focus-visible { outline: 2px solid var(--amber-2, #C8862A); outline-offset: 2px; }
/* While the panel is open the AI opener is hidden in place (the Call pill stays); closing returns focus to it. */
body.fa-open .fa-launch { visibility: hidden; }

/* The panel and the loading box stand 8px above the rail and keep --fa-top clear for the header and the close button. */
.fa-panel {
  --fa-top: 88px;
  position: fixed;
  right: 20px;
  bottom: calc(var(--fc-band) + 8px);
  z-index: 9997;
  width: min(400px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--fc-band) - 8px - var(--fa-top));
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background: #F2EFE8;
  color: var(--ink, #15140f);
  border: 1px solid var(--line-strong, rgba(12, 12, 12, .32));
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  font: 400 15px/1.5 var(--font-sans, Arial, sans-serif);
}
.fa-panel[hidden] { display: none; }
/* CP48: one brief deliberate opening (opacity and an 8px rise, 180ms); it replays each time the panel is shown. */
.fa-panel:not([hidden]) { animation: fa-panel-in .18s var(--ease, ease); }
@keyframes fa-panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* CP48: provider attribution in the panel chrome, outside the live log, visible before Send. */
.fa-provider { flex-shrink: 0; margin: 0 16px 8px; font-size: 12px; line-height: 1.4; color: var(--ink-faint, #6A6354); }
.fa-provider[hidden] { display: none; }
.fa-head, .fa-notice, .fa-status, .fa-form, .fa-ended { flex-shrink: 0; }   /* the log scrolls or shrinks first; if these and its minimum still exceed max-height, the panel scrolls */
.fa-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 6px 16px; }
.fa-title { margin: 0; font: 600 18px/1.2 var(--font-display, Arial, sans-serif); color: inherit; }
.fa-close { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: transparent; color: inherit; cursor: pointer; }
.fa-close svg { width: 20px; height: 20px; }
.fa-notice { margin: 0 16px 8px; padding: 8px 10px; border-left: 3px solid var(--amber, #E2A23B);
  background: var(--paper-2, #E8E4D9); font-size: 13px; line-height: 1.45; color: var(--ink-soft, #2a2620); }
.fa-log { flex: 1 1 auto; min-height: 88px; overflow-y: auto; padding: 0 16px; overscroll-behavior: contain; }
/* CP48 dock: before the first message the empty log and the empty status line reserve no height, so the question box
   and Send sit directly under the notice. A populated log keeps its reserve and scrolling. */
.fa-log:empty { min-height: 0; }
.fa-log:empty + .fa-status:empty { min-height: 0; }
.fa-msg { margin: 10px 0; }
.fa-msg p { margin: 0 0 8px; overflow-wrap: anywhere; }
.fa-msg--visitor { text-align: right; }
.fa-msg--visitor p { display: inline-block; max-width: 85%; padding: 8px 12px; border-radius: 12px; text-align: left;
  background: var(--ink-bg, #1A1A1A); color: #F2EFE8; }
.fa-lead { font-size: 16px; font-weight: 400; }
.fa-caveat { padding: 6px 10px; border-left: 3px solid var(--amber, #E2A23B); background: #FBFAF6; }
.fa-msg p.fa-source { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-soft, #2a2620); }
.fa-source__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; margin: 0 0 4px; }
.fa-source__actions a, .fa-linkbtn { display: inline-flex; align-items: center; min-height: 44px; font: 600 14px/1.2 var(--font-sans, Arial, sans-serif); }
.fa-linkbtn { padding: 0; border: 0; background: none; color: var(--amber-text, #875A1C); text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer; }
.fa-msg p.fa-more__label { margin: 4px 0; font-weight: 600; }
.fa-more { margin: 0 0 8px; padding-left: 20px; }
.fa-more li { margin: 0 0 6px; overflow-wrap: anywhere; }
.fa-route--retired { border-style: dashed; background: transparent; }
.fa-msg p.fa-route__note { margin: 6px 0 0; font-size: 13px; color: var(--ink-faint, #6A6354); }
.fa-handoff { padding: 10px 12px; border: 1px solid var(--amber, #E2A23B); border-radius: 10px; background: #FFF6E8; }
.fa-msg .fa-handoff p { margin: 0 0 10px; }
.fa-notice.fa-notice--compact { padding: 4px 10px; }
/* CP42 S6 layered notice: four short sentences stay visible; the rest is one native disclosure, available before Send.
   An opened disclosure scrolls inside itself, so it never pushes the question box out of a short panel. */
.fa-notice__lead { margin: 0; }
.fa-notice__more { margin: 4px 0 0; }
.fa-notice__more summary { padding: 4px 0; font-weight: 600; cursor: pointer; }
.fa-notice__more p { margin: 2px 0 0; max-height: 30vh; overflow-y: auto; overscroll-behavior: contain; }
.fa-panel p.fa-notice__privacy { margin: 2px 0 0; }
.fa-restored { flex-shrink: 0; margin: 0 16px 8px; padding: 8px 10px; border: 1px dashed var(--amber, #E2A23B); border-radius: 10px;
  font-size: 13px; line-height: 1.45; }
.fa-restored[hidden] { display: none; }
.fa-detail, .fa-route { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--line, rgba(12, 12, 12, .14));
  border-radius: 10px; background: #FBFAF6; }
.fa-detail summary { min-height: 32px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.fa-detail p { margin: 8px 0 0; }
.fa-panel a { color: var(--amber-text, #875A1C); text-decoration: underline; text-underline-offset: 2px; }
.fa-route__who { margin-bottom: 6px; }
.fa-route__hours { font-size: 13px; color: var(--ink-faint, #6A6354); }
.fa-route__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
/* CP48: the ordinary company enquiry email, kept apart from the call/WhatsApp handoff buttons. */
.fa-route__email { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line, rgba(12, 12, 12, .14)); }
.fa-panel p.fa-route__email-label { margin: 0; font-size: 13px; color: var(--ink-soft, #2a2620); overflow-wrap: anywhere; }
.fa-route__email a { display: inline-flex; align-items: center; min-height: 44px; font: 600 14px/1.2 var(--font-sans, Arial, sans-serif); }
.fa-wa { margin-top: 10px; }
.fa-wa__label { display: block; margin-bottom: 6px; font-size: 13px; }
.fa-note { color: var(--ink-soft, #2a2620); }
.fa-error { padding: 8px 10px; border-left: 3px solid var(--amber-2, #C8862A); background: #FFF6E8; }
.fa-status { margin: 0; padding: 0 16px; min-height: 20px; font-size: 13px; color: var(--ink-faint, #6A6354); }
.fa-form { padding: 8px 16px 14px; border-top: 1px solid var(--line, rgba(12, 12, 12, .14)); }
.fa-input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong, rgba(12, 12, 12, .32));
  border-radius: 10px; background: #fff; color: inherit; font: inherit; font-size: 16px; resize: vertical; }
.fa-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
/* The new-session human check: the rendered widget only; an empty container takes no space. */
.fa-challenge { margin-top: 8px; }
.fa-challenge:empty { display: none; }
.fa-primary, .fa-secondary, .fa-hub-ask { min-height: 44px; padding: 0 16px; border-radius: 999px; font: 600 14px/1.2 var(--font-sans, Arial, sans-serif);
  cursor: pointer; }
.fa-primary { border: 1px solid var(--ink-bg, #1A1A1A); background: var(--ink-bg, #1A1A1A); color: #F2EFE8; }
.fa-secondary { border: 1px solid var(--line-strong, rgba(12, 12, 12, .32)); background: transparent; color: inherit; }
.fa-primary:disabled, .fa-secondary:disabled { opacity: .55; cursor: not-allowed; }
.fa-send { margin-left: auto; }
.fa-ended { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px 14px;
  border-top: 1px solid var(--line, rgba(12, 12, 12, .14)); }
.fa-ended[hidden] { display: none; }
.fa-ended__text { margin: 0; font-weight: 600; }
.fa-hub-ask { display: inline-flex; align-items: center; align-self: flex-start; justify-self: start; width: auto; max-width: 100%;
  margin-top: 12px; border: 1px solid var(--amber, #E2A23B); background: transparent; color: inherit; }
.fa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* CP42 S6: the inline loading / failure box shown above the launcher until the panel exists (never the panel itself). */
.fa-boot {
  position: fixed;
  right: 20px;
  bottom: calc(var(--fc-band) + 8px);
  z-index: 9997;
  width: min(320px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 12px 14px;
  background: #F2EFE8;
  color: var(--ink, #15140f);
  border: 1px solid var(--line-strong, rgba(12, 12, 12, .32));
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  font: 400 14px/1.45 var(--font-sans, Arial, sans-serif);
}
.fa-boot[hidden] { display: none; }
.fa-boot__text { margin: 0; }
.fa-boot__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-top: 10px; }
.fa-boot a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--amber-text, #875A1C);
  text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 480px) {
  .fa-panel { --fa-top: 76px; right: 12px; left: 12px; width: auto; }
  .fa-boot { right: 12px; left: 12px; width: auto; }
}
/* Short viewports (landscape phones): the fixed parts no longer fit the height-limited panel, so the panel uses the
   height above the rail and scrolls as a whole; the question box and Send stay reachable. */
@media (max-height: 600px) {
  .fa-panel { top: 12px; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
  .fa-log { flex: 0 0 auto; min-height: 0; overflow-y: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .fa-panel:not([hidden]) { animation: none; }
}
@media print {
  .fc-dock, .fa-launch, .fa-boot, .fa-panel { display: none !important; }
}

/* Actual-controller preview additions: the server-selected mode label, the server's separately labelled summary, the
   published worked-example table and the local WhatsApp review (visitor notes, confirmation). Existing tokens only. */
.fa-mode { flex-shrink: 0; margin: 0 16px 8px; font-size: 13px; color: var(--ink-faint, #6A6354); }
.fa-mode[hidden] { display: none; }
.fa-mode.fa-mode--preview { margin-top: -4px; }
.fa-discussion { margin: 8px 0; padding: 8px 10px; border: 1px dashed var(--line-strong, rgba(12, 12, 12, .32)); border-radius: 10px; }
.fa-msg p.fa-discussion__label, .fa-msg p.fa-detail__label { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.fa-table { width: 100%; margin: 6px 0; border-collapse: collapse; font-size: 13px; }
.fa-table th, .fa-table td { padding: 4px 6px; border: 1px solid var(--line, rgba(12, 12, 12, .14)); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.fa-review { padding: 10px 12px; border: 1px solid var(--amber, #E2A23B); border-radius: 10px; background: #FFF6E8; }
.fa-msg p.fa-review__title { font-weight: 600; }
.fa-msg p.fa-review__state { font-size: 13px; }
.fa-review__notes { margin: 0 0 8px; padding-left: 20px; }
.fa-review__notes li { margin: 0 0 6px; overflow-wrap: anywhere; }
.fa-review__notes p { margin: 0; }
.fa-review__confirm-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 0; }
.fa-review__confirm-row input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; }
.fa-review__confirm { font-size: 14px; }

/* CP26 S5: the optional visitor-stated project location / authority and the explicit re-ask action. Existing tokens only.
   CP48 dock: one native disclosure, closed at first; its summary row shows the current selection. */
.fa-scope-controls { margin-top: 8px; }
/* the native disclosure marker stays (as on the notice's own disclosure); the padding gives a 44px target */
.fa-scope-controls__summary { box-sizing: border-box; min-height: 44px; padding: 12px 0; font-size: 13px; font-weight: 600; line-height: 20px;
  color: var(--ink-soft, #2a2620); cursor: pointer; }
.fa-scope-controls[open] > .fa-scope-controls__summary { margin-bottom: 4px; }
.fa-scope__label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; }
.fa-scope__select { width: 100%; box-sizing: border-box; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-strong, rgba(12, 12, 12, .32));
  border-radius: 10px; background: #fff; color: inherit; font: inherit; font-size: 16px; }
.fa-scope__select:disabled { opacity: .55; cursor: not-allowed; }
.fa-panel p.fa-scope__help { margin: 4px 0 0; font-size: 12px; line-height: 1.4; color: var(--ink-faint, #6A6354); }
.fa-reask { margin: 8px 0; padding: 8px 10px; border: 1px dashed var(--amber, #E2A23B); border-radius: 10px; }
.fa-msg .fa-reask p { margin: 0 0 8px; font-size: 13px; }
.fa-secondary:disabled { opacity: .55; cursor: not-allowed; }
