/* Ask Excalibur — isolated chatbot styles. */
:root {
  --ae-ink: #0d0f12;
  --ae-panel: #f6f6f4;
  --ae-paper: #ffffff;
  --ae-muted: #666b72;
  --ae-line: #b8bcc1;
  --ae-silver: linear-gradient(135deg,#f4f5f6 0%,#bfc4c9 22%,#f9fafb 45%,#9ca3aa 70%,#e5e7e9 100%);
  --ae-shadow: 0 18px 55px rgba(0,0,0,.28);
}

.ask-excalibur-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9995;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 54px;
  padding: .6rem .95rem .6rem .65rem;
  border: 1px solid #aeb3b8;
  border-radius: 999px;
  background: #111317;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.12);
  font: 700 .88rem/1 var(--sans, Manrope, sans-serif);
  letter-spacing: .01em;
  cursor: pointer;
}
.ask-excalibur-launcher:hover { transform: translateY(-1px); }
.ask-excalibur-launcher img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255,255,255,.28);
}
.ask-excalibur-launcher-label { white-space: nowrap; }

.ask-excalibur-panel {
  position: fixed;
  right: 22px;
  bottom: 88px;
  z-index: 9996;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 116px));
  min-height: 470px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid #aeb3b8;
  border-radius: 18px;
  background: var(--ae-panel);
  color: var(--ae-ink);
  box-shadow: var(--ae-shadow);
  font-family: var(--sans, Manrope, sans-serif);
}
.ask-excalibur-panel[hidden] { display: none !important; }

.ask-excalibur-header {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .82rem .9rem;
  background: #111317;
  color: #fff;
  border-bottom: 1px solid #33363b;
}
.ask-excalibur-header img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}
.ask-excalibur-header-copy { min-width: 0; flex: 1; }
.ask-excalibur-title { display: block; font-size: .97rem; font-weight: 800; }
.ask-excalibur-subtitle { display: block; margin-top: .13rem; font-size: .72rem; color: #cfd2d5; font-weight: 500; }
.ask-excalibur-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}

