/* bankstatementloanaz.com — lead-qualifier chat widget (V1, scripted).
   Reuses the site's :root tokens when present, with literal fallbacks so the
   widget also renders standalone. No @import / no web fonts / no network. */

.fnc-root {
  /* Map site tokens -> local vars with fallbacks (on-site AND standalone). */
  --fnc-navy:       var(--navy, #0a1f38);
  --fnc-navy-deep:  var(--navy-deep, #081a30);
  --fnc-ink:        var(--ink, #0e2a4a);
  --fnc-brand:      var(--brand, #17457e);
  --fnc-brand-050:  var(--brand-050, #eef4fb);
  --fnc-brand-100:  var(--brand-100, #d8e6f5);
  --fnc-cta:        var(--cta, #1f6fd6);
  --fnc-cta-600:    var(--cta-600, #1a5cb3);
  --fnc-slate:      var(--slate, #46586d);
  --fnc-muted:      var(--muted, #5f7186);
  --fnc-gold:       var(--gold, #c9a860);
  --fnc-line:       var(--line, #e3eaf2);
  --fnc-bg:         var(--bg, #ffffff);
  --fnc-bg-soft:    var(--bg-soft, #f6fafd);
  --fnc-on-dark:    var(--on-dark, #f4f8fc);
  --fnc-on-dark-muted: var(--on-dark-muted, #b7c6d8);
  --fnc-r:          var(--r-sm, 6px);
  --fnc-font-serif: var(--font-serif, "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif);
  --fnc-font-sans:  var(--font-sans, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif);
  --fnc-shadow-lg:  var(--shadow-lg, 0 22px 46px -16px rgba(14,42,74,.28));
  --fnc-shadow-md:  var(--shadow-md, 0 6px 18px -6px rgba(14,42,74,.14));
  --fnc-ease:       var(--ease, cubic-bezier(0.25, 0.6, 0.2, 1));

  font-family: var(--fnc-font-sans);
  line-height: 1.5;
}

/* Reset within the widget so host page styles don't bleed in. */
.fnc-root *,
.fnc-root *::before,
.fnc-root *::after { box-sizing: border-box; }

/* ------------------------------------------------------------------ launcher */
.fnc-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9000; /* page z-scale maxes at 50; safely above */
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .72rem 1.15rem .72rem 1rem;
  font-family: var(--fnc-font-sans);
  font-size: .98rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--fnc-on-dark);
  background: var(--fnc-navy);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--fnc-shadow-lg);
  /* hidden until the 2s entrance */
  opacity: 0;
  transform: translateY(14px) scale(.96);
  pointer-events: none;
  transition: opacity .38s var(--fnc-ease), transform .38s var(--fnc-ease), background .18s var(--fnc-ease);
}
.fnc-launcher.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.fnc-launcher:hover { background: var(--fnc-ink); }
.fnc-launcher:focus-visible { outline: 3px solid var(--fnc-cta); outline-offset: 3px; }
.fnc-launcher .fnc-launcher-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fnc-gold); flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(201,168,96,.22);
}
.fnc-root.is-open .fnc-launcher { opacity: 0; transform: translateY(14px) scale(.96); pointer-events: none; }

/* --------------------------------------------------------------------- panel */
.fnc-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9001;
  width: 360px;
  height: 560px;
  max-height: calc(100vh - 40px);
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  background: var(--fnc-bg);
  border: 1px solid var(--fnc-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--fnc-shadow-lg);
  transform-origin: bottom right;
  /* closed state */
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .3s var(--fnc-ease), transform .3s var(--fnc-ease), visibility .3s var(--fnc-ease);
}
.fnc-root.is-open .fnc-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
}

/* header */
.fnc-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .95rem 1rem;
  color: var(--fnc-on-dark);
  background: linear-gradient(160deg, var(--fnc-ink) 0%, var(--fnc-navy) 60%, var(--fnc-navy-deep) 100%);
  border-bottom: 1px solid rgba(201,168,96,.35);
}
.fnc-avatar {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--fnc-font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--fnc-ink);
  background: var(--fnc-on-dark);
  border: 1px solid rgba(201,168,96,.5);
}
.fnc-header-txt { flex: 1 1 auto; min-width: 0; }
.fnc-header-title {
  font-family: var(--fnc-font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fnc-on-dark);
}
.fnc-header-sub {
  font-size: .74rem;
  color: var(--fnc-on-dark-muted);
  margin-top: .1rem;
  display: flex; align-items: center; gap: .34rem;
}
.fnc-header-sub .fnc-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; display: inline-block;
}
.fnc-close {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--fnc-on-dark-muted);
  cursor: pointer;
  font-size: 1.2rem; line-height: 1;
  transition: background .16s var(--fnc-ease), color .16s var(--fnc-ease);
}
.fnc-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.fnc-close:focus-visible { outline: 2px solid var(--fnc-gold); outline-offset: 2px; }

/* message log */
.fnc-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem .9rem .4rem;
  background: var(--fnc-bg-soft);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  scroll-behavior: smooth;
}
.fnc-msg {
  max-width: 84%;
  padding: .6rem .8rem;
  border-radius: 14px;
  font-size: .92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.fnc-msg a { color: inherit; text-decoration: underline; font-weight: 600; }
.fnc-bot {
  align-self: flex-start;
  background: var(--fnc-bg);
  color: var(--fnc-slate);
  border: 1px solid var(--fnc-line);
  border-bottom-left-radius: 5px;
}
.fnc-user {
  align-self: flex-end;
  background: var(--fnc-cta);
  color: #fff;
  border: 1px solid var(--fnc-cta);
  border-bottom-right-radius: 5px;
}
.fnc-user a { color: #fff; }

/* typing indicator */
.fnc-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: .7rem .85rem;
  background: var(--fnc-bg);
  border: 1px solid var(--fnc-line);
  border-radius: 14px;
  border-bottom-left-radius: 5px;
}
.fnc-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fnc-muted);
  animation: fnc-blink 1.1s infinite ease-in-out both;
}
.fnc-typing span:nth-child(2) { animation-delay: .18s; }
.fnc-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes fnc-blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* quick replies */
.fnc-quickreplies {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .1rem .9rem .6rem;
  background: var(--fnc-bg-soft);
}
.fnc-quickreplies:empty { display: none; }
.fnc-chip {
  font-family: var(--fnc-font-sans);
  font-size: .86rem;
  font-weight: 600;
  color: var(--fnc-brand);
  background: var(--fnc-bg);
  border: 1px solid var(--fnc-brand-100);
  border-radius: 999px;
  padding: .44rem .82rem;
  cursor: pointer;
  transition: background .15s var(--fnc-ease), border-color .15s var(--fnc-ease), transform .12s var(--fnc-ease);
}
.fnc-chip:hover { background: var(--fnc-brand-050); border-color: var(--fnc-brand); }
.fnc-chip:active { transform: scale(.97); }
.fnc-chip:focus-visible { outline: 2px solid var(--fnc-cta); outline-offset: 2px; }

/* consent block */
.fnc-consent {
  flex: 0 0 auto;
  padding: .6rem .9rem .9rem;
  background: var(--fnc-bg);
  border-top: 1px solid var(--fnc-line);
}
.fnc-consent-text {
  font-size: .74rem;
  line-height: 1.5;
  color: var(--fnc-muted);
  max-height: 148px;
  overflow-y: auto;
  padding: .55rem .65rem;
  border: 1px solid var(--fnc-line);
  border-radius: 8px;
  background: var(--fnc-bg-soft);
  margin-bottom: .6rem;
}
.fnc-consent-actions { display: flex; gap: .5rem; }
.fnc-btn {
  font-family: var(--fnc-font-sans);
  font-size: .9rem;
  font-weight: 600;
  border-radius: var(--fnc-r);
  padding: .62rem .9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .16s var(--fnc-ease), transform .12s var(--fnc-ease), box-shadow .16s var(--fnc-ease);
}
.fnc-btn:active { transform: scale(.98); }
.fnc-btn:focus-visible { outline: 2px solid var(--fnc-cta); outline-offset: 2px; }
.fnc-btn-primary { flex: 1 1 auto; color: #fff; background: var(--fnc-cta); box-shadow: var(--fnc-shadow-md); }
.fnc-btn-primary:hover { background: var(--fnc-cta-600); }
.fnc-btn-ghost { flex: 0 0 auto; color: var(--fnc-slate); background: var(--fnc-bg); border-color: var(--fnc-line); }
.fnc-btn-ghost:hover { background: var(--fnc-bg-soft); }

/* input row */
.fnc-inputrow {
  flex: 0 0 auto;
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .6rem .7rem;
  border-top: 1px solid var(--fnc-line);
  background: var(--fnc-bg);
}
.fnc-inputrow.is-hidden { display: none; }
.fnc-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--fnc-font-sans);
  font-size: .92rem;
  color: var(--fnc-ink);
  background: var(--fnc-bg);
  border: 1px solid var(--fnc-line);
  border-radius: 999px;
  padding: .55rem .85rem;
  outline: none;
  transition: border-color .16s var(--fnc-ease), box-shadow .16s var(--fnc-ease);
}
.fnc-input:focus {
  border-color: var(--fnc-cta);
  box-shadow: 0 0 0 3px rgba(31,111,214,.16);
}
.fnc-input:disabled { background: var(--fnc-bg-soft); color: var(--fnc-muted); }
.fnc-send {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fnc-cta);
  color: #fff;
  cursor: pointer;
  transition: background .16s var(--fnc-ease), transform .12s var(--fnc-ease);
}
.fnc-send:hover { background: var(--fnc-cta-600); }
.fnc-send:active { transform: scale(.94); }
.fnc-send:disabled { background: var(--fnc-brand-100); cursor: default; }
.fnc-send:focus-visible { outline: 2px solid var(--fnc-cta); outline-offset: 2px; }
.fnc-send svg { width: 18px; height: 18px; }

/* footer trust line */
.fnc-foot {
  flex: 0 0 auto;
  text-align: center;
  font-size: .66rem;
  color: var(--fnc-muted);
  padding: 0 .7rem .5rem;
  background: var(--fnc-bg);
}

/* visually hidden (a11y live-region backup) */
.fnc-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* scrollbar polish (webkit) */
.fnc-log::-webkit-scrollbar, .fnc-consent-text::-webkit-scrollbar { width: 8px; }
.fnc-log::-webkit-scrollbar-thumb, .fnc-consent-text::-webkit-scrollbar-thumb {
  background: var(--fnc-brand-100); border-radius: 8px;
}

/* ----------------------------------------------------- mobile bottom sheet */
@media (max-width: 560px) {
  .fnc-panel {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    transform-origin: bottom center;
  }
  .fnc-root.is-open .fnc-panel { transform: none; }
  .fnc-panel:not(.is-open) { transform: translateY(24px) scale(1); }
  .fnc-launcher { right: 16px; bottom: 16px; }
}

/* --------------------------------------------------- reduced motion => instant */
@media (prefers-reduced-motion: reduce) {
  .fnc-launcher,
  .fnc-panel,
  .fnc-chip,
  .fnc-btn,
  .fnc-send,
  .fnc-input,
  .fnc-close,
  .fnc-log { transition: none !important; }
  .fnc-typing span { animation: none !important; opacity: .5 !important; }
  .fnc-log { scroll-behavior: auto; }
}
