/* PhysicianBill AI Chatbot Styles */
.medibill-chatbot-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating launcher: teaser + icon */
.medibill-floating-launcher {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.medibill-floating-launcher.is-chat-open .medibill-floating-teaser {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.95);
    max-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, max-height 0.25s ease, padding 0.25s ease;
}

.medibill-floating-launcher:focus {
    outline: none;
}

.medibill-floating-launcher:focus-visible .floating-chat-icon {
    box-shadow: 0 0 0 4px rgba(144, 39, 143, 0.35), 0 12px 32px rgba(103, 45, 145, 0.45);
}

.medibill-floating-teaser {
    position: relative;
    max-width: 220px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 8px 28px rgba(103, 45, 145, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(144, 39, 143, 0.18);
    animation: medibillTeaserFloat 3s ease-in-out infinite;
    text-align: right;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, max-height 0.25s ease, padding 0.25s ease;
}

.medibill-floating-teaser::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 22px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-right: 1px solid rgba(144, 39, 143, 0.18);
    border-bottom: 1px solid rgba(144, 39, 143, 0.18);
    transform: rotate(45deg);
}

.medibill-floating-teaser-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #672d91;
    line-height: 1.3;
    margin-bottom: 2px;
}

.medibill-floating-teaser-sub {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.35;
}

.floating-chat-icon {
    position: relative;
    width: 68px;
    height: 68px;
    background: linear-gradient(145deg, #90278f 0%, #672d91 55%, #5a2480 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    box-shadow: 0 10px 32px rgba(103, 45, 145, 0.45), 0 4px 12px rgba(144, 39, 143, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 3px solid rgba(255, 255, 255, 0.45);
    flex-shrink: 0;
}

.medibill-floating-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(144, 39, 143, 0.55);
    animation: medibillIconPulse 2.2s ease-out infinite;
    pointer-events: none;
}

.medibill-floating-pulse--delay {
    animation-delay: 1.1s;
}

.floating-chat-icon i {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.medibill-floating-launcher:hover .floating-chat-icon {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 16px 40px rgba(103, 45, 145, 0.5), 0 6px 16px rgba(144, 39, 143, 0.3);
}

.medibill-floating-launcher:hover .medibill-floating-teaser {
    animation-play-state: paused;
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(103, 45, 145, 0.28);
}

@keyframes medibillIconPulse {
    0% {
        transform: scale(1);
        opacity: 0.75;
    }
    100% {
        transform: scale(1.55);
        opacity: 0;
    }
}

@keyframes medibillTeaserFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .medibill-floating-pulse,
    .medibill-floating-teaser {
        animation: none;
    }
}

.medibill-chat-container {
    --medibill-chat-launcher-gap: max(16px, calc(88px + env(safe-area-inset-bottom, 0px)));
    --medibill-chat-top-gap: 12px;
    width: calc(100% - 60px);
    max-width: 440px;
    background: white;
    border-radius: 32px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
    max-height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
    position: fixed;
    bottom: var(--medibill-chat-launcher-gap);
    right: 30px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.2s ease, transform 0.25s ease, visibility 0.2s;
    transform-origin: bottom right;
    isolation: isolate;
}

