.rb-chat-toggle,.rb-chat{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
.rb-chat-toggle{position:fixed;right:22px;bottom:22px;z-index:9998;display:flex;align-items:center;gap:9px;border:0;border-radius:999px;padding:12px 17px;background:#111827;color:#fff;font-size:14px;font-weight:700;box-shadow:0 10px 32px rgba(17,24,39,.24);cursor:pointer;transition:transform .18s ease,box-shadow .18s ease}
.rb-chat-toggle:hover{transform:translateY(-1px);box-shadow:0 14px 38px rgba(17,24,39,.28)}
.rb-chat-toggle-icon{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:rgba(255,255,255,.14);font-size:13px}
.rb-chat{position:fixed;right:22px;bottom:82px;z-index:9999;width:min(390px,calc(100vw - 28px));height:min(620px,calc(100vh - 110px));display:flex;flex-direction:column;background:#fff;border:1px solid rgba(17,24,39,.08);border-radius:22px;box-shadow:0 24px 70px rgba(17,24,39,.22);overflow:hidden;color:#111827}
.rb-chat[hidden],[hidden]{display:none!important}
.rb-chat-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid #eef0f3;background:#fff}
.rb-chat-brand{display:flex;align-items:center;gap:11px}
.rb-chat-logo{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:#111827;color:#fff;font-size:17px;font-weight:800}
.rb-chat-brand div{display:flex;flex-direction:column;gap:2px}.rb-chat-brand strong{font-size:14px}.rb-chat-brand span:not(.rb-chat-logo){font-size:12px;color:#6b7280}
.rb-chat-minimize{display:grid;place-items:center;width:34px;height:34px;border:0;border-radius:10px;background:#f5f6f8;color:#374151;font-size:22px;cursor:pointer}
.rb-chat-content{flex:1;min-height:0;overflow:auto;background:#f7f8fa}
.rb-chat-home{min-height:100%;background:linear-gradient(180deg,#f1f4f8 0,#f7f8fa 34%)}
.rb-chat-hero{padding:27px 22px 20px}.rb-chat-hero h2{margin:0 0 5px;font-size:25px;letter-spacing:-.5px}.rb-chat-hero p{margin:0;color:#5f6773;font-size:14px}
.rb-chat-actions{margin:0 14px;background:#fff;border:1px solid #e8eaee;border-radius:17px;overflow:hidden;box-shadow:0 7px 24px rgba(17,24,39,.06)}
.rb-chat-actions>button{width:100%;display:grid;grid-template-columns:40px 1fr 16px;align-items:center;gap:10px;padding:14px 15px;border:0;border-bottom:1px solid #eef0f3;background:#fff;text-align:left;cursor:pointer}
.rb-chat-actions>button:last-child{border-bottom:0}.rb-chat-actions>button:hover{background:#fafbfc}.rb-chat-actions strong{display:block;font-size:14px;margin-bottom:3px}.rb-chat-actions small{display:block;color:#727986;font-size:12px;line-height:1.3}.rb-chat-actions b{font-size:22px;font-weight:400;color:#9ca3af}
.rb-action-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:#f1f3f6;color:#111827;font-weight:800}
.rb-chat-home-note{margin:16px 22px;color:#8a919d;font-size:11px;text-align:center}
.rb-chat-booking-view,.rb-chat-support-view{min-height:100%;background:#fff}
.rb-chat-back{margin:14px 14px 0;padding:7px 9px;border:0;background:transparent;color:#4b5563;font-size:13px;font-weight:650;cursor:pointer}
.rb-chat-view-title{padding:8px 20px 16px}.rb-chat-view-title h2,.rb-chat-identity h2{margin:0 0 6px;font-size:20px;letter-spacing:-.25px}.rb-chat-view-title p,.rb-chat-identity p{margin:0;color:#6b7280;font-size:13px;line-height:1.5}
.rb-booking-lookup{display:flex;gap:8px;padding:0 20px}.rb-booking-lookup input,.rb-chat-email{box-sizing:border-box;width:100%;min-width:0;border:1px solid #d9dde3;border-radius:11px;padding:11px 12px;background:#fff;font:14px inherit;outline:none}.rb-booking-lookup input:focus,.rb-chat-email:focus,.rb-chat-compose textarea:focus{border-color:#6b7280;box-shadow:0 0 0 3px rgba(17,24,39,.06)}
.rb-booking-lookup button,.rb-chat-identity-next,.rb-open-support{border:0;border-radius:11px;padding:11px 14px;background:#111827;color:#fff;font-weight:700;cursor:pointer}
.rb-booking-result{padding:14px 20px}.rb-booking-card,.rb-selfservice-card{padding:14px;border:1px solid #e5e7eb;border-radius:13px;background:#f9fafb;font-size:13px}.rb-booking-card strong,.rb-booking-card span{display:block;margin:3px 0}.rb-selfservice-card strong{font-size:14px}.rb-selfservice-card p{color:#6b7280;line-height:1.45}.rb-open-support{width:100%}.rb-inline-error{padding:11px;border-radius:10px;background:#fff1f2;color:#9f1239;font-size:12px}
.rb-chat-support-top{display:flex;align-items:center;justify-content:space-between;padding-right:15px}.rb-chat-presence{display:flex;align-items:center;gap:6px;color:#6b7280;font-size:11px}.rb-chat-presence i{width:7px;height:7px;border-radius:50%;background:#9ca3af}.rb-presence-online i{background:#16a34a}.rb-presence-offline i{background:#f59e0b}
.rb-chat-identity{padding:18px 20px}.rb-chat-identity label{display:block;margin:18px 0 6px;font-size:12px;font-weight:700}.rb-chat-email-error{min-height:18px;padding-top:5px;color:#b42318;font-size:11px}.rb-chat-identity-next{width:100%;margin-top:6px;padding:12px}
.rb-chat-conversation{height:calc(100% - 50px);display:flex;flex-direction:column}.rb-chat-messages{flex:1;min-height:250px;overflow:auto;padding:15px;background:#f7f8fa}.rb-chat-system{margin:10px auto;max-width:88%;color:#7a828e;font-size:11px;line-height:1.45;text-align:center}
.rb-chat-msg{display:flex;margin:9px 0}.rb-chat-msg>div{max-width:78%;padding:10px 12px;border-radius:15px;font-size:13px;line-height:1.45;white-space:pre-wrap;box-shadow:0 1px 2px rgba(17,24,39,.04)}.rb-chat-msg.customer{justify-content:flex-end}.rb-chat-msg.customer>div{background:#111827;color:#fff;border-bottom-right-radius:5px}.rb-chat-msg.support>div{background:#fff;border:1px solid #e4e7eb;border-bottom-left-radius:5px}
.rb-chat-compose{display:flex;align-items:flex-end;gap:8px;padding:11px 12px;background:#fff;border-top:1px solid #eceef1}.rb-chat-compose textarea{flex:1;box-sizing:border-box;min-height:42px;max-height:110px;resize:none;border:1px solid #d9dde3;border-radius:13px;padding:11px 12px;font:13px inherit;outline:none}.rb-chat-send{display:grid;place-items:center;flex:0 0 42px;height:42px;border:0;border-radius:12px;background:#111827;color:#fff;font-size:15px;cursor:pointer}.rb-chat-send:disabled{opacity:.55}
.rb-chat-status{min-height:16px;padding:0 13px 6px;background:#fff;color:#6b7280;font-size:11px}.rb-chat-end{margin:0;padding:8px 12px 11px;border:0;background:#fff;color:#7b8490;font-size:11px;cursor:pointer}
@media(max-width:600px){.rb-chat-toggle{right:14px;bottom:14px}.rb-chat{right:0;bottom:0;width:100vw;height:100dvh;max-height:none;border-radius:0;border:0}.rb-chat-head{padding-top:max(16px,env(safe-area-inset-top))}}

/* PHASE 6A.3B */
.rb-chat-toggle{right:20px!important;bottom:20px!important;min-height:54px!important;display:flex!important;align-items:center!important;gap:9px!important;padding:8px 17px 8px 9px!important;background:linear-gradient(135deg,#2563eb,#4f46e5)!important;color:#fff!important;border:1px solid rgba(255,255,255,.35)!important;box-shadow:0 12px 32px rgba(37,99,235,.42),0 3px 10px rgba(0,0,0,.18)!important;animation:rbHelpFloat 3s ease-in-out infinite;isolation:isolate}
.rb-chat-toggle:before{content:"";position:absolute;inset:-5px;border-radius:999px;border:2px solid rgba(96,165,250,.38);z-index:-1;animation:rbHelpPulse 2.5s ease-out infinite}
.rb-launcher-icon{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.2);font-size:17px;font-weight:800}
@keyframes rbHelpFloat{50%{transform:translateY(-3px)}}
@keyframes rbHelpPulse{0%{opacity:.8;transform:scale(.95)}80%,100%{opacity:0;transform:scale(1.16)}}
.rb-chat{width:min(390px,calc(100vw - 24px))!important;max-height:min(590px,calc(100dvh - 94px))!important}
.rb-chat-messages{min-height:90px!important;max-height:250px!important;height:auto!important;flex:0 1 auto!important}
.rb-chat-compose{padding:10px 13px 13px!important}
.rb-chat-compose textarea{min-height:48px!important;max-height:105px!important;resize:none!important}
.rb-chat-end{width:auto!important;display:block!important;margin:8px auto 0!important;padding:7px 12px!important;border:0!important;background:transparent!important;color:#64748b!important;font-size:12px!important}
.rb-chat-end:hover{background:#fef2f2!important;color:#dc2626!important;border-radius:999px!important}
.rb-chat-end:before{content:"× ";font-size:15px}
.rb-payment-menu{background:#fff;overflow:auto}
.rb-chat-subhead{height:48px;padding:0 15px;display:flex;align-items:center;gap:14px;border-bottom:1px solid #eef2f7;color:#334155;font-size:13px}
.rb-payment-back{border:0;background:transparent;color:#475569;font-weight:650;cursor:pointer}
.rb-payment-content{padding:18px 16px}.rb-payment-content h3{margin:0 0 5px;font-size:18px;color:#0f172a}.rb-payment-content>p{margin:0 0 15px;color:#64748b;font-size:12px;line-height:1.45}
.rb-payment-options{display:grid;gap:8px}.rb-payment-options button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:12px 13px;text-align:left;border:1px solid #e5eaf1;border-radius:13px;background:#fff;color:#0f172a;cursor:pointer}.rb-payment-options button:hover{border-color:#bfdbfe;box-shadow:0 7px 18px rgba(37,99,235,.09);transform:translateY(-1px)}.rb-payment-options strong{display:block;font-size:13px}.rb-payment-options small{display:block;margin-top:2px;color:#64748b;font-size:11px;line-height:1.35}.rb-payment-options b{color:#94a3b8;font-size:20px;font-weight:400}
@media(max-width:600px){.rb-chat-toggle{right:14px!important;bottom:calc(14px + env(safe-area-inset-bottom))!important}.rb-chat{inset:0!important;width:100%!important;height:100dvh!important;max-height:none!important;border-radius:0!important}.rb-chat-messages{max-height:none!important;flex:1 1 auto!important}}
@media(prefers-reduced-motion:reduce){.rb-chat-toggle,.rb-chat-toggle:before{animation:none!important}}

/* PHASE 6A.3B4 - clean conversation layout repair */

/*
 * Actual DOM:
 * .rb-chat
 *   .rb-chat-head
 *   .rb-chat-content
 *     .rb-chat-support-view
 *       .rb-chat-support-top
 *       .rb-chat-identity OR .rb-chat-conversation
 *
 * Every ancestor in this chain must participate in flex sizing.
 */
.rb-chat-content{
    display:flex !important;
    flex:1 1 0 !important;
    min-height:0 !important;
    overflow:hidden !important;
}

.rb-chat-support-view{
    flex:1 1 0 !important;
    min-height:0 !important;
    height:auto !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    background:#fff !important;
}

.rb-chat-support-view[hidden]{
    display:none !important;
}

.rb-chat-support-top{
    flex:0 0 auto !important;
}

.rb-chat-identity{
    overflow-y:auto;
}

.rb-chat-conversation{
    flex:1 1 0 !important;
    min-height:0 !important;
    height:auto !important;
    display:flex !important;
    flex-direction:column !important;
    overflow:hidden !important;
    background:#fff;
}

.rb-chat-conversation[hidden]{
    display:none !important;
}

/* History gets ALL unused vertical space. */
.rb-chat-messages{
    flex:1 1 0 !important;
    min-height:0 !important;
    height:0 !important;
    max-height:none !important;
    overflow-y:auto !important;
    overscroll-behavior:contain;
    padding:14px !important;
    background:#f7f8fa;
}

/* Input remains directly above bottom actions. */
.rb-chat-compose{
    display:flex !important;
    align-items:flex-end !important;
    gap:8px !important;
    flex:0 0 auto !important;
    margin:0 !important;
    padding:10px 12px !important;
    border-top:1px solid #e5e7eb !important;
    background:#fff !important;
}

.rb-chat-compose textarea{
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
    min-height:44px !important;
    max-height:100px !important;
}

.rb-chat-send{
    flex:0 0 44px !important;
    width:44px !important;
    height:44px !important;
    margin:0 !important;
}

.rb-chat-status{
    flex:0 0 auto !important;
    min-height:0 !important;
    padding:0 12px !important;
    background:#fff !important;
}

/* Compact bottom action; no large white footer area. */
.rb-chat-end{
    flex:0 0 auto !important;
    align-self:center !important;
    width:auto !important;
    margin:5px auto 9px !important;
    padding:6px 11px !important;
    border:0 !important;
    border-radius:999px !important;
    background:#f8fafc !important;
    color:#64748b !important;
    font-size:11px !important;
    line-height:1.2 !important;
}

.rb-chat-end:hover{
    background:#fff1f2 !important;
    color:#be123c !important;
}

/* Keep normal home/booking screens scrollable. */
.rb-chat-content:has(.rb-chat-home:not([hidden])),
.rb-chat-content:has(.rb-chat-booking-view:not([hidden])){
    overflow:auto !important;
}

@media(max-width:600px){
    .rb-chat{
        height:100dvh !important;
        min-height:0 !important;
        max-height:100dvh !important;
    }
}

/* PHASE 6A.3C - Safe End Chat + in-page support notifications */
/* Do not alter the working 6A.3B4 conversation flex chain. */

.rb-chat-support-tools{display:flex;align-items:center;gap:9px;min-width:0}
.rb-chat-support-tools .rb-chat-end{
 display:inline-flex!important;align-items:center!important;justify-content:center!important;
 flex:0 0 auto!important;width:auto!important;min-height:28px!important;margin:0!important;
 padding:5px 9px!important;border:1px solid #e2e8f0!important;border-radius:999px!important;
 background:#fff!important;color:#64748b!important;font-size:10px!important;font-weight:650!important;
 line-height:1!important;cursor:pointer!important;white-space:nowrap
}
.rb-chat-support-tools .rb-chat-end[hidden]{display:none!important}
.rb-chat-support-tools .rb-chat-end:before{content:""!important}
.rb-chat-support-tools .rb-chat-end:hover{border-color:#fecaca!important;background:#fef2f2!important;color:#b91c1c!important}

.rb-chat-unread{
 position:absolute;top:-5px;right:-5px;display:grid;place-items:center;min-width:20px;height:20px;
 padding:0 5px;box-sizing:border-box;border:2px solid #fff;border-radius:999px;background:#dc2626;
 color:#fff;font-size:10px;font-weight:800;line-height:1;box-shadow:0 4px 12px rgba(220,38,38,.32)
}

.rb-chat-toast{
 position:fixed;right:20px;bottom:88px;z-index:10000;width:min(350px,calc(100vw - 28px));
 box-sizing:border-box;display:grid;grid-template-columns:38px minmax(0,1fr) 18px;align-items:center;
 gap:10px;padding:11px 12px;border:1px solid rgba(37,99,235,.18);border-radius:15px;
 background:#fff;color:#0f172a;text-align:left;cursor:pointer;
 box-shadow:0 18px 50px rgba(15,23,42,.18),0 3px 10px rgba(15,23,42,.08);
 animation:rbChatToastIn .22s ease-out
}
.rb-chat-toast[hidden]{display:none!important}
.rb-chat-toast:hover{border-color:#bfdbfe;transform:translateY(-1px)}
.rb-chat-toast-icon{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:linear-gradient(135deg,#2563eb,#4f46e5);color:#fff;font-size:15px;font-weight:800}
.rb-chat-toast-copy{display:block;min-width:0}
.rb-chat-toast-copy strong{display:block;overflow:hidden;color:#0f172a;font-size:12px;font-weight:750;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}
.rb-chat-toast-copy small{display:block;margin-top:3px;color:#64748b;font-size:11px;line-height:1.3}
.rb-chat-toast-arrow{color:#94a3b8;font-size:22px;font-weight:400}
@keyframes rbChatToastIn{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}

@media(max-width:600px){
 .rb-chat-support-tools{gap:6px}
 .rb-chat-support-tools .rb-chat-end{min-height:27px!important;padding:5px 8px!important;font-size:10px!important}
 .rb-chat-toast{right:14px;bottom:calc(82px + env(safe-area-inset-bottom));width:calc(100vw - 28px)}
}
@media(prefers-reduced-motion:reduce){.rb-chat-toast{animation:none}}

/* PHASE 6A.3C1 - custom End Chat confirmation */
.rb-chat-confirm{
 position:absolute;inset:0;z-index:30;display:grid;place-items:center;padding:18px;
 box-sizing:border-box;background:rgba(15,23,42,.38);backdrop-filter:blur(2px)
}
.rb-chat-confirm[hidden]{display:none!important}
.rb-chat-confirm-card{
 width:min(320px,100%);box-sizing:border-box;padding:20px;border:1px solid #e5e7eb;
 border-radius:18px;background:#fff;text-align:center;box-shadow:0 24px 70px rgba(15,23,42,.24)
}
.rb-chat-confirm-icon{
 display:grid;place-items:center;width:42px;height:42px;margin:0 auto 12px;border-radius:50%;
 background:#f1f5f9;color:#475569;font-size:18px;font-weight:800
}
.rb-chat-confirm-card h3{margin:0 0 7px;color:#0f172a;font-size:17px;line-height:1.25}
.rb-chat-confirm-card p{margin:0;color:#64748b;font-size:12px;line-height:1.5}
.rb-chat-confirm-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:17px}
.rb-chat-confirm-actions button{
 min-height:40px;padding:9px 11px;border-radius:11px;font-size:12px;font-weight:700;cursor:pointer
}
.rb-chat-confirm-cancel{border:1px solid #dbe1e8;background:#fff;color:#334155}
.rb-chat-confirm-cancel:hover{background:#f8fafc}
.rb-chat-confirm-end{border:1px solid #dc2626;background:#dc2626;color:#fff}
.rb-chat-confirm-end:hover{background:#b91c1c;border-color:#b91c1c}
.rb-chat-confirm-actions button:disabled{opacity:.55;cursor:not-allowed}
@media(max-width:600px){
 .rb-chat-confirm{padding:16px}
 .rb-chat-confirm-card{width:min(330px,100%)}
}
