:root {
  --brand: #0b5cab;
  --brand-strong: #084987;
  --brand-soft: #eaf3fb;
  --surface: #ffffff;
  --surface-muted: #f5f7fa;
  --page: #edf2f7;
  --text: #172033;
  --muted: #667085;
  --border: #d8e0ea;
  --success: #16803a;
  --danger: #b42318;
  --shadow: 0 18px 55px rgba(16, 24, 40, .14);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(11, 92, 171, .10), transparent 30rem),
    linear-gradient(180deg, #f8fafc 0%, var(--page) 100%);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.chat-shell {
  width: min(920px, 100%);
  height: min(860px, calc(100vh - 56px));
  min-height: 620px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--surface);
  border: 1px solid rgba(216, 224, 234, .9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #0b5cab, #1477c9);
  color: #fff;
}
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
}
.brand-mark svg { width: 24px; height: 24px; fill: currentColor; }
.brand-copy { min-width: 0; }
.brand-copy h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.brand-copy p { margin: 3px 0 0; font-size: 13px; color: rgba(255,255,255,.78); }
.status-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.20);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #7ee2a8; box-shadow: 0 0 0 3px rgba(126,226,168,.16); }

.security-note {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px 22px;
  color: #344054;
  background: #f8fbff;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.security-note svg { width: 16px; height: 16px; fill: var(--brand); flex: 0 0 auto; }

#webchat {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;

  position: relative;
  overflow: hidden;

  background: transparent !important;
}
.chat-footer { padding: 9px 16px; text-align: center; font-size: 11px; color: #98a2b3; border-top: 1px solid var(--border); background: #fff; }

/* Current Bot Framework Web Chat */
#webchat .webchat__basic-transcript,
#webchat .webchat__basic-transcript__scrollable { background: var(--surface-muted) !important; }
#webchat .webchat__basic-transcript__scrollable { padding: 18px 20px 26px !important; }
#webchat .webchat__bubble__content {
  border-radius: 16px !important;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06) !important;
  line-height: 1.48 !important;
}
#webchat .webchat__bubble--from-bot .webchat__bubble__content,
#webchat .webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
  border: 1px solid #e2e8f0 !important;
}
#webchat .webchat__bubble--from-user .webchat__bubble__content { box-shadow: 0 5px 16px rgba(11, 92, 171, .18) !important; }
#webchat .webchat__avatar { filter: drop-shadow(0 2px 4px rgba(16,24,40,.12)); }

/* Adaptive Cards used by password reset / OTP flow */
#webchat .ac-adaptiveCard {
  font-family: "Segoe UI", Inter, system-ui, sans-serif !important;
  color: var(--text) !important;
}
#webchat .ac-container {
  border-radius: var(--radius-md);
}
#webchat .ac-textBlock { line-height: 1.45 !important; }
#webchat .ac-textInput {
  min-height: 44px !important;
  padding: 10px 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: var(--radius-sm) !important;
  background: #fff !important;
  color: var(--text) !important;
  font-size: 15px !important;
  outline: none !important;
  transition: border-color .18s ease, box-shadow .18s ease !important;
}
#webchat .ac-textInput:hover { border-color: #94a3b8 !important; }
#webchat .ac-textInput:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px rgba(11, 92, 171, .14) !important;
}
#webchat .ac-pushButton {
  min-height: 42px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  padding: 9px 16px !important;
  font: 600 14px/1.2 "Segoe UI", Inter, system-ui, sans-serif !important;
  background: var(--brand) !important;
  color: #fff !important;
  cursor: pointer !important;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease !important;
}
#webchat .ac-pushButton:hover:not(:disabled) { background: var(--brand-strong) !important; box-shadow: 0 5px 14px rgba(11, 92, 171, .18) !important; }
#webchat .ac-pushButton:active:not(:disabled) { transform: translateY(1px); }
#webchat .ac-pushButton:focus-visible { outline: 3px solid rgba(11, 92, 171, .22) !important; outline-offset: 2px; }
#webchat .ac-pushButton:disabled { background: #e4e7ec !important; color: #98a2b3 !important; cursor: not-allowed !important; box-shadow: none !important; }
#webchat button[title^="Resend code"] { background: transparent !important; color: var(--brand) !important; border-color: #b8c9db !important; }
#webchat button[title^="Resend code"]:hover:not(:disabled) { background: var(--brand-soft) !important; }