@supports (height: 100dvh) {
    .medibill-chat-container {
        height: min(640px, calc(100dvh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
        max-height: min(640px, calc(100dvh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
    }
}

.medibill-chat-container.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.chat-header {
    background: linear-gradient(to top, #90278f, #672d91);
    color: white;
    padding: 10px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}

.chat-header-top {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 22px;
    flex-shrink: 0;
}

.chat-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.medibill-header-beta {
    display: inline-block;
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    line-height: 1.2;
    pointer-events: none;
}

.medibill-chat-container .header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.medibill-chat-container .header-content {
    flex: 1;
    min-width: 0;
}

.medibill-chat-container .header-content .header-tagline {
    font-size: 12px;
    opacity: 0.95;
    margin: 0 0 3px 0;
    line-height: 1.35;
    white-space: normal;
}

.medibill-chat-container .header-content p {
    margin: 0;
}

.medibill-chat-container .status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    line-height: 1.3;
}

.medibill-chat-container .status-dot {
    width: 8px;
    height: 8px;
    background: #28a745;
    border-radius: 50%;
    animation: medibill-pulse 2s infinite;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

@keyframes medibill-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.user-type-selector {
    display: flex;
    padding: 12px 20px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    gap: 8px;
}

.medibill-chat-container .type-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #CBD5E1;
    background: white;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.medibill-chat-container .type-btn i {
    font-size: 12px;
}

.medibill-chat-container .type-btn.active {
    background: linear-gradient(135deg, #1F5FFF 0%, #28a745 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(31, 95, 255, 0.2);
}

.medibill-chat-container .chat-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

.medibill-chat-container .message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.45;
    font-size: 13px;
    animation: medibill-slideIn 0.3s ease;
    word-wrap: break-word;
}

@keyframes medibill-slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.medibill-chat-container .user-message {
    align-self: flex-end;
    background: linear-gradient(to top, #90278f, #672d91);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(31, 95, 255, 0.2);
}

.medibill-chat-container .bot-message {
    align-self: flex-start;
    background: white;
    color: #0F172A;
    border: 1px solid #E2E8F0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

/* Service cards styling */
.medibill-chat-container .bot-message h3 {
    font-size: 14px !important;
    font-weight: 700 !important;
    margin: 0 0 6px 0;
}

.medibill-chat-container .bot-message p {
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.45;
    margin: 0 0 8px 0;
}

.medibill-chat-container .bot-message ul li {
    font-size: 12px !important;
    font-weight: 400 !important;
    margin-bottom: 6px;
}

.medibill-chat-container .bot-message strong {
    color: #1F5FFF;
}

/* Welcome card inside chat (flow main) */
.medibill-chat-container .custom-welcome-card {
    text-align: left;
}
.medibill-chat-container .custom-welcome-card .welcome-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.25;
    color: #0F172A;
}
.medibill-chat-container .custom-welcome-card .welcome-assist {
    font-size: 12px;
    line-height: 1.4;
    color: #475569;
}

.medibill-chat-container .message.typing-indicator {
    align-self: flex-start;
    width: auto;
    max-width: none;
    padding: 10px 14px;
    min-height: 0;
    line-height: 1;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.medibill-chat-container .typing-ellipsis-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 10px;
    padding: 0 2px;
}

.medibill-chat-container .typing-ellipsis-dots .typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #90278f;
    opacity: 0.35;
    animation: medibill-typing-bounce 1.1s ease-in-out infinite;
}

.medibill-chat-container .typing-ellipsis-dots .typing-dot:nth-child(1) { animation-delay: 0s; }
.medibill-chat-container .typing-ellipsis-dots .typing-dot:nth-child(2) { animation-delay: 0.15s; }
.medibill-chat-container .typing-ellipsis-dots .typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes medibill-typing-bounce {
    0%, 70%, 100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    35% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.medibill-chat-container .suggestion-chip {
    background: #F1F5F9;
    color: #1E293B;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #E2E8F0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.medibill-chat-container .suggestion-chip:hover {
    background: linear-gradient(135deg, #1F5FFF 0%, #28a745 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(31, 95, 255, 0.3);
}

/* Chat Footer - FIXED for mobile */
.medibill-chat-container .chat-footer {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.medibill-chat-container .input-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

.medibill-chat-container .chat-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 30px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: #F8FAFC;
}

.medibill-chat-container .chat-input:focus {
    border-color: #1F5FFF;
    background: white;
    box-shadow: 0 0 0 3px rgba(31, 95, 255, 0.1);
}

.medibill-chat-container .send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(to top, #90278f, #672d91);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(31, 95, 255, 0.3);
}

.medibill-chat-container .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(31, 95, 255, 0.4);
}

/* Voice Controls - FIXED layout */
.voice-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.voice-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: #F1F5F9;
    border: 2px solid #E2E8F0;
    border-radius: 50%;
    color: #475569;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.voice-btn:hover {
    background: #E2E8F0;
    transform: scale(1.05);
}

.voice-btn.listening {
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: transparent;
    color: white;
    animation: voice-pulse-green 1.5s infinite;
}

.voice-btn.speaking {
    background: linear-gradient(135deg, #059669, #10b981);
    border-color: transparent;
    color: white;
    animation: voice-wave 1s ease-in-out infinite;
}

@keyframes voice-pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

@keyframes voice-wave {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Voice status indicator */
.voice-status {
    font-size: 11px;
    color: #64748B;
    padding: 4px 10px;
    display: none;
    align-items: center;
    gap: 6px;
    background: #F8FAFC;
    border-radius: 20px;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    white-space: nowrap;
}

.voice-status.show {
    display: flex;
}

.voice-status.listening i {
    color: #10b981;
    animation: pulse 1s infinite;
}

.voice-status.speaking i {
    color: #10b981;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* REMOVED settings button - not showing anymore */
.settings-btn {
    display: none !important;
}

/* Voice settings panel - hidden since we removed the button */
.voice-settings {
    display: none !important;
}

/* Speech permission notice */
.speech-permission-notice {
    background: #FEF3C7;
    color: #92400E;
    font-size: 11px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    display: none;
    align-items: center;
    gap: 8px;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    z-index: 100;
}

.speech-permission-notice.show {
    display: flex;
}

.speech-permission-notice button {
    background: none;
    border: none;
    color: #1F5FFF;
    cursor: pointer;
    font-weight: 600;
    margin-left: auto;
}

/* Quick Services Bar */
.medibill-chat-container .quick-services-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 12px;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    max-height: 90px;
    overflow-y: auto;
}

.medibill-chat-container .service-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.medibill-chat-container .service-btn:hover {
    background: linear-gradient(135deg, #1F5FFF 0%, #28a745 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.medibill-chat-container .service-btn i {
    font-size: 18px;
    color: #1F5FFF;
}

.medibill-chat-container .service-btn:hover i {
    color: white;
}

/* Clear, services, consultation, and close chat buttons */
.header-services-btn,
.header-consultation-btn,
.clear-chat-btn,
.close-chat-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-services-btn:hover,
.header-consultation-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: scale(1.05);
}

.header-services-btn.is-active {
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

/* Service shortcut after AI answers */
.medibill-service-shortcut-wrap {
    padding: 4px 0 2px;
}

.medibill-service-shortcut-label {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #672d91;
}

.medibill-service-shortcut-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(144, 39, 143, 0.12) 0%, rgba(103, 45, 145, 0.08) 100%) !important;
    border-color: rgba(144, 39, 143, 0.35) !important;
    color: #672d91 !important;
    font-weight: 600;
}

.medibill-service-shortcut-btn:hover {
    background: linear-gradient(to top, #90278f, #672d91) !important;
    border-color: #90278f !important;
    color: #fff !important;
}

.medibill-service-shortcut-btn i {
    font-size: 13px;
}

.clear-chat-btn {
    margin: 0;
}

.clear-chat-btn:hover {
    background: rgba(255,255,255,0.3);
}

.clear-chat-btn:hover i {
    color: #FF4D4D;
}

.close-chat-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* Scrollbar */
.medibill-chat-container .chat-body::-webkit-scrollbar {
    width: 4px;
}

.medibill-chat-container .chat-body::-webkit-scrollbar-track {
    background: #F1F5F9;
}

.medibill-chat-container .chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #1F5FFF, #28a745);
    border-radius: 10px;
}

/* ========== MOBILE RESPONSIVE FIXES ========== */
@media (max-width: 768px) {
    .medibill-floating-launcher {
        bottom: 18px;
        right: 16px;
        gap: 8px;
    }

    .medibill-floating-teaser {
        max-width: 168px;
        padding: 8px 11px;
        border-radius: 12px 12px 4px 12px;
    }

    .medibill-floating-teaser-title {
        font-size: 12px;
    }

    .medibill-floating-teaser-sub {
        font-size: 10px;
    }

    .floating-chat-icon {
        width: 58px;
        height: 58px;
        font-size: 26px;
    }

    .medibill-chat-container {
        width: calc(100% - 30px);
        right: 15px;
        --medibill-chat-launcher-gap: max(14px, calc(82px + env(safe-area-inset-bottom, 0px)));
        --medibill-chat-top-gap: 10px;
        bottom: var(--medibill-chat-launcher-gap);
        max-width: none;
        height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
        max-height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
        border-radius: 24px;
    }

    .medibill-chat-container .chat-header {
        padding: 8px 12px 12px;
    }

    .chat-header-top {
        min-height: 20px;
    }

    .medibill-header-beta {
        font-size: 9px;
        padding: 3px 8px;
    }

    .medibill-chat-container .header-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .medibill-chat-container .header-content .header-tagline {
        font-size: 10px;
    }

    .medibill-chat-container .header-content p {
        font-size: 10px;
    }

    .medibill-chat-container .custom-welcome-card .welcome-title {
        font-size: 14px;
    }
    .medibill-chat-container .custom-welcome-card .welcome-assist {
        font-size: 11px;
    }

    .medibill-chat-container .chat-body {
        padding: 16px;
    }

    .medibill-chat-container .message {
        max-width: 90%;
        padding: 9px 12px;
        font-size: 12px;
    }

    /* Fixed footer layout for mobile */
    .medibill-chat-container .chat-footer {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .voice-controls {
        gap: 5px;
    }

    .voice-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 14px;
    }

    .medibill-chat-container .send-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 14px;
    }

    .medibill-chat-container .chat-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Service chips */
    .medibill-chat-container .suggestion-chip {
        padding: 5px 12px;
        font-size: 11px;
    }

    /* Typing indicator */
    .medibill-chat-container .message.typing-indicator {
        padding: 9px 12px;
    }

    /* Voice status on mobile - reposition */
    .voice-status {
        font-size: 10px;
        white-space: normal;
        max-width: 200px;
        text-align: center;
    }

    /* Consultation form mobile */
    .medibill-consultation-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: max(12px, env(safe-area-inset-top, 12px));
    }

    .medibill-consultation-modal {
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
        margin: auto;
        max-height: min(92vh, calc(100vh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
        border-radius: 18px;
    }

    @supports (height: 100dvh) {
        .medibill-consultation-modal {
            max-height: min(92dvh, calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
        }
    }

    .medibill-consultation-header {
        padding: 16px;
    }

    .medibill-consultation-body {
        padding: 16px;
    }

    .medibill-consultation-footer {
        padding: 16px;
        flex-direction: column;
    }

    .medibill-btn {
        width: 100%;
        justify-content: center;
    }

    .medibill-form-row {
        flex-direction: column;
        gap: 10px;
    }

    .medibill-form-row > .medibill-form-group {
        flex: 1 1 auto;
        min-width: 0;
    }

    .medibill-form-row--3 {
        grid-template-columns: 1fr;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .medibill-floating-launcher {
        bottom: 14px;
        right: 12px;
    }

    .medibill-floating-teaser {
        max-width: 150px;
    }

    .floating-chat-icon {
        width: 54px;
        height: 54px;
        font-size: 24px;
    }

    .medibill-chat-container {
        width: calc(100% - 20px);
        right: 10px;
        --medibill-chat-launcher-gap: max(12px, calc(76px + env(safe-area-inset-bottom, 0px)));
        --medibill-chat-top-gap: 8px;
        bottom: var(--medibill-chat-launcher-gap);
        height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
        max-height: min(640px, calc(100vh - var(--medibill-chat-launcher-gap) - var(--medibill-chat-top-gap)));
        border-radius: 20px;
    }

    .medibill-chat-container .chat-header {
        padding: 8px 10px 10px;
    }

    .medibill-chat-container .header-icon {
        width: 38px;
        height: 38px;
        font-size: 19px;
    }

    .header-actions {
        gap: 6px;
    }

    .medibill-chat-container .chat-body {
        padding: 12px;
    }

    .medibill-chat-container .chat-footer {
        padding: 8px 10px;
        gap: 6px;
    }

    .voice-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 12px;
    }

    .medibill-chat-container .send-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 12px;
    }

    .medibill-chat-container .chat-input {
        padding: 8px 12px;
        font-size: 13px;
    }

    .header-services-btn,
    .header-consultation-btn,
    .clear-chat-btn,
    .close-chat-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* Consultation form button + Schedule a call link after booking */
.medibill-consultation-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #90278f 0%, #672d91 100%);
    color: #fff !important;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none !important;
    box-shadow: 0 4px 14px rgba(144, 39, 143, 0.35);
}

.medibill-consultation-card-btn:hover,
.medibill-consultation-card-btn:focus {
    background: linear-gradient(135deg, #7f2280 0%, #5a2680 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(144, 39, 143, 0.42);
    color: #fff !important;
    text-decoration: none !important;
    outline: none;
}

.medibill-chat-container .bot-message a.medibill-consultation-card-btn,
.medibill-chatbot-wrapper a.medibill-consultation-card-btn {
    color: #fff !important;
    text-decoration: none !important;
}

.medibill-schedule-call-btn {
    display: inline-flex !important;
    margin-top: 6px;
}

.medibill-inline-schedule-link {
    background: none;
    border: none;
    padding: 0;
    color: #90278f;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.medibill-inline-schedule-link:hover,
.medibill-inline-schedule-link:focus {
    color: #672d91;
    outline: none;
}

/* Contact icon buttons */
.medibill-contact-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1F2933;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.medibill-contact-icon-btn:hover {
    background: #1F5FFF;
    color: #fff;
    border-color: transparent;
}

/* Consultation modal */
.medibill-consultation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2.5vw, 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.medibill-consultation-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.medibill-consultation-modal {
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: min(820px, calc(100vw - 24px));
    min-width: 0;
    min-height: 0;
    max-height: min(92vh, calc(100vh - 40px), 920px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    margin: auto;
}

@supports (height: 100dvh) {
    .medibill-consultation-modal {
        max-height: min(92dvh, calc(100dvh - 40px), 920px);
    }
}

/* Party popper / confetti — behind modal or chat UI */
.medibill-celebration-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.medibill-celebration-layer.is-active {
    opacity: 1;
}

.medibill-consultation-overlay .medibill-celebration-layer {
    border-radius: 0;
}

.medibill-chat-container .medibill-celebration-layer {
    border-radius: 32px;
}

/* Chat: confetti overlays the panel (opaque header/body would hide a back layer) */
.medibill-chat-container .medibill-celebration-layer.is-on-top {
    z-index: 180;
}

.medibill-celebration-layer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.medibill-consultation-overlay.is-open .medibill-consultation-modal {
    transform: scale(1) translateY(0);
}

.medibill-consultation-header {
    background: linear-gradient(to top, #90278f, #672d91);
    color: white;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-radius: 24px 24px 0 0;
    flex-shrink: 0;
}

.medibill-consultation-header-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.medibill-consultation-header-content {
    flex: 1;
}

.medibill-consultation-header-content h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.medibill-consultation-header-content p {
    font-size: 12px;
    opacity: 0.95;
    margin: 0;
}

.medibill-consultation-close {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.medibill-consultation-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Form fills space under header so the body scrolls and footer stays visible */
.medibill-consultation-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.medibill-consultation-body {
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.medibill-form-section {
    margin-bottom: 20px;
}

.medibill-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 16px;
}

.medibill-form-row > .medibill-form-group {
    flex: 1 1 calc(50% - 8px);
    min-width: min(100%, 200px);
    margin-bottom: 0;
}

.medibill-form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1F5FFF;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.medibill-form-section > .medibill-form-group {
    margin-bottom: 14px;
}

.medibill-form-section > .medibill-form-group:last-child {
    margin-bottom: 0;
}

.medibill-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.medibill-form-label .required {
    color: #dc2626;
}

.medibill-form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    font-size: 13px;
    color: #0F172A;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.medibill-form-input:focus {
    outline: none;
    border-color: #1F5FFF;
    box-shadow: 0 0 0 3px rgba(31, 95, 255, 0.1);
}

.medibill-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.medibill-consultation-body .medibill-form-textarea {
    max-height: min(220px, 36vh);
}

.medibill-form-select {
    appearance: auto;
    cursor: pointer;
}

.medibill-form-select--multiple {
    padding: 10px;
    min-height: 100px;
}

.medibill-form-hint {
    font-size: 11px;
    color: #64748B;
    margin: 5px 0 0 0;
}

.medibill-field-error {
    display: block;
    font-size: 11px;
    color: #dc2626;
    margin-top: 4px;
}

.medibill-form-message {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 12px;
    margin-bottom: 16px;
}

.medibill-form-message--error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.medibill-form-message--success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.medibill-consultation-footer {
    padding: 16px 20px;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #fff;
}

.medibill-wizard-footer-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-left: auto;
}

.medibill-consultation-wizard-progress {
    padding: 12px 20px 0;
    background: #fff;
}

.medibill-wizard-progress-bar {
    height: 6px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
}

.medibill-wizard-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(to top, #90278f, #672d91);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.medibill-wizard-progress-label {
    margin: 8px 0 0;
    font-size: 12px;
    color: #64748B;
    text-align: center;
}

.medibill-wizard-step {
    display: none;
}

.medibill-wizard-step.is-active {
    display: block;
}

.medibill-wizard-step-title {
    font-size: 16px;
    font-weight: 700;
    color: #672d91;
    margin: 0 0 14px;
    line-height: 1.35;
}

.medibill-wizard-step-title i {
    color: #90278f;
    margin-right: 6px;
}

.medibill-wizard-step-hint {
    font-size: 13px;
    color: #64748B;
    margin: -8px 0 12px;
}

.medibill-calendar-wrap {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 14px;
}

.medibill-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.medibill-calendar-month {
    font-weight: 700;
    font-size: 14px;
    color: #1E293B;
}

.medibill-calendar-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.medibill-calendar-nav-btn:hover {
    border-color: #90278f;
    color: #90278f;
}

.medibill-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #94A3B8;
}

.medibill-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.medibill-calendar-day {
    height: 36px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #F8FAFC;
    color: #1E293B;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.medibill-calendar-day.is-empty {
    background: transparent;
    pointer-events: none;
}

.medibill-calendar-day.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.medibill-calendar-day:not(.is-disabled):not(.is-empty):hover {
    border-color: #90278f;
    background: #FDF4FF;
}

.medibill-calendar-day.is-selected {
    background: #90278f;
    color: #fff;
    border-color: #90278f;
}

.medibill-time-section {
    margin-top: 4px;
}

.medibill-time-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 8px;
}

.medibill-time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.medibill-time-slot {
    padding: 8px 6px;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.medibill-time-slot:hover {
    border-color: #90278f;
    color: #90278f;
}

.medibill-time-slot.is-selected {
    background: #90278f;
    border-color: #90278f;
    color: #fff;
}

.medibill-selected-slot {
    margin-top: 10px;
    padding: 10px 12px;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 8px;
    font-size: 13px;
    color: #065F46;
}

.medibill-selected-slot i {
    margin-right: 6px;
}

.medibill-booking-summary {
    margin-top: 16px;
    padding: 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    font-size: 13px;
}

.medibill-booking-summary h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #672d91;
}

.medibill-time-loading,
.medibill-time-empty {
    grid-column: 1 / -1;
    font-size: 13px;
    color: #64748B;
    text-align: center;
    padding: 12px 8px;
    margin: 0;
}

.medibill-time-empty {
    color: #90278f;
    font-weight: 600;
}

.medibill-consultation-body {
    background: #FDFAFF;
}

.medibill-booking-summary ul {
    margin: 0;
    padding-left: 18px;
}

.medibill-booking-summary li {
    margin-bottom: 6px;
    color: #475569;
}

.medibill-btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.medibill-btn--primary {
    background: linear-gradient(135deg, #1F5FFF 0%, #28a745 100%);
    color: white;
}

.medibill-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(31, 95, 255, 0.35);
}

.medibill-btn--secondary {
    background: white;
    color: #475569;
    border-color: #E2E8F0;
}

.medibill-btn--secondary:hover {
    border-color: #1F5FFF;
    color: #1F5FFF;
}

.medibill-consultation-modal .medibill-btn--primary {
    background: linear-gradient(to top, #90278f, #672d91);
    color: #fff;
    border: none;
}

.medibill-consultation-modal .medibill-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(144, 39, 143, 0.35);
}

.medibill-consultation-modal .medibill-btn--secondary:hover {
    border-color: #90278f;
    color: #90278f;
}

.medibill-consultation-modal {
    border: 2px solid rgba(144, 39, 143, 0.15);
}

.medibill-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notification */
.medibill-chatbot-wrapper .toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #0F172A;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 13px;
    transition: transform 0.3s ease;
    z-index: 11000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.medibill-chatbot-wrapper .toast.show {
    transform: translateX(-50%) translateY(0);
}

.medibill-chatbot-wrapper .toast i {
    color: #28a745;
}

/* Clear chat confirmation dialog */
.medibill-clear-dialog {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.medibill-clear-dialog.is-open {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.medibill-clear-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.medibill-clear-dialog-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    background: #fff;
    border-radius: 20px;
    padding: 24px 22px 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(103, 45, 145, 0.22), 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(144, 39, 143, 0.12);
    transform: translateY(12px) scale(0.96);
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.medibill-clear-dialog.is-open .medibill-clear-dialog-card {
    transform: translateY(0) scale(1);
}

.medibill-clear-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fce7f6 0%, #f3e8ff 100%);
    border: 1px solid rgba(144, 39, 143, 0.15);
    color: #90278f;
    font-size: 22px;
    box-shadow: 0 4px 14px rgba(144, 39, 143, 0.12);
}

.medibill-clear-dialog-title {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.medibill-clear-dialog-text {
    margin: 0 0 20px;
    font-size: 13px;
    line-height: 1.55;
    color: #64748b;
}

.medibill-clear-dialog-actions {
    display: flex;
    gap: 10px;
}

.medibill-clear-dialog-btn {
    flex: 1;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.medibill-clear-dialog-btn:active {
    transform: scale(0.98);
}

.medibill-clear-dialog-btn--cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.medibill-clear-dialog-btn--cancel:hover {
    background: #e2e8f0;
    color: #334155;
}

.medibill-clear-dialog-btn--confirm {
    background: linear-gradient(135deg, #90278f 0%, #672d91 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(144, 39, 143, 0.35);
}

.medibill-clear-dialog-btn--confirm:hover {
    background: linear-gradient(135deg, #7f2280 0%, #5a2680 100%);
    box-shadow: 0 6px 18px rgba(144, 39, 143, 0.42);
}

.medibill-clear-dialog-btn--confirm i {
    font-size: 12px;
    opacity: 0.95;
}

/* Service menu grid — 3 columns, 1 full row + peek of next row */
.medibill-chat-container .medibill-options-container {
    flex-shrink: 0;
    position: relative;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(168px, 24vh);
}

@supports (height: 100dvh) {
    .medibill-chat-container .medibill-options-container {
        max-height: min(168px, 24dvh);
    }
}

/* Scroll fade hint only for the service grid — not flow pill filters */
.medibill-chat-container .medibill-options-container:has(.medibill-flow-grid.vertical-scroll)::after,
.medibill-chat-container .medibill-options-container.is-flow-grid-mode::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 22px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 0.85) 70%, #F8FAFC 100%);
    z-index: 1;
}

.medibill-chat-container .medibill-options-container.is-flow-pills-mode::after {
    content: none;
}

.medibill-chat-container .medibill-flow-grid.vertical-scroll {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    gap: 6px !important;
    padding: 8px 8px 12px;
    /* 1 full row (62px) + gap (6px) + peek of row below */
    max-height: 104px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 0;
}

.medibill-chat-container .medibill-flow-grid.vertical-scroll::-webkit-scrollbar {
    width: 5px;
}

.medibill-chat-container .medibill-flow-grid.vertical-scroll::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.medibill-chat-container .grid-flow-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto;
    width: 100% !important;
    min-width: 0 !important;
    height: 62px !important;
    max-height: 62px !important;
    background: white !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 12px !important;
    padding: 4px 3px !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    font-weight: 600 !important;
    color: #475569 !important;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    transition: all 0.2s ease;
}

.medibill-chat-container .grid-flow-btn i {
    font-size: 16px !important;
    color: #90278f !important;
    margin-bottom: 3px !important;
    flex-shrink: 0;
}

.medibill-chat-container .grid-flow-btn:hover {
    border-color: #90278f !important;
    background: #F8FAFC !important;
    box-shadow: 0 4px 12px rgba(31, 95, 255, 0.1) !important;
    transform: translateY(-2px);
    color: #90278f !important;
}

/* Flow follow-up choices (e.g. Credentialing → New Enrollment): tight pill tags, wrap like filter chips */
.medibill-chat-container .medibill-flow-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
    padding: 10px 10px 14px;
    max-width: 100%;
    overflow: visible;
}

.medibill-chat-container .medibill-flow-pill-btn {
    flex: 0 0 auto;
    width: auto !important;
    max-width: 100%;
    min-width: 0;
    height: auto !important;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px !important;
    margin: 0;
    border: none !important;
    border-radius: 999px !important;
    background: #f3f4f6 !important;
    color: #111827 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: inherit;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
    box-shadow: none !important;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
}

.medibill-chat-container .medibill-flow-pill-btn:hover:not(:disabled) {
    background: #e5e7eb !important;
    color: #0f172a !important;
}

.medibill-chat-container .medibill-flow-pill-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Converge payment modal (same stacking as consultation) */
.medibill-payment-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2.5vw, 20px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.medibill-payment-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.medibill-payment-modal {
    background: #fff;
    border-radius: 20px;
    border: 2px solid rgba(144, 39, 143, 0.15);
    box-shadow: 0 25px 50px -12px rgba(103, 45, 145, 0.25);
    width: 100%;
    max-width: min(560px, calc(100vw - 24px));
    min-width: 0;
    min-height: 0;
    max-height: min(90vh, 720px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.25s ease;
}

.medibill-payment-overlay.is-open .medibill-payment-modal {
    transform: scale(1) translateY(0);
}

.medibill-payment-header {
    background: linear-gradient(to top, #90278f, #672d91);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.medibill-payment-header-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.medibill-payment-header-content {
    flex: 1;
    min-width: 0;
}

.medibill-payment-header-content h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.medibill-payment-header-content p {
    font-size: 12px;
    opacity: 0.95;
    margin: 0;
}

.medibill-payment-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.medibill-payment-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.medibill-payment-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.medibill-payment-intro {
    font-size: 13px;
    color: #475569;
    margin: 0 0 12px 0;
}

.medibill-payment-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    margin-bottom: 12px;
}

.medibill-payment-billing-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.medibill-payment-billing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.medibill-payment-field {
    margin: 0;
}

.medibill-payment-field--full {
    grid-column: 1 / -1;
}

.medibill-payment-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.medibill-payment-text-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
}

.medibill-required {
    color: #dc2626;
}

@media (max-width: 520px) {
    .medibill-payment-billing-grid {
        grid-template-columns: 1fr;
    }
}

.medibill-payment-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    color: #475569;
    margin-bottom: 8px;
}

.medibill-payment-info p {
    margin: 0;
}

.medibill-stripe-mount,
.medibill-payment-info {
    min-height: auto;
}

.medibill-payment-loading {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    padding: 12px 0;
}

.medibill-payment-amount-section {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.medibill-payment-amount-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
}

.medibill-payment-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.medibill-payment-preset {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.medibill-payment-preset:hover {
    border-color: #90278f;
    background: rgba(144, 39, 143, 0.08);
}

.medibill-payment-preset.is-active {
    border-color: #90278f;
    background: linear-gradient(135deg, rgba(144, 39, 143, 0.14) 0%, rgba(103, 45, 145, 0.1) 100%);
    color: #672d91;
}

.medibill-payment-amount-input:focus,
.medibill-payment-text-input:focus {
    outline: none;
    border-color: #90278f;
    box-shadow: 0 0 0 3px rgba(144, 39, 143, 0.15);
}

.medibill-payment-modal .medibill-btn--primary {
    background: linear-gradient(to top, #90278f, #672d91);
    color: #fff;
    border: none;
}

.medibill-payment-modal .medibill-btn--primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(144, 39, 143, 0.35);
}

.medibill-payment-modal .medibill-btn--secondary:hover {
    border-color: #90278f;
    color: #90278f;
}

.medibill-payment-receipt .medibill-receipt-support a {
    color: #90278f;
    word-break: break-all;
}

.medibill-payment-custom-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.medibill-payment-custom-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.medibill-payment-custom-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.medibill-payment-amount-input {
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 200px;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.medibill-payment-apply-btn {
    flex: 0 0 auto;
}

.medibill-payment-phase-receipt {
    margin-top: 4px;
}

.medibill-payment-receipt {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 18px;
    font-size: 13px;
    color: #0f172a;
    line-height: 1.5;
}

.medibill-payment-receipt h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #0f172a;
}

.medibill-payment-receipt .medibill-receipt-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
}

.medibill-payment-receipt .medibill-receipt-row:last-of-type {
    border-bottom: none;
}

.medibill-payment-receipt .medibill-receipt-muted {
    color: #64748b;
    font-size: 12px;
}

.medibill-payment-receipt .medibill-receipt-support {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #cbd5e1;
}

.medibill-payment-receipt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
    justify-content: flex-end;
}

@media print {
    body * {
        visibility: hidden;
    }
    .medibill-payment-overlay.is-open,
    .medibill-payment-overlay.is-open * {
        visibility: visible;
    }
    .medibill-payment-overlay.is-open {
        position: absolute;
        inset: 0;
        background: #fff;
        padding: 0;
    }
    .medibill-payment-overlay.is-open .medibill-payment-header,
    .medibill-payment-overlay.is-open .medibill-payment-close,
    .medibill-payment-overlay.is-open .medibill-payment-footer,
    .medibill-payment-overlay.is-open #medibillPaymentPhaseForm,
    .medibill-payment-overlay.is-open .medibill-payment-receipt-actions {
        display: none !important;
    }
    .medibill-payment-overlay.is-open .medibill-payment-modal {
        box-shadow: none;
        max-height: none;
    }
    .medibill-payment-overlay.is-open .medibill-payment-receipt {
        border: none;
        background: #fff;
    }
}

.medibill-payment-footer {
    padding: 14px 18px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
    background: #fff;
}

@media (max-width: 768px) {
    .medibill-payment-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: max(12px, env(safe-area-inset-top, 12px));
    }

    .medibill-payment-modal {
        max-width: calc(100vw - 20px);
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        border-radius: 16px;
    }

    .medibill-payment-footer {
        flex-direction: column;
    }

    .medibill-payment-footer .medibill-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Specialty autocomplete (chat + consultation wizard) */
.medibill-specialty-autocomplete-wrap {
    position: relative;
    width: 100%;
}

.medibill-specialty-autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    padding: 6px;
}

.medibill-consultation-form .medibill-specialty-autocomplete {
    bottom: auto;
    top: calc(100% + 6px);
}

.medibill-specialty-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #1E293B;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.medibill-specialty-suggestion:hover,
.medibill-specialty-suggestion:focus {
    background: linear-gradient(135deg, rgba(31, 95, 255, 0.1) 0%, rgba(40, 167, 69, 0.1) 100%);
    color: #1F5FFF;
    outline: none;
}