/* ==========================================================================
   Flexable — Dashboard V2

   Loaded only by templates/chat-dashboard-v2.php. The live dashboard keeps
   styles/chat-dashboard.css, untouched.

   SCOPING: wp_head() also loads the theme's global stylesheets, which are not
   in this repo. Everything below is namespaced .fd-* and scoped under
   .flxb-dash so neither side can reach into the other, and custom properties
   use --fd-* rather than the generic names in the design file (--bg, --ink…)
   which would collide with whatever the theme already defines.

   Values are lifted from the Flexable-2 design and match the homepage tokens
   in home-v3-styles/base.css — same brand green, same charcoal, same Inter.
   ========================================================================== */

.flxb-dash {
  --fd-bg: #fdfdfd;
  --fd-panel: #ffffff;
  --fd-side: #f7f8f8;
  --fd-ink: #17181a;
  --fd-muted: #777b80;
  --fd-line: #e6e8e9;
  --fd-soft: #f4f5f6;
  --fd-brand: #05bc5b;
  --fd-brand-soft: #e9faef;
  --fd-charcoal: #3e3e45;
  --fd-bubble: #f2f5f7;

  /* Real viewport height on mobile — iOS Safari's 100vh includes the URL
       bar, so a full-height app column gets clipped. chat-dashboard-v2.js
       keeps --fd-vh in sync; the fallback keeps this usable without JS. */
  --fd-vh: 1vh;

  --fd-side-w: 272px;
  --fd-bar-h: 70px;
}

/* ---------- Page ---------- */

body.flxb-dash-body {
  margin: 0;
  background: var(--fd-bg);
  color: var(--fd-ink);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: -0.015em;
  /* the thread scrolls, not the page */
  overflow: hidden;
}

.flxb-dash,
.flxb-dash *,
.flxb-dash *::before,
.flxb-dash *::after {
  box-sizing: border-box;
}

.flxb-dash button,
.flxb-dash textarea {
  font: inherit;
  letter-spacing: inherit;
}

.flxb-dash button {
  cursor: pointer;
}

/* DO NOT REMOVE.
   The JS swaps empty state <-> messages by toggling the hidden attribute. The
   browser's own [hidden] rule is only `display:none` at UA specificity, so any
   class that sets display beats it — .fd-empty-state is display:flex, which is
   why dropping this makes the empty state and the conversation render on top
   of each other. This guard keeps the attribute authoritative. */
.flxb-dash [hidden] {
  display: none !important;
}

.flxb-dash {
  height: calc(var(--fd-vh) * 100);
  display: grid;
  grid-template-columns: var(--fd-side-w) minmax(0, 1fr);
  overflow: hidden;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.flxb-dash .fd-sidebar {
  background: var(--fd-side);
  border-right: 1px solid var(--fd-line);
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* the project list scrolls, the rails don't */
  overflow: hidden;
}

.flxb-dash .fd-side-top {
  height: var(--fd-bar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--fd-line);
  flex: 0 0 auto;
}

.flxb-dash .fd-logo-link {
  display: block;
  line-height: 0;
}

.flxb-dash .fd-logo {
  height: 25px;
  width: auto;
  display: block;
}

/* ---------- New project ---------- */

.flxb-dash .fd-new-btn {
  flex: 0 0 auto;
  margin: 16px 12px 10px;
  height: 42px;
  border: 1px solid #dedfe1;
  border-radius: 12px;
  background: #fff;
  color: #26272a;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: 0.18s ease;
}

.flxb-dash .fd-new-btn:hover {
  border-color: #d2d4d6;
  background: #fcfcfc;
}

.flxb-dash .fd-plus {
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  color: #52555a;
}

.flxb-dash .fd-side-label {
  flex: 0 0 auto;
  padding: 16px 18px 9px;
  color: #96999d;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ---------- Project list ---------- */

/* flex:1 + min-height:0 is what lets this scroll instead of pushing the
   account block off the bottom. The live dashboard hardcodes a pixel height
   here and has overflow commented out, so long lists become unreachable. */
.flxb-dash .fd-projects {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 8px 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.flxb-dash .fd-project {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 10px;
  text-align: left;
  color: #505359;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  overflow: hidden;
}

.flxb-dash .fd-project:hover {
  background: #eef0f1;
}

.flxb-dash .fd-project.is-active {
  background: #ebf7ef;
  color: #1b5c38;
  font-weight: 700;
}

.flxb-dash .fd-proj-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c7cacd;
  flex: 0 0 auto;
}

.flxb-dash .fd-project.is-active .fd-proj-dot {
  background: var(--fd-brand);
}

.flxb-dash .fd-proj-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.flxb-dash .fd-side-empty {
  padding: 8px 10px;
  color: #a1a4a8;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Account ---------- */

.flxb-dash .fd-account {
  flex: 0 0 auto;
  margin-top: auto;
  position: relative;
  border-top: 1px solid var(--fd-line);
}

.flxb-dash .fd-user {
  width: 100%;
  /* height: 66px; */
  padding: 16px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: inherit;
}

.flxb-dash .fd-user:hover {
  background: #f1f3f3;
}

.flxb-dash .fd-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fd-ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
  text-transform: uppercase;
}

.flxb-dash .fd-user-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.flxb-dash .fd-user-meta b {
  display: block;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Emails run long and the sidebar is a fixed 272px, so this needs the same
   ellipsis treatment as the name above it — without display:block the
   overflow rules would do nothing on an inline element. */
.flxb-dash .fd-user-meta span {
  display: block;
  font-size: 12px;
  line-height: 16px;
  color: #96999d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flxb-dash .fd-chevron {
  display: grid;
  place-items: center;
  color: #92959a;
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.flxb-dash .fd-account.is-open .fd-chevron {
  transform: rotate(180deg);
}

/* ---------- Profile menu ---------- */

/* Kept in the DOM and faded rather than display:none'd so the transition can
   run. visibility flips too, or it would still be clickable while invisible. */
.flxb-dash .fd-profile-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 58px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--fd-line);
  border-radius: 14px;
  box-shadow:
    0 18px 45px rgba(18, 20, 22, 0.12),
    0 3px 10px rgba(18, 20, 22, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: 0.16s ease;
  z-index: 50;
}

.flxb-dash .fd-account.is-open .fd-profile-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.flxb-dash .fd-profile-item {
  width: 100%;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  color: #35383c;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.flxb-dash .fd-profile-item:hover {
  background: #f5f6f6;
}

.flxb-dash .fd-profile-item.fd-logout {
  margin-top: 4px;
  border-top: 1px solid var(--fd-line);
  border-radius: 0 0 9px 9px;
  padding-top: 4px;
  height: 42px;
  color: #5e6165;
}

/* ==========================================================================
   Main column
   ========================================================================== */

.flxb-dash .fd-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  /* anchors the absolutely-positioned composer */
  position: relative;
  overflow: hidden;
}

.flxb-dash .fd-topbar {
  height: var(--fd-bar-h);
  border-bottom: 1px solid var(--fd-line);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  flex: 0 0 auto;
}

.flxb-dash .fd-thread-title {
  font-size: 14px;
  font-weight: 700;
  color: #303236;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flxb-dash .fd-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.flxb-dash .fd-status {
  font-size: 12px;
  color: #85888d;
  display: flex;
  align-items: center;
  gap: 6px;
}

.flxb-dash .fd-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fd-brand);
}