/* Legacy BotChat fallback */
#webchat .wc-chatview-panel { background: var(--surface-muted); }
#webchat .wc-message-content { border-radius: 15px; box-shadow: 0 1px 2px rgba(16,24,40,.08); padding: 10px 12px; }
#webchat .wc-message-from-bot .wc-message-content { background: #fff; border: 1px solid #e2e8f0; color: var(--text); }
#webchat .wc-message-from-me .wc-message-content { background: var(--brand); color: #fff; }
#webchat .wc-card { border-radius: 14px; border-color: #e2e8f0; overflow: hidden; }

/* Small UX polish */
#passwordInvalidBlock { color: var(--danger) !important; background: #fff4f2; border: 1px solid #fecdca; border-radius: 10px; padding: 9px 11px; }
#sendingText, #sentText { font-size: 13px; }
#sentText { color: var(--success); }

@media (max-width: 720px) {
  .app-shell { padding: 0; }
  .chat-shell { width: 100%; height: 100vh; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .chat-header { padding: 15px 16px; }
  .security-note { padding: 9px 16px; }
  #webchat .webchat__basic-transcript__scrollable { padding: 14px 12px 22px !important; }
  .status-pill { padding: 5px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* =========================================================
   Final avatar visual-balance fix
   Keep the Web Chat avatar container size unchanged, but
   size the visible bot and user artwork independently.
   ========================================================= */

/* BRG bot avatar artwork */
#webchat .webchat__basic-transcript__activity:not(.webchat__basic-transcript__activity--from-user) img {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    object-fit: contain !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* User avatar artwork */
#webchat .webchat__basic-transcript__activity--from-user img {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    object-fit: contain !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Preserve a clean transparent user avatar container */
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout__avatar,
#webchat .webchat__basic-transcript__activity--from-user [class*="stacked-layout__avatar"] {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* =========================================================
   FINAL USER AVATAR SIZE OVERRIDE
   Tight-cropped user avatar image inside the 40px Web Chat
   avatar slot. Keep this at the VERY END of the stylesheet.
   ========================================================= */

#webchat
.webchat__basic-transcript__activity--from-user
.webchat__stacked-layout__avatar,
#webchat
.webchat__basic-transcript__activity--from-user
[class*="stacked-layout__avatar"] {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;

    background: transparent !important;
    border: none !important;
    box-shadow: none !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    margin: 0 !important;
}

/* Let the tightly-cropped user image nearly fill the avatar slot */
#webchat
.webchat__basic-transcript__activity--from-user
.webchat__stacked-layout__avatar img,
#webchat
.webchat__basic-transcript__activity--from-user
[class*="stacked-layout__avatar"] img {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;

    object-fit: contain !important;

    background: transparent !important;
    border: none !important;
    box-shadow: none !important;

    padding: 0 !important;
    margin: 0 !important;
}

/* Keep user-side spacing tidy */
#webchat
.webchat__basic-transcript__activity--from-user {
    padding-right: 4px !important;
    margin-right: 0 !important;
}

/* =========================================================
   Remove visible color seam between chat and page background
   ========================================================= */

html,
body,
#webchat,
#webchat > div,
#webchat .webchat__basic-transcript,
#webchat .webchat__basic-transcript__scrollable,
#webchat .webchat__basic-transcript__transcript {
    background-color: transparent !important;
}

/* Use one continuous page background */
body {
    background:
        radial-gradient(
            circle at 15% 15%,
            rgba(0, 150, 214, 0.10),
            transparent 42%
        ),
        linear-gradient(
            135deg,
            #F3F8FC 0%,
            #F7FAFC 50%,
            #EEF5FA 100%
        ) !important;
}

/* Prevent Web Chat from painting an opaque strip */
#webchat .webchat__basic-transcript__scrollable,
#webchat .webchat__basic-transcript__transcript {
    box-shadow: none !important;
    border: none !important;
}

/* Remove faint rectangular wrapper around user messages */
#webchat .webchat__basic-transcript__activity--from-user,
#webchat .webchat__basic-transcript__activity--from-user .webchat__basic-transcript__activity-body,
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout,
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout__main,
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout__content,
#webchat .webchat__basic-transcript__activity--from-user .webchat__bubble {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Keep the actual user bubble blue and rounded */
#webchat .webchat__basic-transcript__activity--from-user .webchat__bubble__content {
    background: #0096D6 !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}

/* NEW: remove Web Chat nub padding */
#webchat .webchat__bubble--from-user .webchat__bubble__nub-pad {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove remaining wrapper/pseudo-element rectangle around user messages */
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout__message-row,
#webchat .webchat__basic-transcript__activity--from-user .webchat__stacked-layout__message,
#webchat .webchat__bubble--from-user::before,
#webchat .webchat__bubble--from-user::after,
#webchat .webchat__bubble--from-user .webchat__bubble__content::before,
#webchat .webchat__bubble--from-user .webchat__bubble__content::after {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Keep only the actual rounded blue user bubble */
#webchat .webchat__bubble--from-user .webchat__bubble__content {
    background: #0096D6 !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: 16px !important;
    box-shadow: none !important;
}


