.fico-agent {
    --fico-agent-navy: #061b31;
    --fico-agent-navy-2: #0b2947;
    --fico-agent-cyan: #08bdf2;
    --fico-agent-lime: #d5ed00;
    --fico-agent-ink: #07192c;
    --fico-agent-muted: #617184;
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 99990;
    font-family: Poppins, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--fico-agent-ink);
    color-scheme: light;
    isolation: isolate;
}

.fico-agent--left {
    right: auto;
    left: max(20px, env(safe-area-inset-left));
}

.fico-agent *,
.fico-agent *::before,
.fico-agent *::after {
    box-sizing: border-box;
}

.fico-agent button,
.fico-agent textarea {
    font: inherit;
}

.fico-agent__launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 70px;
    max-width: 280px;
    padding: 5px 18px 5px 5px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: var(--fico-agent-navy);
    color: #fff;
    box-shadow: 0 16px 50px rgba(0, 13, 28, .28);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.fico-agent__launcher:hover,
.fico-agent__launcher:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 20px 54px rgba(0, 13, 28, .38);
    outline: 3px solid rgba(8,189,242,.35);
    outline-offset: 3px;
}

.fico-agent__launcher-image {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    overflow: hidden;
    flex: 0 0 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #0e4168, #082039);
}

.fico-agent__launcher-image img {
    width: 68px;
    height: 68px;
    object-fit: contain;
    object-position: center 4px;
}

.fico-agent__launcher-copy {
    min-width: 0;
    text-align: left;
    line-height: 1.15;
}

.fico-agent__launcher-copy small,
.fico-agent__launcher-copy strong {
    display: block;
}

.fico-agent__launcher-copy small {
    margin-bottom: 4px;
    color: var(--fico-agent-cyan);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.fico-agent__launcher-copy strong {
    font-size: 14px;
    font-weight: 800;
}

.fico-agent__panel {
    display: flex;
    flex-direction: column;
    width: min(440px, calc(100vw - 32px));
    height: min(700px, calc(100dvh - 40px));
    overflow: hidden;
    border: 1px solid rgba(6,27,49,.12);
    border-radius: 26px;
    background: #f4f7fa;
    box-shadow: 0 28px 90px rgba(0, 16, 34, .28);
    transform-origin: bottom right;
    animation: fico-agent-in .22s ease-out;
}

.fico-agent__panel[hidden] {
    display: none;
}

.fico-agent--left .fico-agent__panel {
    transform-origin: bottom left;
}

.fico-agent.is-open .fico-agent__launcher {
    display: none;
}

.fico-agent__header {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 36px;
    align-items: center;
    gap: 12px;
    min-height: 88px;
    padding: 12px 14px;
    background: var(--fico-agent-navy);
    color: #fff;
    flex: 0 0 auto;
}

.fico-agent__header > img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    object-position: center 3px;
    border-radius: 50%;
    background: var(--fico-agent-navy-2);
}

.fico-agent__header strong,
.fico-agent__header span {
    display: block;
}

.fico-agent__header strong {
    overflow: hidden;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fico-agent__header span {
    margin-top: 5px;
    color: #d2dce5;
    font-size: 12px;
}

.fico-agent__header i {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--fico-agent-lime);
    box-shadow: 0 0 0 3px rgba(213,237,0,.12);
}

.fico-agent__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 27px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.fico-agent__close:hover,
.fico-agent__close:focus-visible {
    background: rgba(255,255,255,.18);
    outline: 2px solid var(--fico-agent-cyan);
}

.fico-agent__messages {
    min-height: 0;
    flex: 1 1 auto;
    padding: 22px 18px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.fico-agent__message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0 0 14px;
}

.fico-agent__message--user {
    justify-content: flex-end;
}

.fico-agent__message > img {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    object-fit: contain;
    border-radius: 50%;
    background: var(--fico-agent-navy-2);
}

.fico-agent__bubble {
    max-width: 90%;
    padding: 14px 16px;
    border-radius: 17px 17px 17px 5px;
    background: #fff;
    box-shadow: 0 4px 18px rgba(12,40,65,.08);
    color: #17324b !important;
    font-size: 15px !important;
    font-weight: 400;
    line-height: 1.62 !important;
    letter-spacing: 0;
}

.fico-agent__message--user .fico-agent__bubble {
    border-radius: 17px 17px 5px 17px;
    background: var(--fico-agent-navy-2);
    color: #fff !important;
}

.fico-agent__bubble p {
    margin: 0 0 8px;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
}

.fico-agent__bubble p:last-child {
    margin-bottom: 0;
}

.fico-agent__thinking .fico-agent__bubble {
    color: #53697d !important;
}

.fico-agent__thinking .fico-agent__bubble::after {
    content: "";
    display: inline-block;
    width: 24px;
    height: 5px;
    margin-left: 7px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--fico-agent-cyan) 30%, transparent 30% 40%, var(--fico-agent-cyan) 40% 70%, transparent 70% 80%, var(--fico-agent-cyan) 80%);
    animation: fico-agent-pulse .9s ease-in-out infinite;
}