/* Hamburger — desktop hides it; the drawer only exists on small screens */
.flxb-dash .fd-menu-btn {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--fd-line);
  border-radius: 10px;
  background: #fff;
  color: #4e5155;
  place-items: center;
  flex: 0 0 auto;
}

.flxb-dash .fd-menu-btn:hover {
  background: #fafafa;
}

/* ---------- Thread ---------- */

.flxb-dash .fd-thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.flxb-dash .fd-thread-inner {
  width: min(840px, calc(100% - 40px));
  margin: 0 auto;
  /* bottom padding clears the floating composer */
  padding: 38px 0 190px;
}

.flxb-dash .fd-thread::-webkit-scrollbar {
  width: 6px;
}

.flxb-dash .fd-thread::-webkit-scrollbar-thumb {
  background: #d9dcde;
  border-radius: 10px;
}

.flxb-dash .fd-thread::-webkit-scrollbar-thumb:hover {
  background: #c2c6c9;
}

/* ---------- Empty state ---------- */

.flxb-dash .fd-empty-state {
  min-height: calc((var(--fd-vh) * 100) - 280px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: 36px;
}

/* logo-primary.svg is a 512x512 app mark that already carries its own brand
   background and rounded silhouette — so no background or border-radius here,
   or we'd draw a second square behind it.

   drop-shadow rather than box-shadow: box-shadow traces the element's box and
   would cast a hard square behind a shape whose corners aren't square.
   drop-shadow follows the SVG's actual alpha. */
.flxb-dash .fd-product-icon {
  width: 46px;
  height: 46px;
  display: block;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 14px rgba(5, 188, 91, 0.28));
}

.flxb-dash .fd-empty-state h1 {
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -0.045em;
  margin: 0;
  font-weight: 600;
}

.flxb-dash .fd-empty-state p {
  margin: 10px 0 25px;
  color: #85888c;
  font-size: 14px;
}

.flxb-dash .fd-starters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 250px));
  gap: 9px;
}

.flxb-dash .fd-starter {
  min-height: 56px;
  border: 1px solid var(--fd-line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  padding: 10px 12px;
  color: #4d5054;
  font-size: 12px;
  transition: 0.18s ease;
}

.flxb-dash .fd-starter:hover {
  transform: translateY(-1px);
  border-color: #d2d4d6;
  box-shadow: 0 8px 20px rgba(20, 20, 20, 0.04);
}

.flxb-dash .fd-starter b {
  display: block;
  color: #292b2e;
  font-size: 12px;
  line-height: 16px;
}

.flxb-dash .fd-starter span {
  font-size: 10px;
  color: #92959a;
}

/* ---------- Messages (shell only — rendering lands in step 2) ---------- */

.flxb-dash .fd-messages {
  display: none;
}

.flxb-dash .fd-messages.is-active {
  display: block;
}

/* ==========================================================================
   Composer
   ========================================================================== */

/* Floats over the thread with a fade so text scrolls out under it rather than
   hitting a hard edge. pointer-events is off on the wrapper so the gradient
   doesn't swallow clicks meant for the messages behind it. */
.flxb-dash .fd-composer-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(to top, #fff 72%, rgba(255, 255, 255, 0));
  padding: 50px 20px 18px;
}

.flxb-dash .fd-composer {
  width: min(840px, 100%);
  margin: 0 auto;
  border: 1px solid #dfe2e4;
  border-radius: 22px;
  background: #fff;
  box-shadow:
    0 12px 35px rgba(17, 18, 20, 0.07),
    0 2px 6px rgba(17, 18, 20, 0.035);
  pointer-events: auto;
  overflow: hidden;
  transition: 0.2s ease;
}

.flxb-dash .fd-composer.is-focused {
  border-color: #c9cdcf;
  box-shadow:
    0 16px 42px rgba(17, 18, 20, 0.09),
    0 2px 7px rgba(17, 18, 20, 0.04);
}

.flxb-dash .fd-composer textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  max-height: 180px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 17px 18px 8px;
  background: transparent;
  color: #202225;
  font-size: 14px;
  line-height: 1.55;
}

