.assistant-dock {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 30;
}

.assistant-launch {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 4px 15px 4px 5px;
    border: 1px solid #c9def0;
    border-radius: 30px;
    color: #123a5c;
    background: #fff;
    box-shadow: 0 6px 22px #092b4a24, 0 1px 3px #092b4a12;
    font-size: .92rem;
    font-weight: 700;
}

.assistant-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(140deg, #dfedff, #c3eff2);
}

.assistant-avatar img {
    position: absolute;
    bottom: 1px;
    left: -4px;
    width: 48px;
    height: 52px;
    object-fit: contain;
    object-position: center bottom;
}

.assistant-launch-arrow {
    color: #38799d;
    font-size: .93rem;
}

.assistant-launch:hover {
    border-color: #88bbd9;
    box-shadow: 0 8px 26px #092b4a33;
}

.assistant-launch[hidden],
.assistant-panel:not([open]),
.assistant-panel [hidden] {
    display: none;
}

.assistant-panel {
    --panel-pad: 22px;
    position: fixed;
    inset: auto max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) auto;
    width: min(404px, calc(100vw - 24px));
    height: min(608px, calc(100vh - 32px));
    height: min(608px, calc(100dvh - 32px));
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 1px solid #dae5ed;
    border-radius: 22px;
    background: #fbfdff;
    color: #123453;
    box-shadow: 0 20px 70px #0b284a41;
    overflow: hidden;
    font-size: .94rem;
    line-height: 1.5;
}

.assistant-panel[open] {
    display: flex;
    flex-direction: column;
}

.assistant-panel:has(.assistant-intake:not([hidden])) {
    height: min(490px, calc(100dvh - 24px - env(safe-area-inset-bottom)));
}

.assistant-panel::backdrop {
    background: #0b223821;
}

body:has(.assistant-panel[open]) {
    overflow: hidden;
}

.assistant-header {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    flex: none;
    min-height: 136px;
    display: flex;
    align-items: center;
    padding: 18px var(--panel-pad);
    border-bottom: 1px solid #d9e9f4;
    color: #103853;
    background: radial-gradient(ellipse at 86% 90%, #b7edf2, transparent 52%),
                linear-gradient(110deg, #f1f7ff 5%, #deedff 65%, #c8e5fa);
}

.assistant-header::before {
    position: absolute;
    z-index: -1;
    content: "";
    right: -3%;
    bottom: -82%;
    width: 54%;
    aspect-ratio: 1;
    border: 1px solid #ffffffa8;
    border-radius: 50%;
    box-shadow: 0 0 0 18px #ffffff28, 0 0 0 37px #ffffff1c;
}

.assistant-brand {
    position: relative;
    z-index: 1;
    max-width: 61%;
}

.assistant-brand img {
    display: block;
    width: 77px;
    height: auto;
    margin-bottom: 12px;
}

.assistant-header h2 {
    margin: 0;
    font-size: clamp(1.34rem, 4vw, 1.48rem);
    line-height: 1.12;
    letter-spacing: -.055em;
}

.assistant-header p {
    margin: 4px 0 0;
    color: #3e6079;
    font-size: .79rem;
}

.assistant-portrait {
    position: absolute;
    right: 34px;
    bottom: -3px;
    width: 34%;
    height: 96%;
}

.assistant-portrait img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
}

.assistant-close {
    position: absolute;
    right: 7px;
    top: 7px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #c9dfea;
    color: #234c66;
    background: #ffffffe8;
}

.assistant-body {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px var(--panel-pad);
    scrollbar-width: thin;
}

.assistant-greeting {
    margin: 0 0 15px;
    font-size: 1.37rem;
    line-height: 1.28;
}

.assistant-reply,
.assistant-selection {
    width: fit-content;
    margin: 0 0 12px;
    padding: 10px 13px;
    font-size: .89rem;
}

.assistant-reply {
    border: 1px solid #dce7f1;
    border-radius: 4px 15px 15px;
    color: #284862;
    background: white;
}

.assistant-selection {
    margin-left: auto;
    border-radius: 14px 14px 4px;
    color: #0f547d;
    background: #e3f2fc;
}

.assistant-grid {
    display: grid;
    gap: 6px;
}

.assistant-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 45px;
    padding: 6px 12px 6px 8px;
    border: 1px solid #dde8f1;
    border-radius: 12px;
    color: #173b57;
    background: white;
    text-align: left;
    font-size: .88rem;
    line-height: 1.34;
    font-weight: 650;
}

.assistant-choice::after {
    content: "";
    width: 6px;
    height: 6px;
    margin-left: auto;
    border-top: 1.5px solid #6391af;
    border-right: 1.5px solid #6391af;
    transform: rotate(45deg);
    flex: none;
}

.assistant-panel[data-screen="home"] .assistant-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.assistant-panel[data-screen="home"] .assistant-choice {
    min-height: 65px;
    align-items: center;
    gap: 9px;
    padding: 10px;
}