.fico-agent__sources {
    padding-top: 10px;
    margin-top: 11px;
    border-top: 1px solid #dfe7ee;
}

.fico-agent__sources strong {
    display: block;
    margin-bottom: 5px;
    color: #4d6276;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.fico-agent__sources ol {
    padding-left: 20px;
    margin: 0;
}

.fico-agent__sources li {
    margin: 4px 0;
    color: #17324b !important;
    font-size: 12.5px !important;
    line-height: 1.45 !important;
}

.fico-agent__sources a {
    color: #006e9d !important;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.fico-agent__quick {
    display: flex;
    gap: 7px;
    padding: 4px 16px 10px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 0 0 auto;
}

.fico-agent__quick::-webkit-scrollbar {
    display: none;
}

.fico-agent__quick button {
    flex: 0 0 auto;
    max-width: 240px;
    padding: 9px 13px;
    border: 1px solid #b9cfdb;
    border-radius: 999px;
    background: #fff;
    color: #173852 !important;
    font-size: 11.5px !important;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
}

.fico-agent__quick button:hover,
.fico-agent__quick button:focus-visible {
    border-color: var(--fico-agent-cyan);
    outline: 2px solid rgba(8,189,242,.2);
}

.fico-agent__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 43px;
    align-items: end;
    gap: 8px;
    min-height: 64px;
    padding: 9px 12px;
    border-top: 1px solid #dce5ec;
    background: #fff;
    flex: 0 0 auto;
}

.fico-agent__form textarea {
    width: 100%;
    max-height: 112px;
    min-height: 43px;
    resize: none;
    padding: 11px 13px;
    border: 1px solid #c9d7e0;
    border-radius: 14px;
    background: #f8fafc;
    color: #102b43 !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
}

.fico-agent__form textarea:focus {
    border-color: var(--fico-agent-cyan);
    box-shadow: 0 0 0 3px rgba(8,189,242,.15);
    outline: 0;
}

.fico-agent__form button {
    display: grid;
    place-items: center;
    width: 43px;
    height: 43px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    background: var(--fico-agent-lime);
    color: var(--fico-agent-navy);
    font-size: 24px;
    font-weight: 900;
    cursor: pointer;
}

.fico-agent__form button:hover,
.fico-agent__form button:focus-visible {
    filter: brightness(.95);
    outline: 2px solid var(--fico-agent-navy);
    outline-offset: 2px;
}

.fico-agent__form button:disabled,
.fico-agent__form textarea:disabled {
    cursor: wait;
    opacity: .65;
}

.fico-agent__website {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.fico-agent__disclosure {
    min-height: 43px;
    padding: 7px 18px 10px;
    margin: 0;
    background: #fff;
    color: #53697d !important;
    font-size: 10px !important;
    line-height: 1.45 !important;
    text-align: center;
    flex: 0 0 auto;
}

.fico-agent .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/*
 * Contrast isolation. The theme uses contextual text colors for dark sections;
 * these deliberately stronger rules keep those colors out of the white chat UI.
 */
.fico-agent .fico-agent__message--assistant .fico-agent__bubble,
.fico-agent .fico-agent__message--assistant .fico-agent__bubble p,
.fico-agent .fico-agent__message--assistant .fico-agent__bubble li,
.fico-agent .fico-agent__message--assistant .fico-agent__bubble span,
.fico-agent .fico-agent__message--assistant .fico-agent__bubble strong {
    color: #17324b !important;
}

.fico-agent .fico-agent__message--user .fico-agent__bubble,
.fico-agent .fico-agent__message--user .fico-agent__bubble p,
.fico-agent .fico-agent__message--user .fico-agent__bubble span,
.fico-agent .fico-agent__header,
.fico-agent .fico-agent__header strong,
.fico-agent .fico-agent__close {
    color: #fff !important;
}

.fico-agent .fico-agent__header span {
    color: #d2dce5 !important;
}

.fico-agent .fico-agent__sources strong,
.fico-agent .fico-agent__disclosure {
    color: #4d6276 !important;
}

.fico-agent .fico-agent__sources a {
    color: #006e9d !important;
}

.fico-agent .fico-agent__quick button,
.fico-agent .fico-agent__form textarea,
.fico-agent .fico-agent__form textarea::placeholder {
    color: #17324b !important;
    opacity: 1 !important;
}

@keyframes fico-agent-in {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fico-agent-pulse {
    50% { opacity: .35; }
}

@media (max-width: 600px) {
    .fico-agent,
    .fico-agent--left {
        right: 10px;
        bottom: max(10px, env(safe-area-inset-bottom));
        left: auto;
    }

    .fico-agent__launcher {
        max-width: 72px;
        min-height: 72px;
        padding: 6px;
    }

    .fico-agent__launcher-copy {
        display: none;
    }

    .fico-agent__panel {
        width: calc(100vw - 20px);
        height: min(720px, calc(100dvh - 20px));
        border-radius: 22px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .fico-agent__panel,
    .fico-agent__launcher,
    .fico-agent__thinking .fico-agent__bubble::after {
        animation: none;
        transition: none;
    }
}