.flxb-dash .fd-composer textarea::placeholder {
  color: #9da0a5;
}

.flxb-dash .fd-compose-foot {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 8px 12px;
}

.flxb-dash .fd-left-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.flxb-dash .fd-tool {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #7b7e82;
  display: grid;
  place-items: center;
}

.flxb-dash .fd-tool:hover {
  background: #f5f6f6;
}

.flxb-dash .fd-send {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 0;
  background: var(--fd-charcoal);
  color: #fff;
  display: grid;
  place-items: center;
  transition: 0.18s ease;
}

.flxb-dash .fd-send:hover {
  background: #303137;
}

.flxb-dash .fd-send.is-loading {
  pointer-events: none;
  opacity: 0.65;
}

.flxb-dash .fd-send.is-loading svg {
  display: none;
}

.flxb-dash .fd-send-loader {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fd-spin 0.8s linear infinite;
}

.flxb-dash .fd-send.is-loading .fd-send-loader {
  display: block;
}

@keyframes fd-spin {
  to {
    transform: rotate(360deg);
  }
}

.flxb-dash .fd-compose-note {
  text-align: center;
  font-size: 9px;
  color: #a1a4a7;
  margin-top: 9px;
  pointer-events: auto;
}

/* ==========================================================================
   Mobile — sidebar becomes a drawer

   The design hid the sidebar outright below 820px, which would leave phone
   users with no way to reach their projects. Kept as a slide-in drawer
   instead, matching the behaviour the live dashboard already has.
   ========================================================================== */

.flxb-dash .fd-overlay {
  display: none;
}

@media (max-width: 820px) {
  .flxb-dash {
    grid-template-columns: minmax(0, 1fr);
  }

  .flxb-dash .fd-menu-btn {
    display: grid;
  }

  .flxb-dash .fd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(86%, 320px);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
    box-shadow: 2px 0 18px rgba(0, 0, 0, 0.16);
  }

  .flxb-dash .fd-sidebar.is-open {
    transform: none;
  }

  .flxb-dash .fd-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.34);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  /* [hidden] wins over display:block above, so the backdrop is inert until
       JS unhides it — see chat-dashboard-v2.js in step 2. */
  .flxb-dash .fd-overlay[hidden] {
    display: none;
  }

  .flxb-dash .fd-overlay.is-visible {
    opacity: 1;
  }

  .flxb-dash .fd-topbar {
    padding: 0 14px;
  }

  .flxb-dash .fd-thread-inner {
    width: min(calc(100% - 28px), 840px);
    padding-top: 26px;
  }

  .flxb-dash .fd-starters {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 420px;
  }

  .flxb-dash .fd-empty-state h1 {
    font-size: 28px;
  }

  .flxb-dash .fd-composer-wrap {
    padding: 40px 14px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flxb-dash .fd-sidebar,
  .flxb-dash .fd-overlay,
  .flxb-dash .fd-composer,
  .flxb-dash .fd-starter {
    transition: none;
  }

  .flxb-dash .fd-starter:hover {
    transform: none;
  }
}

/* ==========================================================================
   Messages
   ========================================================================== */

/* Fixed avatar column so every assistant paragraph starts on the same left
   edge; user rows collapse to a single column and push right. */
.flxb-dash .fd-msg-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  margin: 0 0 26px;
}

/* .is-user, not .fd-user — .fd-user is the sidebar account button, and reusing
   it here made every user message inherit that button's padding, flex layout
   and hover background. */
.flxb-dash .fd-msg-row.is-user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

/* Source is 1024x1024, so it needs both dimensions pinned and object-fit, or a
   non-square crop would stretch it. */
.flxb-dash .fd-bot-avatar {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: block;
  object-fit: cover;
}

.flxb-dash .fd-msg {
  max-width: 650px;
  font-size: 14px;
  line-height: 1.6;
  color: #2e3034;
  /* long URLs and pasted tokens must wrap, not widen the column */
  overflow-wrap: anywhere;
}

.flxb-dash .fd-msg.fd-user-bubble {
  max-width: min(620px, 100%);
  padding: 11px 15px;
  background: var(--fd-bubble);
  border-radius: 18px 18px 5px 18px;
  color: #24262a;
}

.flxb-dash .fd-msg a {
  color: #3b82f6;
  text-decoration: underline;
}

.flxb-dash .fd-msg p {
  margin: 0 0 10px;
}

.flxb-dash .fd-msg p:last-child {
  margin-bottom: 0;
}

/* ---------- Typing ---------- */

.flxb-dash .fd-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.flxb-dash .fd-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a8aaad;
  animation: fd-bounce 1.1s infinite;
}

.flxb-dash .fd-typing i:nth-child(2) {
  animation-delay: 0.14s;
}

.flxb-dash .fd-typing i:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes fd-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flxb-dash .fd-typing i {
    animation: none;
    opacity: 0.6;
  }
}

/* ---------- Analyzing ---------- */

/* #analyzingMessage is now a .fd-msg-row, so it inherits the row layout and
   needs no sizing of its own. */

/* ---------- Spinner ---------- */

.flxb-dash .spinner-wrapper {
  display: flex;
  justify-content: center;
  padding: 24px;
}

.flxb-dash .spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #e3e5e7;
  border-top-color: #8b8f94;
  border-radius: 50%;
  animation: fd-spin 0.8s linear infinite;
}

/* ==========================================================================
   Toast
   ========================================================================== */

/* Fixed, not absolute: it must clear the composer, which sits above the thread
   with its own stacking context. */
.flxb-dash .fd-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 2000;
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 16px;
  border-radius: 12px;
  background: #24262a;
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 30px rgba(17, 18, 20, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: 0.2s ease;
}

.flxb-dash .fd-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .flxb-dash .fd-toast {
    transition: none;
  }

  .flxb-dash .spinner {
    animation-duration: 1.6s;
  }
}