.ask-excalibur-body {
  overflow-y: auto;
  padding: 1rem .9rem 1.1rem;
  scroll-behavior: smooth;
}
.ask-excalibur-message {
  max-width: 88%;
  margin: 0 0 .72rem;
  padding: .72rem .82rem;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ask-excalibur-message.bot {
  background: var(--ae-paper);
  border: 1px solid #d8dbde;
  border-top-left-radius: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.ask-excalibur-message.user {
  margin-left: auto;
  background: #17191d;
  color: #fff;
  border-top-right-radius: 5px;
}
.ask-excalibur-message.system {
  max-width: 100%;
  background: #eceeef;
  color: #4a4f55;
  border: 1px solid #d5d8db;
  font-size: .76rem;
}

.ask-excalibur-quick-title {
  margin: .25rem 0 .55rem;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #454a50;
}
.ask-excalibur-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .8rem;
}
.ask-excalibur-quick {
  min-height: 54px;
  padding: .55rem .62rem;
  border: 1px solid #aeb3b8;
  border-radius: 10px;
  background: linear-gradient(180deg,#fff,#e8eaec);
  color: #17191c;
  font: 750 .76rem/1.25 var(--sans, Manrope, sans-serif);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 5px rgba(0,0,0,.05);
}
.ask-excalibur-quick:hover { border-color: #737980; transform: translateY(-1px); }

.ask-excalibur-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin: .1rem 0 .75rem;
}
.ask-excalibur-action {
  border: 1px solid #9aa0a6;
  border-radius: 999px;
  padding: .47rem .67rem;
  background: #fff;
  color: #17191c;
  font: 750 .72rem/1 var(--sans, Manrope, sans-serif);
  cursor: pointer;
}
.ask-excalibur-action.primary {
  background: #15171a;
  color: #fff;
  border-color: #15171a;
}

.ask-excalibur-composer {
  padding: .7rem .75rem .72rem;
  background: #fff;
  border-top: 1px solid #d7dade;
}
.ask-excalibur-input-row { display: flex; gap: .48rem; align-items: flex-end; }
.ask-excalibur-input {
  resize: none;
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  padding: .64rem .72rem;
  border: 1px solid #b9bec3;
  border-radius: 12px;
  background: #fafafa;
  color: #111317;
  font: 500 .82rem/1.35 var(--sans, Manrope, sans-serif);
}
.ask-excalibur-input:focus { outline: 2px solid #70767d; outline-offset: 1px; }
.ask-excalibur-send {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  background: #15171a;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
.ask-excalibur-send:disabled { opacity: .5; cursor: wait; }
.ask-excalibur-fineprint {
  margin: .43rem .15rem 0;
  font-size: .62rem;
  line-height: 1.35;
  color: #70757b;
}

.ask-excalibur-lead-card {
  padding: .8rem;
  margin: .3rem 0 .8rem;
  border: 1px solid #c4c8cc;
  border-radius: 12px;
  background: #fff;
}
.ask-excalibur-lead-card h3 { margin: 0 0 .3rem; font-size: .92rem; }
.ask-excalibur-lead-card p { margin: 0 0 .65rem; font-size: .72rem; line-height: 1.45; color: #555b61; }
.ask-excalibur-lead-card label { display: block; margin: .48rem 0 .2rem; font-size: .68rem; font-weight: 800; }
.ask-excalibur-lead-card input,
.ask-excalibur-lead-card textarea {
  width: 100%;
  border: 1px solid #bcc1c6;
  border-radius: 8px;
  padding: .55rem .6rem;
  background: #fbfbfb;
  font: 500 .76rem/1.35 var(--sans, Manrope, sans-serif);
}
.ask-excalibur-lead-card textarea { min-height: 76px; resize: vertical; }
.ask-excalibur-lead-submit {
  width: 100%;
  margin-top: .7rem;
  border: 1px solid #6e7378;
  border-radius: 9px;
  padding: .65rem .75rem;
  background: #16181b;
  color: #fff;
  font: 800 .76rem/1 var(--sans, Manrope, sans-serif);
  cursor: pointer;
}
.ask-excalibur-lead-status { margin-top: .5rem !important; }
.ask-excalibur-link { color: #17191c; font-weight: 800; }
.ask-excalibur-typing { opacity: .65; font-style: italic; }

@media (max-width: 640px) {
  .ask-excalibur-launcher { right: 12px; bottom: 12px; min-height: 50px; }
  .ask-excalibur-panel {
    right: 10px;
    bottom: 72px;
    width: calc(100vw - 20px);
    height: min(660px, calc(100dvh - 84px));
    border-radius: 15px;
  }
  .ask-excalibur-quick-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .ask-excalibur-launcher:hover,
  .ask-excalibur-quick:hover { transform: none; }
}

/* Guided pain-pathway additions */
.ask-excalibur-path-step { margin: .15rem 0 .8rem; }
.ask-excalibur-path-grid .ask-excalibur-quick:disabled {
  opacity: .58;
  cursor: default;
  transform: none;
}
.ask-excalibur-consult-handoff {
  margin: .3rem 0 .85rem;
  padding: .85rem;
  border: 1px solid #b8bdc2;
  border-radius: 12px;
  background: linear-gradient(180deg,#fff,#f0f1f2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 4px 14px rgba(0,0,0,.06);
}
.ask-excalibur-consult-handoff p {
  margin: 0 0 .7rem;
  font-size: .76rem;
  line-height: 1.5;
  color: #2f3338;
}
.ask-excalibur-consult-button {
  display: block;
  width: 100%;
  padding: .72rem .8rem;
  border: 1px solid #6f7479;
  border-radius: 9px;
  background: #15171a;
  color: #fff;
  font: 800 .76rem/1.1 var(--sans, Manrope, sans-serif);
  text-align: center;
  text-decoration: none;
}

/* Rev 71: Guided pathways only — hide free-form Ask Me Anything composer */
.ask-excalibur-composer { display: none !important; }

/* Rev 72: compact guided-only panel + branded subtitle */
.ask-excalibur-panel {
  height: auto !important;
  min-height: 0 !important;
  max-height: min(650px, calc(100vh - 116px));
  grid-template-rows: auto minmax(0, auto) !important;
}
.ask-excalibur-body {
  max-height: calc(100vh - 210px);
}
.ask-excalibur-subtitle {
  font-size: 0 !important;
}
.ask-excalibur-subtitle::after {
  content: "Sharpen Your Advantage";
  font-size: .72rem;
  color: #cfd2d5;
  font-weight: 500;
}
@media (max-width: 640px) {
  .ask-excalibur-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 84px);
  }
  .ask-excalibur-body {
    max-height: calc(100dvh - 175px);
  }
}


/* Rev 117: definitive desktop scroll fix.
   Undo Rev72's auto-height/auto-row behavior and make the message body the
   single scroll container, matching the reliable mobile structure. */
@media (min-width: 641px) {
  .ask-excalibur-panel {
    display: flex !important;
    flex-direction: column !important;
    width: min(390px, calc(100vw - 28px));
    height: min(650px, calc(100dvh - 116px)) !important;
    min-height: 470px !important;
    max-height: min(650px, calc(100dvh - 116px)) !important;
    overflow: hidden !important;
  }
  .ask-excalibur-panel[hidden] { display: none !important; }
  .ask-excalibur-header {
    position: relative !important;
    top: auto !important;
    flex: 0 0 auto !important;
    z-index: 2;
  }
  .ask-excalibur-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scroll-padding-bottom: 1.5rem;
    padding-bottom: 2rem !important;
  }
}