.assistant-panel[data-screen="home"] .assistant-choice-icon {
    width: 29px;
    height: 29px;
}

.assistant-panel[data-screen="home"] .assistant-choice::after {
    display: none;
}

.assistant-choice-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #eaf2ff;
    color: #2168c3;
}

.assistant-choice[data-topic="portal"] .assistant-choice-icon,
.assistant-choice[data-topic="access"] .assistant-choice-icon {
    background: #e3f5f2;
    color: #19706c;
}

.assistant-choice[data-topic="team"] .assistant-choice-icon,
.assistant-choice[data-topic="accounting"] .assistant-choice-icon {
    background: #f0edfc;
    color: #665390;
}

.assistant-choice-icon .icon {
    width: 17px;
    height: 17px;
}

.assistant-choice:hover,
.assistant-action:hover {
    background: #f1f8ff;
    border-color: #97bfdf;
}

.assistant-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 7px;
    min-height: 44px;
    padding: 9px 13px;
    border: 1px solid #cddfed;
    border-radius: 10px;
    color: #12578b;
    background: #fff;
    font-size: .86rem;
    font-weight: 650;
}

.assistant-action.assistant-offer {
    margin: 0 0 9px;
    border-color: #175c88;
    background: #175c88;
    color: white;
}

.assistant-action.assistant-offer:hover {
    background: #11496c;
}

.assistant-typing {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #476780;
    font-size: .81rem;
    font-weight: 550;
}

.assistant-typing i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.assistant-typing i:first-child {
    margin-left: 4px;
}

.assistant-writing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: .9em;
    margin-left: 2px;
    vertical-align: -.08em;
    background: #2684ac;
}

.assistant-arrow {
    font-size: 1rem;
}

.assistant-footer {
    flex: none;
    padding: 11px var(--panel-pad) 9px;
    border-top: 1px solid #dfebf3;
    background: #fff;
}

.assistant-search {
    display: flex;
    align-items: center;
    padding: 3px 4px 3px 12px;
    border: 1px solid #cadbe7;
    border-radius: 12px;
    background: #f7fafc;
}

.assistant-search:focus-within {
    border-color: #35779e;
    box-shadow: 0 0 0 1px #35779e;
}

.assistant-search input:focus {
    outline: none;
}

.assistant-search input {
    flex: 1;
    width: 0;
    min-height: 35px;
    border: 0;
    color: #183d5b;
    background: transparent;
    font-size: .91rem;
}

.assistant-search button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #155985;
}

.assistant-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.assistant-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: .76rem;
}

.assistant-tools a,
.assistant-tools button,
.assistant-intake-actions button:not(.assistant-primary),
.assistant-skip {
    display: inline-flex;
    align-items: center;
    padding: 0;
    min-height: 38px;
    border: 0;
    background: transparent;
    color: #3b607c;
}

.assistant-tools button:disabled {
    display: none;
}

.assistant-tools [data-guide-search] {
    gap: 5px;
}

.assistant-tools a:hover,
.assistant-skip:hover {
    text-decoration: underline;
}

.assistant-step {
    color: #116a91;
    margin: 0 0 10px;
    font-weight: 700;
    font-size: .81rem;
}

.assistant-intake-note {
    color: #4b6478;
    margin-bottom: 20px;
    font-size: .91rem;
}

.assistant-intake label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
}

.assistant-intake input:not([type="hidden"]) {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    border: 1px solid #b9d0e1;
    border-radius: 10px;
    background: white;
    color: #173854;
}

.assistant-intake input[aria-invalid="true"] {
    border-color: #a52e47;
}

.assistant-error {
    color: #98253b;
    font-size: .84rem;
    margin: 6px 0 0;
}

.assistant-intake-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    margin: 15px 0 7px;
}

.assistant-primary {
    padding: 9px 16px;
    min-height: 44px;
    border-radius: 10px;
    border: 0;
    color: #fff;
    background: #115985;
    font-weight: 650;
}

.assistant-primary:disabled {
    opacity: .65;
}

.assistant-skip {
    font-size: .81rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 480px) {
    .assistant-panel {
        --panel-pad: 16px;
        inset: auto 8px max(8px, env(safe-area-inset-bottom)) auto;
        width: calc(100vw - 16px);
        height: min(604px, calc(100dvh - 16px - env(safe-area-inset-bottom)));
        border-radius: 18px;
    }

    .assistant-search input,
    .assistant-intake input {
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .assistant-panel[open] {
        animation: assistant-open .2s ease-out;
    }

    .assistant-typing i {
        animation: assistant-typing-dot .55s ease-in-out infinite alternate;
    }

    .assistant-typing i:nth-child(2) {
        animation-delay: -.15s;
    }

    .assistant-typing i:nth-child(3) {
        animation-delay: -.3s;
    }

    @keyframes assistant-typing-dot {
        from { opacity: .4; }
        to { opacity: 1; }
    }

    @keyframes assistant-open {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}