/* ==========================================================================
   Profile panel

   Markup: parts/home-v3/user_profile.php
   Opened from the sidebar account menu.

   Two modes in one panel: .is-editing on .fd-pp swaps read values for inputs.
   Rows carrying data-fd-readonly keep their value visible in both modes —
   they have no input to swap to.
   ========================================================================== */

.flxb-dash .fd-pp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(16, 18, 20, 0.42);
  opacity: 0;
  transition: opacity 0.26s ease;
}

.flxb-dash .fd-pp-overlay.is-open {
  opacity: 1;
}

.flxb-dash .fd-pp {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1201;
  width: min(460px, 100%);
  background: #fff;
  border-left: 1px solid var(--fd-line);
  box-shadow: -18px 0 50px rgba(18, 20, 22, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.flxb-dash .fd-pp.is-open {
  transform: none;
}

/* ---------- Head ---------- */

.flxb-dash .fd-pp-head {
  flex: 0 0 auto;
  height: var(--fd-bar-h);
  padding: 0 20px 0 24px;
  border-bottom: 1px solid var(--fd-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flxb-dash .fd-pp-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.flxb-dash .fd-pp-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--fd-line);
  border-radius: 10px;
  background: #fff;
  color: #61646a;
  display: grid;
  place-items: center;
}

.flxb-dash .fd-pp-close:hover {
  background: #fafafa;
}

/* ---------- Body ---------- */

.flxb-dash .fd-pp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 24px 8px;
}

/* ---------- Identity ---------- */

.flxb-dash .fd-pp-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--fd-line);
}

.flxb-dash .fd-pp-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--fd-ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  flex: 0 0 auto;
  text-transform: uppercase;
}

/* Pencil badge — edit mode only */
.flxb-dash .fd-pp-photo {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--fd-charcoal);
  color: #fff;
  display: none;
  place-items: center;
  padding: 0;
}

.flxb-dash .fd-pp.is-editing .fd-pp-photo {
  display: grid;
}

.flxb-dash .fd-pp-identity-meta {
  min-width: 0;
}

.flxb-dash .fd-pp-identity-meta b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flxb-dash .fd-pp-identity-meta > span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #85888c;
}

.flxb-dash .fd-pp-photo-link {
  display: none;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4b4e52;
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
}

.flxb-dash .fd-pp.is-editing .fd-pp-photo-link {
  display: block;
}

/* ---------- Sections and rows ---------- */

.flxb-dash .fd-pp-section {
  margin: 22px 0 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #96999d;
}

.flxb-dash .fd-pp-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f2;
}

.flxb-dash .fd-pp-key {
  font-size: 12px;
  color: #85888c;
}

.flxb-dash .fd-pp-val {
  font-size: 13px;
  color: #2e3034;
  overflow-wrap: anywhere;
}

.flxb-dash .fd-pp-val.is-empty {
  color: #a1a4a8;
}

.flxb-dash .fd-pp-strong {
  font-weight: 700;
}

.flxb-dash .fd-pp-verified {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #08753c;
  font-weight: 700;
}

.flxb-dash .fd-pp-verified i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fd-brand);
  flex: 0 0 auto;
}

/* ---------- Mode swap ---------- */

/* Inputs live in the DOM at all times so Cancel can restore without a
   re-render; only visibility changes. */
.flxb-dash .fd-pp-input {
  display: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #dfe2e4;
  border-radius: 9px;
  background: #fff;
  color: #202225;
  font-size: 13px;
  outline: 0;
}

.flxb-dash .fd-pp-input::placeholder {
  color: #a9acb0;
}

.flxb-dash .fd-pp-input:focus {
  border-color: var(--fd-brand);
  box-shadow: 0 0 0 3px rgba(5, 188, 91, 0.12);
}

/* Only rows that HAVE an input swap. data-fd-readonly rows keep their value
   on screen in edit mode — there is nothing to swap them to. */
.flxb-dash .fd-pp.is-editing .fd-pp-row:not([data-fd-readonly]) .fd-pp-val {
  display: none;
}

.flxb-dash .fd-pp.is-editing .fd-pp-row:not([data-fd-readonly]) .fd-pp-input {
  display: block;
}

/* ---------- Foot ---------- */

.flxb-dash .fd-pp-foot {
  flex: 0 0 auto;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--fd-line);
  background: #fff;
}

.flxb-dash .fd-pp-btn {
  height: 44px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid #dfe2e4;
  background: #fff;
  color: #26272a;
  font-size: 13px;
  font-weight: 700;
  transition: 0.18s ease;
}

.flxb-dash .fd-pp-btn:hover {
  background: #fafafa;
  border-color: #d0d3d5;
}

.flxb-dash .fd-pp-actions {
  display: none;
  gap: 10px;
}

.flxb-dash .fd-pp.is-editing .fd-pp-edit {
  display: none;
}

.flxb-dash .fd-pp.is-editing .fd-pp-actions {
  display: flex;
}

.flxb-dash .fd-pp-save {
  background: var(--fd-charcoal);
  border-color: var(--fd-charcoal);
  color: #fff;
}

.flxb-dash .fd-pp-save:hover {
  background: #303137;
  border-color: #303137;
}

.flxb-dash .fd-pp-save.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.flxb-dash .fd-pp-note {
  margin: 10px 0 0;
  text-align: center;
  font-size: 10px;
  color: #a1a4a7;
}

/* ---------- Mobile ---------- */