/* =========================================================
   BRG gradient + large background logo
   ========================================================= */

html,
body {
    min-height: 100%;
}

body {
    position: relative;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 12% 10%,
            rgba(0, 150, 214, 0.18) 0%,
            rgba(0, 150, 214, 0.07) 28%,
            transparent 58%
        ),
        radial-gradient(
            circle at 88% 85%,
            rgba(11, 92, 171, 0.14) 0%,
            transparent 48%
        ),
        linear-gradient(
            135deg,
            #eef8fd 0%,
            #f8fbfd 48%,
            #e8f4fa 100%
        ) !important;
}

/* Large BRG watermark */
body::before {
    content: "";

    position: fixed;
    z-index: 0;

    width: min(72vw, 900px);
    height: min(72vw, 900px);

    right: -10vw;
    bottom: -18vh;

    background-image: url("../images/brg_logo_new.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    opacity: 0.045;

    pointer-events: none;
}

/* Keep Web Chat above the watermark */
#webchat {
    position: relative;
    z-index: 1;

    background: transparent !important;
}

#webchat > div,
#webchat .webchat__basic-transcript,
#webchat .webchat__basic-transcript__scrollable,
#webchat .webchat__basic-transcript__transcript {
    background: transparent !important;
}

@media (max-width: 768px) {

    body {
        background:
            radial-gradient(
                circle at 80% 12%,
                rgba(0, 150, 214, 0.16),
                transparent 42%
            ),
            linear-gradient(
                160deg,
                #edf8fd 0%,
                #f8fbfd 48%,
                #e5f2f9 100%
            ) !important;
    }

    body::before {
        width: 125vw;
        height: 125vw;

        right: -48vw;
        bottom: 5vh;

        opacity: 0.04;
    }
}

/* =========================================================
   Stable Web Chat viewport height fix
   Keeps page fixed while Web Chat owns transcript scrolling.
   ========================================================= */
@media (max-width: 768px) {
    #webchat {
        height: 100vh;
        height: 100dvh;
    }
}

/* =========================================================
   Resend code button - CSS ONLY
   Keeps original pwresetfunctions.js behavior intact.
   ========================================================= */

#webchat button[title^="Resend code"] {
    width: 100% !important;
    min-height: 42px !important;

    background: #0b5cab !important;
    color: #ffffff !important;

    border: 1px solid #0b5cab !important;
    border-radius: 10px !important;

    font-weight: 600 !important;
    box-shadow: none !important;
}

/* Countdown / disabled resend state */
#webchat button[title^="Resend code"]:disabled {
    background: #e4e7ec !important;
    color: #98a2b3 !important;
    border-color: #e4e7ec !important;

    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* Enabled resend state */
#webchat button[title^="Resend code"]:not(:disabled) {
    background: #0b5cab !important;
    color: #ffffff !important;
    border-color: #0b5cab !important;

    cursor: pointer !important;
}

/* Hover only when resend is enabled */
#webchat button[title^="Resend code"]:not(:disabled):hover {
    background: #084987 !important;
    border-color: #084987 !important;
}

/* Adaptive Card number input */
#webchat .ac-numberInput {
    width: 100% !important;
    min-height: 44px !important;
    padding: 10px 12px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    color: #172033 !important;
    box-sizing: border-box !important;
    outline: none !important;
}

#webchat .ac-numberInput:focus {
    border-color: #0b8edb !important;
    box-shadow: 0 0 0 2px rgba(11, 142, 219, 0.12) !important;
}