@media (max-width: 560px) {
  .flxb-dash .fd-pp {
    width: 100%;
    border-left: 0;
  }

  .flxb-dash .fd-pp-row {
    /* stacked, or a 120px label column leaves inputs unusably narrow */
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flxb-dash .fd-pp,
  .flxb-dash .fd-pp-overlay {
    transition: none;
  }
}

/* ---------- Avatar images ---------- */

/* Offscreen rather than display:none: a display:none input can't be opened
   programmatically in some browsers. */
.flxb-dash .fd-pp-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Fills the circle it sits in, so the same rule serves the 56px panel avatar
   and the 36px sidebar one. */
.flxb-dash .fd-avatar img,
.flxb-dash .fd-pp-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.flxb-dash .fd-pp-avatar.is-busy {
  opacity: 0.55;
}

/* ==========================================================================
   Flexable 2 conversation (assistant-v3 blocks): skill chips, choice cards,
   match cards, the profile drawer, the handoff card and the selected
   person's replies. Values from the Flexable-2-till-handoff design.
   ========================================================================== */

.flxb-dash .fd-msg-row:not(.is-user) .fd-msg {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.flxb-dash .fd-msg-text {
  white-space: pre-line;
}

/* ---------- Sidebar status line ---------- */

.flxb-dash .fd-proj-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.flxb-dash .fd-proj-sub {
  font-size: 11px;
  color: var(--fd-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Skill chips ---------- */

.flxb-dash .fd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.flxb-dash .fd-chip {
  font-size: 11.5px;
  color: #666a6d;
  background: #fafafa;
  border: 1px solid var(--fd-line);
  border-radius: 999px;
  padding: 5px 9px;
}

/* ---------- Budget / timeline cards ---------- */

/* A line between the skill chips and a question card ("Let's start with budget."). */
.flxb-dash .fd-q-lead {
  margin: 14px 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #141816;
}

.flxb-dash .fd-q-card {
  border: 1px solid var(--fd-line);
  border-radius: 17px;
  padding: 15px;
  background: #fff;
  margin-top: 14px;
  box-shadow: 0 5px 18px rgba(20, 20, 20, 0.025);
  animation: fd-step-in 0.22s ease;
}

.flxb-dash .fd-q-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  color: #999ca0;
  margin-bottom: 9px;
}

.flxb-dash .fd-choice-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.flxb-dash .fd-choice {
  border: 1px solid #dde0e1;
  background: #fff;
  color: #55585b;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 600;
  transition: 0.16s ease;
}

.flxb-dash .fd-choice:hover:not(:disabled) {
  border-color: #bfc4c5;
  transform: translateY(-1px);
}

.flxb-dash .fd-choice-other {
  background: #fafafa;
  color: #74777a;
}

.flxb-dash .fd-choice.is-selected {
  border-color: #bdeccf;
  background: var(--fd-brand-soft);
  color: #08743e;
}

.flxb-dash .fd-choice:disabled {
  cursor: default;
}

.flxb-dash .fd-choice:disabled:not(.is-selected) {
  opacity: 0.5;
}

/* ---------- Match cards ---------- */

.flxb-dash .fd-matches {
  margin-top: 14px;
}

.flxb-dash .fd-match-status {
  display: none;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--fd-line);
  border-radius: 13px;
  padding: 10px 12px;
  background: #fafbfb;
  color: #676a6d;
  font-size: 12px;
}

.flxb-dash .fd-matches.is-revealing .fd-match-status {
  display: flex;
}

.flxb-dash .fd-matches.is-revealing .fd-match-result {
  display: none;
}

.flxb-dash .fd-match-result {
  animation: fd-fade-up 0.32s ease;
}

.flxb-dash .fd-spin {
  width: 14px;
  height: 14px;
  flex: none;
  border: 1.5px solid #d9dcdd;
  border-top-color: var(--fd-brand);
  border-radius: 50%;
  animation: fd-spin 0.9s linear infinite;
}

.flxb-dash .fd-result-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 6px 0 10px;
}

.flxb-dash .fd-result-head b {
  font-size: 15px;
}

.flxb-dash .fd-result-head span {
  font-size: 11px;
  color: #9a9da0;
}

.flxb-dash .fd-match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flxb-dash .fd-match-card {
  border: 1px solid var(--fd-line);
  border-radius: 15px;
  padding: 13px;
  background: #fff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  transition: 0.16s ease;
}

.flxb-dash .fd-match-card:hover {
  border-color: #d3d6d7;
  box-shadow: 0 8px 22px rgba(20, 20, 20, 0.035);
}

.flxb-dash .fd-match-card.is-chosen {
  border-color: #bdeccf;
  background: #fbfefc;
}

.flxb-dash .fd-match-photo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  background: #eee;
  font-size: 18px;
}

/* Initial tile when a person has no photo */
.flxb-dash .fd-initial {
  display: grid;
  place-items: center;
  background: var(--fd-brand-soft);
  color: #08743e;
  font-weight: 760;
}

.flxb-dash .fd-match-copy {
  min-width: 0;
}

.flxb-dash .fd-match-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.flxb-dash .fd-match-name {
  font-size: 13.5px;
  font-weight: 760;
}

.flxb-dash .fd-score {
  font-size: 10.5px;
  color: #08743e;
  background: var(--fd-brand-soft);
  border: 1px solid #ccefd8;
  border-radius: 999px;
  padding: 3px 7px;
  font-weight: 780;
}

.flxb-dash .fd-match-role {
  font-size: 11.5px;
  color: #85888c;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flxb-dash .fd-why {
  font-size: 12px;
  color: #606367;
  margin-top: 6px;
  line-height: 1.45;
}

.flxb-dash .fd-match-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.flxb-dash .fd-link-btn,
.flxb-dash .fd-connect-btn {
  height: 34px;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.flxb-dash .fd-link-btn {
  border: 1px solid var(--fd-line);
  background: #fff;
  color: #5f6265;
}

.flxb-dash .fd-connect-btn {
  border: 0;
  background: var(--fd-charcoal);
  color: #fff;
}

.flxb-dash .fd-connect-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.flxb-dash .fd-match-card.is-chosen .fd-connect-btn:disabled {
  opacity: 1;
  background: var(--fd-brand-soft);
  color: #08743e;
}

/* "Show 3 more" under the match cards. */
.flxb-dash .fd-more-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 1px dashed #d4d9d6;
  border-radius: 14px;
  background: #fff;
  color: #141816;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s;
}

.flxb-dash .fd-more-btn:hover {
  background: #f6f8f7;
  border-color: #b9c2bd;
}

.flxb-dash .fd-followup {
  margin-top: 12px;
  color: #777a7d;
  font-size: 12px;
}

/* ---------- Handoff card ---------- */

.flxb-dash .fd-handoff {
  margin-top: 14px;
  border: 1px solid #e3e7e5;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff, #fbfdfc);
  box-shadow: 0 12px 34px rgba(17, 17, 19, 0.04);
}

.flxb-dash .fd-handoff-live {
  padding: 26px 18px 20px;
  display: grid;
  justify-items: center;
  text-align: center;
}

.flxb-dash .fd-handoff-avatar {
  width: 66px;
  height: 66px;
  border-radius: 22px;
  position: relative;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #e4e8e6;
  box-shadow: 0 8px 24px rgba(17, 17, 19, 0.055);
  margin-bottom: 17px;
  isolation: isolate;
}

.flxb-dash .fd-handoff-avatar::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 27px;
  border: 1px solid rgba(5, 188, 91, 0.18);
  opacity: 0.45;
  animation: fd-breathe 3.2s ease-in-out infinite;
  z-index: -1;
}

.flxb-dash .fd-handoff-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flxb-dash .fd-handoff-flex img {
  width: 43px;
  height: 43px;
  border-radius: 14px;
  object-fit: contain;
}

.flxb-dash .fd-handoff-photo {
  width: 100%;
  height: 100%;
  border-radius: 21px;
  object-fit: cover;
  font-size: 24px;
}

.flxb-dash .fd-handoff-person {
  opacity: 0;
  transform: scale(0.88);
}

.flxb-dash .fd-handoff.is-joined .fd-handoff-flex {
  opacity: 0;
  transform: scale(0.78);
}

.flxb-dash .fd-handoff.is-joined .fd-handoff-person {
  opacity: 1;
  transform: scale(1);
}

.flxb-dash .fd-handoff.is-joined .fd-handoff-avatar::before {
  animation: none;
  opacity: 0;
}

.flxb-dash .fd-handoff-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  transition: 0.35s ease;
  z-index: 3;
}

.flxb-dash .fd-handoff-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fd-brand);
  box-shadow: 0 0 0 4px rgba(5, 188, 91, 0.11);
}

.flxb-dash .fd-handoff.is-joined .fd-handoff-dot {
  opacity: 1;
  transform: scale(1);
}

.flxb-dash .fd-handoff-title {
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.025em;
  color: #282c2d;
}

.flxb-dash .fd-handoff-copy {
  font-size: 12px;
  color: #8a8e91;
  line-height: 1.5;
  margin-top: 5px;
  min-height: 18px;
  transition: opacity 0.18s ease;
}

.flxb-dash .fd-handoff-copy.is-fading {
  opacity: 0.12;
}

.flxb-dash .fd-handoff-quiet {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid #f0f2f1;
  width: 100%;
  font-size: 11px;
  color: #a0a3a5;
}

/* Waiting only — dropped once the person has joined. */
.flxb-dash .fd-handoff-wait {
  margin-top: 6px;
  font-size: 11px;
  color: #7f8682;
}

/* ---------- The selected person's replies ---------- */

.flxb-dash .fd-match-turn {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  animation: fd-fade-up 0.38s ease;
}

.flxb-dash .fd-match-avatar {
  width: 32px;
  height: 32px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 0 0 4px rgba(5, 188, 91, 0.08);
  font-size: 13px;
}

.flxb-dash .fd-match-content {
  min-width: 0;
}

.flxb-dash .fd-match-author {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 760;
  color: #2d3132;
  margin: 1px 0 6px;
}

.flxb-dash .fd-match-author i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fd-brand);
}

.flxb-dash .fd-match-content .fd-msg-text {
  font-size: 14px;
  line-height: 1.62;
  color: #303236;
}

/* ---------- Header: who you're talking to ---------- */

.flxb-dash .fd-partner {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #686d6f;
  animation: fd-fade-up 0.3s ease;
}

.flxb-dash .fd-partner-photo {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  object-fit: cover;
  font-size: 12px;
}

.flxb-dash .fd-partner b {
  display: block;
  font-size: 12.5px;
  color: #34383a;
}

.flxb-dash .fd-partner span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.flxb-dash .fd-partner span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8cccd;
}

.flxb-dash .fd-partner span.is-live::before {
  background: var(--fd-brand);
}

/* ---------- Match profile drawer ---------- */

.flxb-dash .fd-mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 19, 0.18);
  backdrop-filter: blur(2px);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.flxb-dash .fd-mp-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.flxb-dash .fd-mp {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(470px, 100vw);
  background: #fff;
  border-left: 1px solid var(--fd-line);
  box-shadow: -20px 0 60px rgba(17, 17, 19, 0.09);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  display: flex;
  flex-direction: column;
}

.flxb-dash .fd-mp-overlay.is-open .fd-mp {
  transform: translateX(0);
}

.flxb-dash .fd-mp-head {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--fd-line);
  flex: none;
}

.flxb-dash .fd-mp-head b {
  font-size: 14px;
}

.flxb-dash .fd-mp-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  font-size: 22px;
  color: #777;
}

.flxb-dash .fd-mp-close:hover {
  background: #f4f5f5;
  color: #222;
}

.flxb-dash .fd-mp-scroll {
  overflow: auto;
  padding: 22px;
  flex: 1;
}

.flxb-dash .fd-mp-hero {
  display: flex;
  gap: 14px;
  align-items: center;
}

.flxb-dash .fd-mp-photo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  object-fit: cover;
  background: #eee;
  font-size: 24px;
  flex: none;
}

.flxb-dash .fd-mp-name {
  font-size: 20px;
  font-weight: 780;
  letter-spacing: -0.035em;
}

.flxb-dash .fd-mp-role {
  font-size: 12.5px;
  color: #777b7e;
  margin-top: 3px;
}

.flxb-dash .fd-mp-verified {
  margin-top: 6px;
  font-size: 11px;
  color: #08743e;
}

.flxb-dash .fd-mp-score {
  display: inline-flex;
  margin-top: 18px;
  color: #08743e;
  background: var(--fd-brand-soft);
  border: 1px solid #ccefd8;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 780;
}

.flxb-dash .fd-mp-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 8px;
}

.flxb-dash .fd-mp-stat {
  border: 1px solid var(--fd-line);
  border-radius: 13px;
  padding: 11px;
}

.flxb-dash .fd-mp-stat small {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9a9da0;
  font-weight: 760;
  margin-bottom: 5px;
}

.flxb-dash .fd-mp-stat b {
  font-size: 13px;
  color: #303236;
}

.flxb-dash .fd-mp-section {
  padding: 19px 0 4px;
  border-top: 1px solid #f0f1f1;
  margin-top: 14px;
}

.flxb-dash .fd-mp-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #999ca0;
  font-weight: 800;
  margin-bottom: 12px;
}

.flxb-dash .fd-mp-fit-list {
  display: grid;
  gap: 9px;
}

.flxb-dash .fd-mp-fit {
  display: flex;
  gap: 9px;
  font-size: 13px;
  line-height: 1.45;
  color: #44474a;
}

.flxb-dash .fd-mp-fit::before {
  content: "✓";
  color: var(--fd-brand);
  font-weight: 900;
  flex: none;
}

.flxb-dash .fd-mp-skills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.flxb-dash .fd-mp-skill {
  border: 1px solid var(--fd-line);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  color: #65686b;
}

.flxb-dash .fd-mp-footer {
  border-top: 1px solid var(--fd-line);
  padding: 16px 22px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.flxb-dash .fd-mp-ask {
  border: 0;
  background: transparent;
  padding: 0;
  color: #4c5153;
  font-size: 12px;
  font-weight: 700;
}

.flxb-dash .fd-mp-ask:hover {
  text-decoration: underline;
}

.flxb-dash .fd-mp-connect {
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--fd-charcoal);
  color: #fff;
  padding: 0 16px;
  font-size: 12.5px;
  font-weight: 740;
  margin-left: auto;
}

.flxb-dash .fd-mp-connect:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- Motion & small screens ---------- */

@keyframes fd-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fd-fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fd-step-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fd-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.45;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.15;
  }
}

@media (max-width: 640px) {
  .flxb-dash .fd-match-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .flxb-dash .fd-match-actions {
    grid-column: 2;
    flex-wrap: wrap;
  }

  .flxb-dash .fd-result-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .flxb-dash .fd-mp-scroll,
  .flxb-dash .fd-mp-head,
  .flxb-dash .fd-mp-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flxb-dash .fd-handoff-avatar::before,
  .flxb-dash .fd-spin,
  .flxb-dash .fd-q-card,
  .flxb-dash .fd-match-result,
  .flxb-dash .fd-match-turn,
  .flxb-dash .fd-partner {
    animation: none;
  }
}

/* Same rhythm as .fd-msg-row, which the selected person's replies sit between. */
.flxb-dash .fd-match-turn {
  margin: 0 0 26px;
}

/* ==========================================================================
   Payment cards (role "system"): Agreed chip, payment card, checking state,
   confirmation and receipt. Values from Flexable-2-till-payment.
   ========================================================================== */

/* Flexable's own cards sit under the conversation, aligned with message text. */
.flxb-dash .fd-system-turn {
  margin: 0 0 26px 36px;
  max-width: 520px;
  animation: fd-fade-up 0.32s ease;
}

.flxb-dash .fd-system-turn > .fd-msg-text {
  font-size: 13px;
  color: #6b706e;
  background: #fafbfb;
  border: 1px solid var(--fd-line);
  border-radius: 14px;
  padding: 11px 13px;
}

.flxb-dash .fd-agreed {
  display: inline-block;
  font-size: 11.5px;
  color: #6b706e;
  background: #fafbfb;
  border: 1px solid var(--fd-line);
  border-radius: 999px;
  padding: 6px 11px;
}

.flxb-dash .fd-agreed b {
  color: #2d3132;
  margin-right: 4px;
}

.flxb-dash .fd-pay-card {
  margin-top: 14px;
  border: 1px solid #e1e5e3;
  border-radius: 22px;
  background: #fff;
  box-shadow:
    0 14px 40px rgba(17, 17, 19, 0.055),
    0 2px 8px rgba(17, 17, 19, 0.025);
  overflow: hidden;
}

.flxb-dash .fd-pay-head {
  padding: 16px 17px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eef0ef;
}

.flxb-dash .fd-pay-head b {
  font-size: 14px;
}

.flxb-dash .fd-protected,
.flxb-dash .fd-receipt-status {
  font-size: 10px;
  color: #08743e;
  background: var(--fd-brand-soft);
  border: 1px solid #ccefd8;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 760;
}

.flxb-dash .fd-pay-amount {
  padding: 16px 17px 4px;
}

.flxb-dash .fd-pay-amount small,
.flxb-dash .fd-detail-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  color: #999ca0;
  margin-bottom: 6px;
}

.flxb-dash .fd-pay-amount strong {
  display: block;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #242729;
}

.flxb-dash .fd-pay-scope {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b706e;
}

.flxb-dash .fd-pay-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 12px 17px 14px;
}

.flxb-dash .fd-qr-wrap {
  text-align: center;
}

.flxb-dash .fd-qr {
  width: 180px;
  height: 180px;
  border: 1px solid #e2e6e4;
  border-radius: 16px;
  background: #fff;
  padding: 8px;
  object-fit: contain;
  image-rendering: pixelated;
}

.flxb-dash .fd-qr-label {
  font-size: 10.5px;
  color: #989c9e;
  margin-top: 7px;
}

.flxb-dash .fd-pay-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.flxb-dash .fd-pay-id,
.flxb-dash .fd-pay-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e1e5e3;
  border-radius: 11px;
  padding: 10px 11px;
  font-size: 12px;
  color: #3f4446;
  min-width: 0;
}

.flxb-dash .fd-pay-id {
  background: #fafbfb;
}

.flxb-dash .fd-pay-id code {
  font-family: inherit;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flxb-dash .fd-pay-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flxb-dash .fd-pay-id button,
.flxb-dash .fd-pay-link a {
  border: 0;
  background: transparent;
  color: #08743e;
  font-size: 11px;
  font-weight: 760;
  flex: none;
  text-decoration: none;
}

.flxb-dash .fd-pay-terms {
  padding: 0 17px 10px;
  font-size: 12px;
  color: #6b706e;
}

.flxb-dash .fd-pay-terms b {
  color: #2d3132;
}

.flxb-dash .fd-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 17px 14px;
}

.flxb-dash .fd-trust span {
  font-size: 10.5px;
  color: #6b706e;
  background: #f4f5f5;
  border-radius: 999px;
  padding: 5px 9px;
}

.flxb-dash .fd-pay-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 13px 17px;
  border-top: 1px solid #eef0ef;
  background: #fbfcfb;
}

.flxb-dash .fd-pay-actions button {
  height: 42px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 760;
}

.flxb-dash .fd-pay-confirm {
  border: 1px solid var(--fd-brand);
  background: var(--fd-brand);
  color: #fff;
}

.flxb-dash .fd-pay-confirm:hover:not(:disabled) {
  background: #04aa52;
}

.flxb-dash .fd-pay-revise {
  border: 1px solid #dfe3e1;
  background: #fff;
  color: #3f4542;
}

.flxb-dash .fd-pay-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.flxb-dash .fd-pay-note {
  margin-top: 14px;
  font-size: 12px;
  color: #8a8e91;
  border: 1px dashed var(--fd-line);
  border-radius: 12px;
  padding: 10px 12px;
}

.flxb-dash .fd-pay-note.is-paid {
  border-style: solid;
  border-color: #ccefd8;
  color: #08743e;
  background: #f5fcf7;
}

.flxb-dash .fd-pay-checking {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #e1e5e3;
  background: #fbfcfb;
  border-radius: 16px;
  padding: 14px 15px;
  color: #3f4543;
}

.flxb-dash .fd-pay-checking .fd-spin {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.flxb-dash .fd-pay-checking b,
.flxb-dash .fd-pay-confirmed b {
  display: block;
  font-size: 13px;
}

.flxb-dash .fd-pay-checking span:not(.fd-spin),
.flxb-dash .fd-pay-confirmed span:not(.fd-confirmed-icon) {
  display: block;
  font-size: 11.5px;
  color: #858b88;
  margin-top: 3px;
}

.flxb-dash .fd-pay-confirmed {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbeed8;
  background: #f5fcf7;
  border-radius: 18px;
  padding: 15px 16px;
  /* Sits under the receipt, so the gap belongs above it — a margin below would
     only add a trailing space at the end of the message. */
  margin-top: 10px;
}

.flxb-dash .fd-pay-confirmed b {
  color: #245c3d;
}

.flxb-dash .fd-confirmed-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--fd-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 900;
  flex: none;
}

.flxb-dash .fd-receipt {
  border: 1px solid #e1e5e3;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(20, 24, 22, 0.045);
}

.flxb-dash .fd-receipt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid #eef0ef;
}

.flxb-dash .fd-receipt-top b {
  font-size: 13px;
}

.flxb-dash .fd-receipt-body {
  padding: 8px 15px;
}

.flxb-dash .fd-receipt-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid #f0f1f0;
  font-size: 12px;
}

.flxb-dash .fd-receipt-row:last-child {
  border-bottom: 0;
}

.flxb-dash .fd-receipt-row span {
  color: #8a8e8c;
}

.flxb-dash .fd-receipt-row strong {
  color: #353a38;
  text-align: right;
}

.flxb-dash .fd-receipt-actions {
  display: flex;
  justify-content: flex-end;
  padding: 11px 15px;
  border-top: 1px solid #eef0ef;
  background: #fbfcfb;
}

.flxb-dash .fd-share-receipt {
  height: 34px;
  border: 1px solid #dfe3e1;
  background: #fff;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 760;
  color: #3f4542;
}

/* Came from a profile: the requested person's availability, above the cards. */
.flxb-dash .fd-unavailable {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #3f4542;
}

.flxb-dash .fd-unavailable b {
  font-weight: 760;
  color: #141816;
}

@media (max-width: 640px) {
  .flxb-dash .fd-system-turn {
    margin-left: 0;
  }

  .flxb-dash .fd-pay-grid {
    grid-template-columns: 1fr;
  }

  .flxb-dash .fd-qr {
    width: 160px;
    height: 160px;
  }

  .flxb-dash .fd-pay-actions {
    grid-template-columns: 1fr;
  }
}
