/* OSA AI Assistant — Unified with core EAC Cavite palette and sharp edges */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    --osai-in: 240ms ease-out;
    --osai-in-fast: 180ms ease-out;
    --osai-r-shell: 0px;
    --osai-r-bubble: 18px;
    --osai-r-control: 12px;
    --osai-r-chip: 999px;
}

/* ----- Chat page layout cards (hero + sidebar) ----- */
.chat-page-hero {
    border: 1px solid var(--line) !important;
    border-radius: var(--osai-r-shell) !important;
    background: var(--paper) !important;
    box-shadow: var(--shadow) !important;
}

.chat-aside-panel {
    border: 1px solid var(--line) !important;
    border-radius: var(--osai-r-shell) !important;
    background: var(--paper-strong) !important;
    box-shadow: var(--shadow) !important;
}

.chat-aside-panel--accent {
    border-color: var(--gold) !important;
    background: #fffdf8 !important;
}

.chat-field {
    border-radius: var(--osai-r-control) !important;
    border-color: var(--line) !important;
    background: #fff !important;
}

.chat-field:focus {
    outline: none !important;
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 2px rgba(132, 26, 45, 0.2) !important;
}

.chat-btn-clear {
    border-radius: var(--osai-r-control) !important;
}

.chat-badge-pill {
    border-radius: 999px !important;
}

/* ----- Main assistant shell ----- */
.osa-ai-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: none !important;
    border-radius: var(--osai-r-shell) !important;
    background: var(--paper);
    box-shadow: var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

.osa-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--brand) !important;
    color: #fffef9;
    border-bottom: 1px solid rgba(0,0,0,0.18);
    box-shadow: 0 2px 10px rgba(0,0,0,0.22);
    z-index: 10;
    flex-shrink: 0;
}

.osa-ai-header__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

/* Avatar circle replacing the old __mark */
.osa-ai-header__avatar {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
    color: #fff;
}

.osa-ai-header__avatar-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.3rem;
    padding: 0 0.2rem;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
}

.osa-ai-header__mark {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
}

.osa-ai-header__mark svg { width: 1.1rem; height: 1.1rem; color: #fff; }

.osa-ai-header__titles {
    min-width: 0;
    flex: 1;
}

.osa-ai-header__titles strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.1px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sub-row: mode badge + timer side by side */
.osa-ai-header__sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.osa-ai-header__titles span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.8);
}

/* Trailing cluster (mode pill + close) — used by the global launcher widget */
.osa-ai-header__trailing {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

/* Live status under title (styled like /chat topbar on --chat-ui) */
.osa-ai-header__status-line {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
}

.osa-ai-header__status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.6rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--brand-deep);
    border: 1px solid rgba(199, 154, 73, 0.55);
    background: linear-gradient(180deg, var(--gold-soft) 0%, #e8d4a8 100%);
    border-radius: 999px !important;
}

.osa-ai-header__dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px !important;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.28);
}

@keyframes osaiPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .osa-ai-header__dot {
        animation: osaiPulse 2.4s ease-in-out infinite;
    }
}

.osa-ai-thread {
    flex: 1;
    min-height: 14rem;
    max-height: min(65vh, 650px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1.25rem 1rem 0.75rem;
    scroll-behavior: smooth;
    background: transparent;
    /* Removed so blurry BG shines through */
}

@media (max-width: 640px) {
    .osa-ai-thread {
        max-height: min(46vh, 440px);
    }
}

.osa-ai-msg {
    display: flex;
    align-items: flex-end;
    padding: 1px 8px;
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(6px);
    min-width: 0;
}

.osa-ai-msg>div {
    display: flex;
    flex-direction: column;
    max-width: 72%;
}

.osa-ai-msg--user>div {
    align-items: flex-end;
}

.osa-ai-msg--assistant>div {
    align-items: flex-start;
}

.osa-ai-msg.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--osai-in), transform var(--osai-in);
}

@media (prefers-reduced-motion: reduce) {
    .osa-ai-msg {
        opacity: 1;
        transform: none;
    }

    .osa-ai-msg.is-visible {
        transition: none;
    }
}

.osa-ai-msg--assistant {
    justify-content: flex-start;
}

.osa-ai-msg--user {
    justify-content: flex-end;
}

.osa-ai-msg__bubble {
    width: fit-content;
    max-width: 100%;
    padding: 8px 12px;
    font-size: 15px;
    line-height: 1.42;
    color: #050505;
    border: none;
    background: #f0f2f5;
    box-shadow: none;
    border-radius: 18px !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    margin: 0;
}

.osa-ai-msg__bubble p {
    margin: 0 !important;
}

.osa-ai-msg__bubble p+p {
    margin-top: 0.5rem !important;
}

.osa-ai-msg--user .osa-ai-msg__bubble {
    border: 1px solid rgba(164, 32, 58, 0.4);
    background: linear-gradient(135deg, rgba(164, 32, 58, 0.82) 0%, rgba(132, 26, 45, 0.86) 100%) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff !important;
    box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(132, 26, 45, 0.2) !important;
    border-radius: 18px !important;
    border-bottom-right-radius: 4px !important;
    margin-right: 8px;
}

.osa-ai-msg--assistant .osa-ai-msg__bubble {
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
    border-bottom-left-radius: 4px !important;
}

.osa-ai-msg--user .osa-ai-msg__bubble p,
.osa-ai-msg--user .osa-ai-msg__bubble span,
.osa-ai-msg--user .osa-ai-msg__bubble strong,
.osa-ai-msg--user .osa-ai-msg__bubble a {
    color: #ffffff !important;
}

.osa-ai-msg--assistant .osa-ai-msg__bubble p,
.osa-ai-msg--assistant .osa-ai-msg__bubble span,
.osa-ai-msg--assistant .osa-ai-msg__bubble strong,
.osa-ai-msg--assistant .osa-ai-msg__bubble a {
    color: #050505 !important;
}

.osa-ai-msg__meta {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: #65676b;
    text-transform: none;
    letter-spacing: 0;
}

.osa-ai-msg--user .osa-ai-msg__meta {
    text-align: right;
    padding-right: 4px;
}

.osa-ai-msg--assistant .osa-ai-msg__meta {
    text-align: left;
    padding-left: 4px;
}

/* iOS iMessage-style typing indicator — translucent bubble, subtle dots */
.osa-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 11px 14px;
    border: 0 !important;
    background: rgba(242, 242, 247, 0.92);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border-radius: 20px !important;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
}

.osa-ai-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px !important;
    background: #8e8e93;
    opacity: 0.45;
    transform: translateY(0);
    will-change: transform, opacity;
}

@keyframes osaiDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    30% {
        transform: translateY(-3px);
        opacity: 0.9;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .osa-ai-typing span:nth-child(1) {
        animation: osaiDot 1.3s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
    }

    .osa-ai-typing span:nth-child(2) {
        animation: osaiDot 1.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.2s infinite;
    }

    .osa-ai-typing span:nth-child(3) {
        animation: osaiDot 1.3s cubic-bezier(0.25, 0.1, 0.25, 1) 0.4s infinite;
    }
}

/* ── iOS-styled additions ───────────────────────────────────────
   All new UI elements share SF-style typography, hairline separators,
   frosted glass backgrounds, and precise, muted accent colors.
*/

/* Header mode badge — tier indicator (iOS translucent capsule) */
.osa-ai-mode {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 3px 8px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.24);
    background: rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.92);
    line-height: 1.5;
    white-space: nowrap;
    transition: background-color 200ms ease, color 200ms ease;
}
.osa-ai-mode::before {
    content: none;
}
/* Mode states — all on dark header, use white-based palette */
.osa-ai-mode--faq   { color: #86efac; background: rgba(134,239,172,0.18); }
.osa-ai-mode--ai    { color: rgba(255,255,255,0.88); background: rgba(255,255,255,0.16); }
.osa-ai-mode--staff { color: #fca5a5; background: rgba(252,165,165,0.2); }

/* Session-expiry countdown — naked inline label inside the header sub-row.
   No pill / box: just the OSA-cream icon + tabular-nums digits sitting on
   the maroon header. Warm gold matches the welcome bubble accent so the
   chrome reads as one consistent OSA theme. */
.osa-ai-session-timer {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: #f7d781;
    background: transparent;
    border: 0;
    border-radius: 0;
    white-space: nowrap;
    transition: color 220ms ease;
}
.osa-ai-session-timer svg {
    color: #f7d781;
    opacity: 0.92;
    flex-shrink: 0;
    transition: color 220ms ease;
}
.osa-ai-session-timer.is-warning,
.osa-ai-session-timer.is-warning svg {
    color: #fcd34d;
}
.osa-ai-session-timer.is-critical,
.osa-ai-session-timer.is-critical svg {
    color: #fca5a5;
    animation: osaiTimerPulse 1s ease infinite;
}
@keyframes osaiTimerPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

/* Sign-out — naked inline label, no pill / box. Cream by default to match
   the OSA brand tone, shifts to soft red on hover so the destructive
   intent is still legible without a heavy container. */
.osa-ai-header-signout {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f7d781;
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    line-height: 1.5;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    transition: color 180ms ease, transform 120ms ease, opacity 180ms ease;
}
.osa-ai-header-signout:hover,
.osa-ai-header-signout:hover .osa-ai-header-signout__icon {
    color: #fca5a5;
}
.osa-ai-header-signout:active {
    transform: scale(0.96);
    opacity: 0.85;
}
.osa-ai-header-signout:focus-visible {
    outline: 2px solid rgba(247,215,129,0.65);
    outline-offset: 3px;
    border-radius: 4px;
}
.osa-ai-header-signout[hidden] { display: none; }
.osa-ai-header-signout__icon {
    flex-shrink: 0;
    color: #f7d781;
    opacity: 0.92;
    transition: color 180ms ease;
}

/* Scroll-to-latest — iOS floating glass capsule */
.osa-ai-scroll-bottom {
    position: absolute;
    right: 14px;
    bottom: 150px;
    z-index: 5;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 0.5px solid rgba(60, 60, 67, 0.16);
    background: rgba(255, 255, 255, 0.82);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    color: #1c1c1e;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transition: opacity 220ms cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 220ms cubic-bezier(0.25, 0.1, 0.25, 1),
                background-color 160ms ease;
}
.osa-ai-scroll-bottom:not([hidden]) {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.osa-ai-scroll-bottom:hover {
    background: rgba(255, 255, 255, 0.96);
}
.osa-ai-scroll-bottom:active {
    transform: translateY(0) scale(0.94);
    background: rgba(242, 242, 247, 1);
}
.osa-ai-scroll-bottom[hidden] { display: none; }

/* System bubble — iOS Messages-style caption (centered, no heavy background) */
.osa-ai-msg--system {
    display: flex;
    justify-content: center;
    padding: 10px 12px 4px;
    opacity: 0;
    transition: opacity 320ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.osa-ai-msg--system.is-visible { opacity: 1; }

.osa-ai-system {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #6e6e73;
    background: rgba(118, 118, 128, 0.10);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    backdrop-filter: blur(16px) saturate(180%);
    border: 0.5px solid rgba(60, 60, 67, 0.08);
    border-radius: 999px;
}

.osa-ai-system__dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #34c759;
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16);
    flex-shrink: 0;
    animation: osaiDotBreath 2.4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}
@keyframes osaiDotBreath {
    0%, 100% { box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.14); }
    50%      { box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.24); }
}

/* Escalation handoff card — iOS notification card */
.osa-ai-handoff {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.80);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    backdrop-filter: blur(22px) saturate(180%);
    border: 0.5px solid rgba(60, 60, 67, 0.10);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.42;
    letter-spacing: -0.01em;
    color: #1c1c1e;
}
.osa-ai-handoff p { margin: 0; }
.osa-ai-handoff p + p { margin-top: 6px; }
.osa-ai-handoff p:first-child {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.osa-ai-handoff p:first-child::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #af1d33;
    box-shadow: 0 0 0 4px rgba(175, 29, 51, 0.14);
    flex-shrink: 0;
}
.osa-ai-handoff strong { color: #af1d33; font-weight: 600; }

.osa-ai-waiting {
    padding: 12px 14px;
    border: 1px solid rgba(132, 26, 45, 0.22);
    background: #fffaf5;
    color: #2a201d;
    font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
    box-shadow: 0 4px 12px rgba(132, 26, 45, 0.08);
}

.osa-ai-waiting__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.osa-ai-waiting__spinner {
    width: 11px;
    height: 11px;
    border: 2px solid rgba(132, 26, 45, 0.2);
    border-top-color: #841a2d;
    border-radius: 999px;
    animation: osaiWaitSpin 0.9s linear infinite;
}

.osa-ai-waiting__titles strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.osa-ai-waiting__est {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #7b5f56;
    letter-spacing: 0.02em;
}

.osa-ai-waiting__elapsed {
    font-size: 12px;
    font-weight: 700;
    color: #841a2d;
}

.osa-ai-waiting__case,
.osa-ai-waiting__note {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.45;
}

.osa-ai-waiting__actions {
    margin-top: 10px;
}

.osa-ai-waiting__cancel {
    height: 32px;
    padding: 0 12px;
    border: 1px solid rgba(132, 26, 45, 0.24);
    background: #fff;
    color: #841a2d;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.osa-ai-waiting__cancel:hover:not(:disabled) {
    background: #fff4ec;
}

.osa-ai-waiting__cancel:disabled {
    opacity: 0.6;
    cursor: default;
}

@keyframes osaiWaitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.osa-ai-rich {
    margin-top: 10px;
    background: transparent;
    border: none;
    border-radius: var(--osai-r-control) !important;
    overflow: hidden;
}

.osa-ai-rich summary {
    cursor: pointer;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    color: inherit;
    list-style: none;
    border-bottom: none;
}

.osa-ai-rich summary::-webkit-details-marker {
    display: none;
}

.osa-ai-rich[open] summary {
    border-bottom: none;
}

.osa-ai-rich ul {
    margin: 6px 0 0 0;
    padding: 0 0 0 20px;
    font-size: 15px;
    color: inherit;
    line-height: 1.42;
}

/* Inline escalation draft form */
.osa-esc-draft-form {
    margin-top: 4px;
}
.osa-esc-draft-ta {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1.5px solid rgba(132, 26, 45, 0.25);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.45;
    color: #191412;
    background: rgba(255, 255, 255, 0.85);
    resize: vertical;
    min-height: 72px;
    outline: none;
    transition: border-color 0.15s;
}
.osa-esc-draft-ta:focus {
    border-color: #841a2d;
    background: #fff;
}
.osa-esc-draft-ta::placeholder {
    color: #9a9a9a;
    font-size: 13px;
}

/* iOS-style service picker row: translucent, hairline separator, tight caps label */
.osa-ai-service-row {
    flex-shrink: 0;
    padding: 10px 14px 8px;
    border-top: 0.5px solid rgba(60, 60, 67, 0.12);
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

.osa-ai-service-row__label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #6e6e73;
    margin: 0 0 6px 2px;
}

.osa-ai-service-select {
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: #1c1c1e;
    padding: 11px 36px 11px 14px;
    border-radius: 11px;
    border: 0.5px solid rgba(60, 60, 67, 0.18);
    background-color: rgba(255, 255, 255, 0.88);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238e8e93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px 6px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 140ms ease;
}

.osa-ai-service-select:hover {
    background-color: #fff;
    border-color: rgba(60, 60, 67, 0.28);
}

.osa-ai-service-select:focus {
    border-color: #841a2d;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(132, 26, 45, 0.12);
}

.osa-ai-service-select:active {
    background-color: rgba(242, 242, 247, 0.95);
}

.osa-ai-service-select option {
    background: #fff;
    color: #1c1c1e;
    font-weight: 500;
    padding: 10px;
}

.osa-ai-service-select option:disabled,
.osa-ai-service-select option[value=""] {
    color: #8e8e93;
}

.osa-ai-visitor a {
    color: #841a2d;
    font-weight: 600;
}

.osa-ai-chips-wrapper {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 6px 0 8px;
    border-top: .5px solid rgba(0, 0, 0, .05);
}

.osa-ai-chips {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 12px 6px;
    gap: 8px;
    background: transparent !important;
}

.osa-ai-chips.is-dragging {
    cursor: grabbing;
}

.osa-ai-chips::-webkit-scrollbar {
    display: none;
}

.osa-ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: #fff;
    border-radius: var(--osai-r-chip) !important;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
    box-shadow: none;
    border: 1px solid rgba(132, 26, 45, .18) !important;
    transition: background .12s, color .12s;
}

.osa-ai-chip:active {
    background: var(--brand) !important;
    color: #fff !important;
}

.osa-ai-composer {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: .5px solid rgba(0, 0, 0, .08);
    padding: 6px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.osa-ai-composer__row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.osa-ai-composer textarea {
    flex: 1;
    background: #fffdf9 !important;
    border-radius: var(--osai-r-control) !important;
    padding: 8px 14px;
    min-height: 42px;
    border: 1px solid rgba(132, 26, 45, 0.18) !important;
    font-family: inherit;
    font-size: 15px;
    color: #000;
    outline: none !important;
    resize: none;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
}

.osa-ai-composer textarea::placeholder {
    color: #8e8e93;
}

.osa-ai-btn-send {
    width: 36px;
    height: 36px;
    min-height: 36px !important;
    border-radius: 50% !important;
    background: var(--brand) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border: none !important;
    transition: opacity .12s, transform .12s;
    padding: 0 !important;
    box-shadow: 0 2px 8px rgba(132,26,45,0.35);
    color: #fff;
}

.osa-ai-btn-send svg {
    fill: #fff;
    width: 15px;
    height: 15px;
}

.osa-ai-btn-send:disabled {
    background: rgba(132,26,45,0.3) !important;
    box-shadow: none;
    cursor: default;
}

.osa-ai-btn-send:not(:disabled):active {
    opacity: 0.8;
    transform: scale(0.92);
}

.osa-ai-btn-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.osa-ai-btn-send svg {
    width: 25px;
    height: 25px;
    fill: var(--brand);
    margin-left: 0;
}

.osa-ai-composer__hint {
    text-align: center;
    font-size: 10.5px;
    color: #aeaeb2;
    padding: 3px 12px 0;
    flex-shrink: 0;
    line-height: 1.4;
    margin: 0;
}

/* ── OTP / Verification card — EAC maroon-and-gold premium ─────
   Matches the welcome bubble identity: deep maroon header strip
   with gold ribbon + cream copy on top, then a clean cream form
   body so inputs stay readable. Same brand DNA as the welcome
   bubble so students recognize "this is official OSA". */
.osa-ai-otp {
    position: relative;
    max-width: 100%;
    padding: 0;
    border: 1px solid rgba(247, 215, 129, 0.42);
    background: #fffdf8;
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.28) inset,
        0 12px 32px rgba(61, 6, 16, 0.18),
        0 0 0 1px rgba(247, 215, 129, 0.10);
    border-radius: 14px !important;
    margin: 8px 0 0;
    border-top: none;
    overflow: hidden;
}
/* Gold left ribbon — matches the welcome bubble accent. */
.osa-ai-otp::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #f7d781 0%, #c79a49 50%, #b6873a 100%);
    box-shadow: 0 0 12px rgba(247, 215, 129, 0.55);
    pointer-events: none;
    z-index: 1;
}

/* Maroon header strip with gold eyebrow + cream description. */
/* .osa-ai-otp__head / __eyebrow / __desc — removed per request. The OTP
   bubble now uses a plain intro line (.osa-ai-msg__text) above the form. */

.osa-ai-otp__title {
    margin: 0 0 0.6rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-deep);
    border-bottom: 1px solid rgba(132, 26, 45, 0.08);
    padding-bottom: 8px;
    display: inline-block;
}

.osa-ai-otp__text {
    margin: 0 0 0.8rem;
    font-size: 0.8rem;
    color: #5a4d44;
    line-height: 1.4;
}

/* Form body — sits below the maroon header strip with cream
   background and padded gutter that respects the gold left ribbon. */
.osa-ai-otp__field {
    margin: 0 14px 12px 18px;
    display: block;
}
.osa-ai-otp__field:first-of-type {
    margin-top: 14px;
}

.osa-ai-otp__field label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #841a2d;
    margin-bottom: 5px;
    display: block;
}

.osa-ai-otp__field input {
    width: 100%;
    height: 38px;
    border: 1.5px solid rgba(132, 26, 45, 0.18) !important;
    border-radius: 10px !important;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    background: #ffffff !important;
    outline: none !important;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-shadow: 0 1px 2px rgba(61, 6, 16, 0.04);
}

.osa-ai-otp__field input:focus {
    background: #fffdf6 !important;
    border-color: #c79a49 !important;
    box-shadow:
        0 0 0 3px rgba(247, 215, 129, 0.32),
        0 0 0 1px rgba(132, 26, 45, 0.18) !important;
}

.osa-ai-otp__field input[autocomplete="one-time-code"] {
    letter-spacing: 4px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.osa-ai-otp__field input[autocomplete="one-time-code"]::placeholder {
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 400;
}

.osa-ai-otp__actions {
    display: block;
    margin: 4px 14px 12px 18px;
}

.osa-ai-otp__btn {
    width: 100%;
    height: 40px;
    border: none !important;
    border-radius: 10px !important;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #5a4d44;
    background: #f3ece0 !important;
}

.osa-ai-otp__btn:active {
    transform: translateY(1px);
}

/* Premium maroon-and-gold CTA — gold inner highlight + soft maroon glow. */
.osa-ai-otp__btn--primary {
    position: relative;
    color: #fef7e0 !important;
    background:
        linear-gradient(135deg, #6b0f1f 0%, #5a0a18 55%, #3d0610 100%) !important;
    border: 1px solid rgba(247, 215, 129, 0.55) !important;
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.32) inset,
        0 6px 16px rgba(61, 6, 16, 0.32),
        0 0 0 1px rgba(247, 215, 129, 0.10);
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.osa-ai-otp__btn--primary:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.45) inset,
        0 8px 22px rgba(61, 6, 16, 0.42),
        0 0 0 1px rgba(247, 215, 129, 0.22);
}

.osa-ai-otp__btn:disabled {
    background: #d8d2c5 !important;
    color: #8a7f70 !important;
    border-color: rgba(132, 26, 45, 0.12) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    cursor: not-allowed;
    opacity: 1;
}

.osa-ai-otp__status {
    margin: 0 14px 12px 18px;
    font-size: 0.74rem;
    font-weight: 600;
    min-height: 1.1rem;
}

.osa-ai-otp__status.is-ok {
    color: #15803d;
}

.osa-ai-otp__status.is-err {
    color: #b91c1c;
}

.osa-ai-otp__status.is-wait {
    color: #b45309;
}

.osa-ai-otp__demo {
    margin-top: 0.35rem;
    font-size: 0.65rem;
    color: var(--muted);
    font-style: italic;
}

.osa-ai-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.osa-ai-actions button {
    min-height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--brand);
    border: 1px solid rgba(132, 26, 45, 0.2) !important;
    background: #fff !important;
    border-radius: var(--osai-r-control) !important;
    transition: background 0.15s ease;
}

.osa-ai-actions button:hover {
    background: rgba(132, 26, 45, 0.05) !important;
}

/* ── Premium escalate / verify CTA ─────────────────────────────────
   Used by: "Verify email & escalate", "Get New OTP Code",
   "Verify email in this chat", "Resume this case", "I'm still here",
   "Submit & Escalate to OSA Staff", etc. Same maroon-and-gold DNA
   as the OTP primary button + welcome bubble. */
/* Clean, neutral chip-style button at rest. On hover it picks up the
   same maroon-and-gold DNA as the OTP "Send OTP Code" / "Verify Code"
   primary button — gentle lift, warm cream wash, gold-tinted border,
   and a soft maroon glow — so the CTA clearly responds to the cursor. */
.osa-escalate-btn,
.osa-ai-actions .osa-escalate-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 14px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0;
    color: #2a2419;
    background: #ffffff;
    border: 1px solid rgba(60, 50, 40, 0.22);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: none;
    text-shadow: none;
    transform: translateY(0);
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.2s ease,
        color 0.18s ease,
        transform 0.12s ease;
}
.osa-escalate-btn:hover:not(:disabled),
.osa-ai-actions .osa-escalate-btn:hover:not(:disabled) {
    background:
        linear-gradient(180deg, #fff8e8 0%, #f7ead0 100%);
    border-color: rgba(247, 215, 129, 0.85);
    color: #6b0f1f;
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.55) inset,
        0 6px 14px rgba(107, 15, 31, 0.18),
        0 0 0 1px rgba(247, 215, 129, 0.35);
    transform: translateY(-1px);
}
.osa-escalate-btn:focus-visible:not(:disabled),
.osa-ai-actions .osa-escalate-btn:focus-visible:not(:disabled) {
    outline: none;
    border-color: rgba(247, 215, 129, 0.9);
    box-shadow:
        0 0 0 3px rgba(247, 215, 129, 0.45),
        0 0 0 1px rgba(107, 15, 31, 0.55);
}
.osa-escalate-btn:active:not(:disabled) {
    transform: translateY(0);
    background: #ece4d4;
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.35) inset,
        0 2px 6px rgba(107, 15, 31, 0.18);
}
.osa-escalate-btn:disabled {
    background: #f3eee4;
    color: #8a7f70;
    border-color: rgba(60, 50, 40, 0.12);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
@media (prefers-reduced-motion: reduce) {
    .osa-escalate-btn,
    .osa-ai-actions .osa-escalate-btn { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.2s ease; }
    .osa-escalate-btn:hover:not(:disabled),
    .osa-ai-actions .osa-escalate-btn:hover:not(:disabled),
    .osa-escalate-btn:active:not(:disabled) { transform: none; }
}

.osa-launcher-fab {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right, 0px));
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 3.2rem;
    padding: 0 1.25rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fffef9;
    cursor: pointer;
    border: none !important;
    background: var(--brand) !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 20px rgba(132, 26, 45, 0.25);
    transition: box-shadow 220ms ease, filter 220ms ease, opacity 250ms ease, visibility 250ms ease;
    pointer-events: auto !important;
    touch-action: manipulation;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
}

@media (max-width: 640px) {
    .osa-launcher-fab {
        min-height: 2.8rem;
        padding: 0 1rem;
        font-size: 0.75rem;
    }
}

.osa-launcher-fab:hover,
.osa-launcher-fab:focus-visible {
    outline: none;
    filter: brightness(1.06);
    box-shadow: 0 14px 36px rgba(61, 34, 19, 0.28);
}

.osa-launcher-fab__box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.18);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    flex-shrink: 0;
}

.osa-launcher-fab[aria-expanded="true"] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(20px) scale(0.9);
}

.osa-launcher-panel {
    position: fixed;
    /* Forces perfectly equal margins horizontally via calc! */
    right: max(1rem, env(safe-area-inset-right, 1rem));
    left: auto;
    bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    z-index: 2147482999;
    width: min(390px, calc(100vw - 2rem));
    height: min(700px, calc(100vh - 2rem));
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border: none !important;
    /* Removed ANY outline or borders for a modern, seamless look */
    border-radius: var(--osai-r-shell) !important;
    background: linear-gradient(135deg, rgba(254, 236, 201, 1) 0%, rgba(246, 213, 218, 1) 100%) !important;
    /* Richer tinted red/yellow background */
    box-shadow: 0 16px 48px rgba(20, 10, 5, 0.15) !important;

    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.98);
    transition: opacity 200ms ease, transform 200ms ease, visibility 200ms ease;
}

.osa-launcher-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../assets/images/eac-photo.png') center/cover no-repeat;
    filter: blur(8px);
    opacity: 0.35;
    /* Increased opacity from 0.1 to 0.35 so it's explicitly visible */
    pointer-events: none;
    z-index: 0;
}

.osa-launcher-panel>* {
    position: relative;
    z-index: 1;
    /* Keeps headers/chat over the background img */
}

.osa-launcher-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .osa-launcher-panel {
        transition: opacity 120ms ease, visibility 120ms ease;
        transform: none;
    }

    .osa-launcher-panel.is-open {
        transform: none;
    }
}

@media (max-width: 768px) {
    .osa-launcher-panel {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        z-index: 9999 !important;
        /* Guarantee it floats above any mobile navbars/footers */
    }

    .osa-launcher-panel .osa-ai-shell {
        border: none !important;
        border-radius: 0 !important;
        height: 100%;
        max-height: 100dvh !important;
    }

    .osa-launcher-panel .osa-ai-composer {
        padding: 1rem 1rem max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
        /* Stronger base padding for physical thumbs */
    }

    .osa-launcher-panel .osa-ai-header {
        padding-top: max(1.2rem, env(safe-area-inset-top, 1.2rem));
        padding-right: 0.75rem;
        /* Balances the wide SVG close button */
    }

    .osa-ai-btn-send {
        width: 42px;
        height: 42px;
        min-height: 42px !important;
        padding: 0 !important;
    }

    .osa-ai-composer textarea {
        min-height: 3rem;
    }
}

.osa-launcher-panel .osa-ai-thread {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    /* Forces the layout to push the composer to the true bottom */
}

.osa-launcher-panel .osa-ai-composer textarea {
    min-height: 2.35rem;
}

.osa-launcher-head__close {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.95);
    padding: 0.65rem;
    /* Massive thumb target for mobile */
    cursor: pointer;
    opacity: 0.95;
    transition: transform 150ms ease, opacity 150ms ease;
    margin-right: -0.5rem;
    /* Optically centers the X relative to the right edge */
}

.osa-launcher-head__close:hover {
    opacity: 1;
    transform: scale(1.1);
}

.osa-launcher-fab.is-hidden {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none !important;
    transform: translateY(15px) scale(0.9);
}

/* ----- Thesis manuscript — 3-tier UI affordances ----- */
.osa-ai-subhead {
    padding: 0.5rem 1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 254, 249, 0.72);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.1);
}

.osa-ai-tier-rail {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.45rem 0.75rem 0.55rem;
    border-bottom: 1px solid var(--osai-line);
    background: linear-gradient(180deg, rgba(249, 244, 234, 0.9), rgba(255, 253, 248, 0.65));
}

.osa-ai-tier-rail__cell {
    padding: 0.35rem 0.4rem;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.35;
    color: var(--osai-maroon-deep);
    border: 1px solid rgba(141, 21, 39, 0.15);
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--osai-r-control) !important;
}

.osa-ai-tier-rail__cell strong {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--osai-maroon);
}

.osa-ai-tier-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.55rem;
}

.osa-ai-badge-tier {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 9999px !important;
    border: 1px solid transparent;
}

.osa-ai-badge-tier--t1 {
    color: #14532d;
    background: linear-gradient(180deg, #dcfce7, #bbf7d0);
    border-color: rgba(21, 128, 61, 0.35);
}

.osa-ai-badge-tier--t2 {
    color: #7c2d12;
    background: linear-gradient(180deg, #ffedd5, #fed7aa);
    border-color: rgba(194, 65, 12, 0.35);
}

.osa-ai-badge-tier--t3 {
    color: #fffef9;
    background: linear-gradient(165deg, var(--osai-maroon), var(--osai-maroon-deep));
    border-color: rgba(0, 0, 0, 0.15);
}

.osa-ai-tier-footnote {
    width: 100%;
    margin: 0;
    font-size: 0.68rem;
    color: #78716c;
    line-height: 1.4;
}

.osa-ai-source-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.osa-ai-source-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--osai-maroon-deep);
    border: 1px dashed rgba(141, 21, 39, 0.35);
    background: rgba(255, 251, 245, 0.95);
    border-radius: var(--osai-r-control) !important;
}

.osa-ai-hub {
    margin-top: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(141, 21, 39, 0.2);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(249, 244, 234, 0.65));
    border-radius: 12px !important;
}

.osa-ai-hub__title {
    margin: 0 0 0.2rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--osai-maroon);
}

.osa-ai-hub__sub {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    color: #57534e;
    line-height: 1.45;
}

.osa-ai-hub__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

@media (min-width: 480px) {
    .osa-ai-hub__grid {
        grid-template-columns: 1fr 1fr;
    }
}

.osa-ai-hub__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--brand);
    border: 1px solid rgba(132, 26, 45, 0.2) !important;
    background: var(--paper) !important;
    border-radius: var(--osai-r-control) !important;
    transition: background 0.15s ease;
}

.osa-ai-hub__btn:hover {
    background: rgba(132, 26, 45, 0.05) !important;
}

.osa-ai-hub__btn--secondary {
    color: #fffef9;
    border: none !important;
    background: var(--brand) !important;
}

.osa-ai-formcard {
    margin-top: 0.5rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--osai-line);
    background: #fff;
    border-top: 3px solid var(--brand);
    border-radius: var(--osai-r-control) !important;
    box-shadow: 0 10px 28px rgba(54, 29, 16, 0.06);
}

.osa-ai-formcard__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #78716c;
}

.osa-ai-formcard input,
.osa-ai-formcard textarea,
.osa-ai-formcard select {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.55rem;
    font: inherit;
    font-size: 0.8rem;
    border: 1px solid rgba(141, 21, 39, 0.18) !important;
    border-radius: var(--osai-r-control) !important;
}

.osa-ai-formcard__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.osa-ai-case-ref {
    margin: 0.5rem 0 0;
    padding: 0.55rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--osai-maroon-deep);
    border: 1px solid rgba(212, 166, 81, 0.45);
    background: linear-gradient(180deg, #fffbeb, #fef3c7);
    border-radius: var(--osai-r-control) !important;
}

.osa-ai-continuity-note {
    margin-top: 0.5rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.65rem;
    color: #57534e;
    line-height: 1.45;
    border-left: 3px solid var(--osai-gold);
    background: rgba(255, 251, 245, 0.9);
    border-radius: 0 var(--osai-r-control) var(--osai-r-control) 0 !important;
}

.chat-aside-tier {
    display: grid;
    gap: 0.45rem;
}

.chat-aside-tier__step {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.45rem 0.5rem;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #44403c;
    border: 1px solid rgba(141, 21, 39, 0.1);
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--osai-r-control) !important;
}

.chat-aside-tier__num {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: #fffef9;
    background: var(--osai-maroon);
    border-radius: 9999px !important;
}

/* ----- Full /chat page: primary assistant is the hero; wider canvas + taller thread ----- */
.chat-page-shell {
    max-width: min(100%, 96rem) !important;
}

.chat-page-shell .osa-ai-shell {
    min-height: min(82vh, 920px) !important;
}

.chat-page-shell .osa-ai-thread {
    min-height: 18rem !important;
    max-height: min(64vh, 720px) !important;
}

@media (max-width: 640px) {
    .chat-page-shell .osa-ai-thread {
        max-height: min(54vh, 560px) !important;
    }
}

.chat-page-shell .osa-ai-msg__bubble {
    max-width: 72% !important;
}

.chat-page-shell .osa-ai-composer textarea {
    min-height: 3.35rem !important;
    font-size: 0.9375rem !important;
}

.chat-page-shell .osa-ai-btn-send {
    width: 42px;
    height: 42px;
    min-height: 42px !important;
    padding: 0 !important;
}

.chat-page-shell .osa-ai-header {
    padding: 1rem 1.15rem !important;
}

.chat-page-shell .osa-ai-header__titles strong {
    font-size: 1.05rem !important;
}

.chat-page-shell .osa-ai-subhead {
    font-size: 0.84rem !important;
    padding: 0.55rem 1rem !important;
}

.chat-page-shell .osa-ai-tier-rail {
    padding: 0.45rem 1rem !important;
}

.chat-page-shell .osa-ai-tier-rail__cell {
    font-size: 0.72rem !important;
}

/* -------------------------------------------------------------------------
   Launcher widget — modern iOS-inspired glassmorphism, rounded, EAC theme.
   ------------------------------------------------------------------------- */
.osa-launcher-panel--chat-ui {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: linear-gradient(160deg, #fff7f0 0%, #fdf0f3 55%, #fef5e4 100%) !important;
    box-shadow: 0 24px 56px rgba(54, 28, 14, 0.18), 0 4px 16px rgba(132, 26, 45, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.7) !important;
    border-radius: 24px !important;
}

.osa-launcher-panel--chat-ui::before {
    border-radius: 24px;
    opacity: 0.18 !important;
    filter: blur(6px) !important;
}

/* ── Header: glassy maroon bar with depth ─── */
.osa-launcher-panel--chat-ui .osa-ai-header {
    align-items: center;
    min-height: 66px;
    padding: 0 14px 0 16px;
    background: linear-gradient(135deg, #8f1c30 0%, #841a2d 60%, #9e2438 100%) !important;
    border-bottom: none;
    border-radius: 24px 24px 0 0 !important;
    box-shadow: 0 3px 14px rgba(132, 26, 45, 0.32), inset 0 1px 0 rgba(255,255,255,0.12);
}

.osa-launcher-panel--chat-ui .osa-ai-header__avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px !important;
    border: 1.5px solid rgba(255,255,255,0.22) !important;
    background: rgba(255,255,255,0.14) !important;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.osa-launcher-panel--chat-ui .osa-ai-header__titles strong {
    color: #fff !important;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.osa-launcher-panel--chat-ui .osa-ai-header__sub {
    margin-top: 3px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.osa-launcher-panel--chat-ui .osa-ai-header__status-line {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.88);
}

.osa-launcher-panel--chat-ui .osa-ai-header__status-line::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74,222,128,0.28);
    flex-shrink: 0;
}

.osa-launcher-panel--chat-ui .osa-ai-header__status-line.is-staff {
    color: rgba(255,255,255,0.92);
}

/* Live OSA Staff — bright green dot, fires only after `staff_joined` /
   `staff_message` SSE events. */
.osa-launcher-panel--chat-ui .osa-ai-header__status-line.is-staff::before {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34,197,94,0.32);
    animation: osaiStaffDotPulse 1.4s ease-in-out infinite;
}

/* Waiting for OSA Staff — calmer amber dot, used while the ticket has
   been created but no staff member has joined yet. */
.osa-launcher-panel--chat-ui .osa-ai-header__status-line.is-waiting {
    color: rgba(255,255,255,0.88);
}

.osa-launcher-panel--chat-ui .osa-ai-header__status-line.is-waiting::before {
    background: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.30);
    animation: osaiWaitingDotPulse 1.6s ease-in-out infinite;
}

@keyframes osaiStaffDotPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.32); }
    50%      { box-shadow: 0 0 0 5px rgba(34,197,94,0.18); }
}

@keyframes osaiWaitingDotPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(251,191,36,0.30); }
    50%      { opacity: 0.6; box-shadow: 0 0 0 4px rgba(251,191,36,0.16); }
}

/* Session timer (chat-ui shell variant) — naked OSA-cream label, no
   container. Mirrors the base widget: warm gold by default, amber on
   warning, soft red + pulse on critical. Sits cleanly on the maroon
   header without competing with surrounding chrome. */
.osa-launcher-panel--chat-ui .osa-ai-session-timer {
    border-radius: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #f7d781 !important;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
    font-variant-numeric: tabular-nums !important;
    letter-spacing: 0.02em !important;
    padding: 0 !important;
    gap: 5px !important;
    display: inline-flex !important;
    align-items: center !important;
}

.osa-launcher-panel--chat-ui .osa-ai-session-timer svg {
    color: #f7d781 !important;
    opacity: 0.92;
}

.osa-launcher-panel--chat-ui .osa-ai-session-timer.is-warning,
.osa-launcher-panel--chat-ui .osa-ai-session-timer.is-warning svg {
    background: transparent !important;
    color: #fcd34d !important;
    border: 0 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-session-timer.is-critical,
.osa-launcher-panel--chat-ui .osa-ai-session-timer.is-critical svg {
    background: transparent !important;
    color: #fca5a5 !important;
    border: 0 !important;
}

/* Sign-out (chat-ui shell variant) — naked label to match the timer. */
.osa-launcher-panel--chat-ui .osa-ai-header-signout {
    border-radius: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #f7d781 !important;
    padding: 0 !important;
    font-size: 11.5px !important;
}
.osa-launcher-panel--chat-ui .osa-ai-header-signout:hover,
.osa-launcher-panel--chat-ui .osa-ai-header-signout:hover .osa-ai-header-signout__icon {
    background: transparent !important;
    border: 0 !important;
    color: #fca5a5 !important;
}
.osa-launcher-panel--chat-ui .osa-ai-header-signout__icon {
    color: #f7d781 !important;
    opacity: 0.92;
}

/* Mode badge on dark header */
.osa-launcher-panel--chat-ui .osa-ai-mode {
    border-radius: 8px !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    background: rgba(255,255,255,0.14) !important;
    color: rgba(255,255,255,0.9) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-mode--faq {
    background: rgba(134,239,172,0.2) !important;
    color: #86efac !important;
    border-color: rgba(134,239,172,0.28) !important;
}

/* Live staff badge — green to match the live status dot. */
.osa-launcher-panel--chat-ui .osa-ai-mode--staff {
    background: rgba(34,197,94,0.22) !important;
    color: #86efac !important;
    border-color: rgba(34,197,94,0.34) !important;
}

/* Waiting badge — amber to match the waiting status dot. */
.osa-launcher-panel--chat-ui .osa-ai-mode--waiting {
    background: rgba(251,191,36,0.20) !important;
    color: #fcd34d !important;
    border-color: rgba(251,191,36,0.32) !important;
}

.osa-launcher-panel--chat-ui .osa-launcher-head__close {
    color: rgba(255,255,255,0.82) !important;
    margin-right: -4px;
    border-radius: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 140ms ease, transform 140ms ease;
}

.osa-launcher-panel--chat-ui .osa-launcher-head__close:hover {
    color: #fff !important;
    background: transparent !important;
}

/* Scroll-to-bottom pill */
.osa-launcher-panel--chat-ui .osa-ai-scroll-bottom {
    border-radius: 999px !important;
    bottom: 172px;
    background: rgba(255,255,255,0.88) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12) !important;
    border: 0.5px solid rgba(132,26,45,0.14) !important;
}

/* ── Thread ─── */
.osa-launcher-panel--chat-ui .osa-ai-thread {
    padding: 18px 14px 12px;
    background: transparent;
}

.osa-launcher-panel--chat-ui .osa-ai-msg {
    margin-bottom: 10px;
}

.osa-launcher-panel--chat-ui .osa-ai-msg > div {
    max-width: 80%;
}

/* ── Bubbles: glassy iOS style ─── */
.osa-launcher-panel--chat-ui .osa-ai-msg__bubble {
    border-radius: 18px !important;
    padding: 10px 14px;
    font-size: 14.5px;
    line-height: 1.52;
}

.osa-launcher-panel--chat-ui .osa-ai-msg--user .osa-ai-msg__bubble {
    background: linear-gradient(135deg, #9a1f35 0%, #841a2d 100%) !important;
    border: none !important;
    border-bottom-right-radius: 5px !important;
    box-shadow: 0 3px 10px rgba(132, 26, 45, 0.28) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    margin-right: 4px;
}

.osa-launcher-panel--chat-ui .osa-ai-msg--assistant .osa-ai-msg__bubble {
    background: rgba(255,255,255,0.82) !important;
    border: 0.5px solid rgba(255,255,255,0.6) !important;
    color: #1c1412 !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    border-bottom-left-radius: 5px !important;
}

/* ── Welcome bubble override inside chat-ui panel ──────────────
   The generic .osa-ai-msg--assistant rule above paints every assistant
   bubble white. The welcome bubble must escape that and keep the EAC
   maroon-and-gold treatment, so we re-declare with higher specificity
   (chat-ui panel + welcome modifier) and !important. Body text uses
   pure white + a soft dark text-shadow so contrast is unmistakable. */
.osa-launcher-panel--chat-ui .osa-ai-msg--assistant.osa-ai-msg--welcome .osa-ai-msg__bubble,
.osa-launcher-panel--chat-ui .osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble {
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(247,215,129,0.18) 0%, rgba(247,215,129,0) 55%),
        linear-gradient(135deg, #6b0f1f 0%, #5a0a18 55%, #3d0610 100%) !important;
    border: 1px solid rgba(247, 215, 129, 0.42) !important;
    color: #ffffff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow:
        0 1px 0 rgba(247, 215, 129, 0.28) inset,
        0 8px 22px rgba(61, 6, 16, 0.36),
        0 0 0 1px rgba(247, 215, 129, 0.12) !important;
    padding-left: 18px !important;
    border-bottom-left-radius: 5px !important;
}
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-ai-msg__bubble p,
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-ai-msg__bubble span,
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-welcome-text {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(20, 0, 5, 0.45);
}
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-ai-msg__bubble strong,
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-ai-msg__bubble b {
    color: #ffe9a8 !important;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(20, 0, 5, 0.55);
}
.osa-launcher-panel--chat-ui .osa-ai-msg--welcome .osa-ai-msg__bubble a {
    color: #ffe9a8 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-msg__meta {
    color: rgba(100,80,70,0.65);
    margin-top: 3px;
    padding: 0 3px;
    font-size: 10.5px;
}

/* ── Typing dots ─── */
.osa-launcher-panel--chat-ui .osa-ai-typing {
    border-radius: 18px !important;
    border-bottom-left-radius: 5px !important;
    padding: 12px 16px;
    gap: 5px;
    background: rgba(255,255,255,0.8) !important;
    border: 0.5px solid rgba(255,255,255,0.6) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-typing span {
    width: 6px;
    height: 6px;
    background: #9a8a80;
}

/* System message pill */
.osa-launcher-panel--chat-ui .osa-ai-system {
    border-radius: 999px !important;
    background: rgba(255,255,255,0.55) !important;
    border: 0.5px solid rgba(132,26,45,0.12) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    color: #6b4840;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ── Service row ─── */
.osa-launcher-panel--chat-ui .osa-ai-service-row {
    border-top: 0.5px solid rgba(132,26,45,0.08);
    background: rgba(255,255,255,0.6) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-service-select {
    border-radius: 12px !important;
    border: 1px solid rgba(132,26,45,0.14) !important;
    background: rgba(255,255,255,0.88) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ── Quick-action chips ─── */
.osa-launcher-panel--chat-ui .osa-ai-chips-wrapper {
    border-top: 1px solid rgba(0,0,0,0.07);
    background: rgba(246,248,250,0.92) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 7px 0 9px;
}

.osa-launcher-panel--chat-ui .osa-ai-chip {
    border-radius: 999px !important;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,0.70) !important;
    color: #374151 !important;
    border: 1px solid rgba(0,0,0,0.10) !important;
    box-shadow: none;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.osa-launcher-panel--chat-ui .osa-ai-chip:hover {
    background: rgba(255,255,255,0.96) !important;
    color: #841a2d !important;
    border-color: rgba(132,26,45,0.20) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-chip:active {
    background: #841a2d !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* ── Composer bar ─── */
.osa-launcher-panel--chat-ui .osa-ai-composer {
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.65) !important;
    border-top: 0.5px solid rgba(132,26,45,0.07);
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 0 0 24px 24px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-composer__row {
    align-items: flex-end;
    gap: 8px;
}

.osa-launcher-panel--chat-ui .osa-ai-composer textarea {
    border-radius: 14px !important;
    border: 1px solid rgba(132,26,45,0.12) !important;
    background: rgba(255,255,255,0.88) !important;
    font-size: 14.5px;
    line-height: 1.5;
    max-height: 120px;
    min-height: 42px;
    padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.osa-launcher-panel--chat-ui .osa-ai-composer textarea:focus {
    border-color: rgba(132,26,45,0.35) !important;
    background: rgba(255,255,255,0.98) !important;
    box-shadow: 0 0 0 3px rgba(132,26,45,0.1), 0 1px 3px rgba(0,0,0,0.04) !important;
    outline: none;
}

.osa-launcher-panel--chat-ui .osa-ai-composer textarea::placeholder {
    color: #b0978a;
}

.osa-launcher-panel--chat-ui .osa-ai-btn-send {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    border-radius: 50% !important;
    box-shadow: 0 3px 10px rgba(132,26,45,0.3) !important;
    background: linear-gradient(135deg, #9a1f35 0%, #841a2d 100%) !important;
    transition: transform 120ms ease, box-shadow 120ms ease !important;
}

.osa-launcher-panel--chat-ui .osa-ai-btn-send:not(:disabled):active {
    transform: scale(0.91) !important;
    box-shadow: 0 2px 6px rgba(132,26,45,0.2) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-btn-send svg {
    width: 17px !important;
    height: 17px !important;
    fill: #fff !important;
}

.osa-launcher-panel--chat-ui .osa-ai-composer__hint {
    font-size: 10.5px;
    color: rgba(100,80,70,0.55);
    text-align: center;
    padding-top: 4px;
}

/* ── Escalation/waiting card ─── */
.osa-launcher-panel--chat-ui .osa-ai-waiting {
    border-radius: 16px !important;
    background: rgba(255,255,255,0.82) !important;
    border: 0.5px solid rgba(132,26,45,0.14) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 16px rgba(132,26,45,0.1) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-waiting__cancel {
    border-radius: 8px !important;
}

/* ── Handoff card ─── */
.osa-launcher-panel--chat-ui .osa-ai-handoff {
    border-radius: 16px !important;
    background: rgba(255,255,255,0.82) !important;
    border: 0.5px solid rgba(255,255,255,0.6) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06) !important;
}

/* ── OTP card (compact) — chat-ui variant overrides for tighter sizing
   while preserving the EAC maroon-and-gold treatment from the base. */
.osa-launcher-panel--chat-ui .osa-ai-otp {
    border-radius: 12px !important;
    padding: 0 !important;
    margin: 6px 0 0 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__field {
    margin: 0 12px 8px 16px !important;
}
.osa-launcher-panel--chat-ui .osa-ai-otp__field:first-of-type {
    margin-top: 11px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__field label {
    font-size: 9.5px !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 3px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__field input,
.osa-launcher-panel--chat-ui .osa-ai-otp__field textarea {
    height: 34px !important;
    padding: 0 11px !important;
    font-size: 12.5px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__field input[autocomplete="one-time-code"] {
    font-size: 14px !important;
    letter-spacing: 3px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__field input[autocomplete="one-time-code"]::placeholder {
    font-size: 12px !important;
    letter-spacing: 0 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__actions {
    margin: 4px 12px 10px 16px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__btn,
.osa-launcher-panel--chat-ui .osa-ai-otp__btn--primary {
    border-radius: 9px !important;
    height: 36px !important;
    font-size: 12.5px !important;
}

.osa-launcher-panel--chat-ui .osa-ai-otp__status {
    margin: 0 12px 10px 16px !important;
    font-size: 11px !important;
    min-height: 0.95rem !important;
}

/* Compact escalate CTA inside chat-ui panel. */
.osa-launcher-panel--chat-ui .osa-escalate-btn {
    min-height: 34px !important;
    padding: 0 13px !important;
    font-size: 12.5px !important;
    border-radius: 9px !important;
}

/* ── Talking with admin: dynamic header + hidden quick topics ─── */
@keyframes osaStaffHeaderShimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes osaStaffHeaderGlow {
    0%, 100% { box-shadow: 0 3px 14px rgba(132, 26, 45, 0.45), inset 0 1px 0 rgba(255,255,255,0.18), 0 0 0 0 rgba(251,146,60,0.0); }
    50%      { box-shadow: 0 6px 22px rgba(199, 154, 73, 0.55), inset 0 1px 0 rgba(255,255,255,0.22), 0 0 0 8px rgba(251,146,60,0.18); }
}

.osa-launcher-panel--chat-ui .osa-ai-header.is-staff-live {
    background: linear-gradient(120deg, #6b1424 0%, #a4203a 18%, #16a34a 38%, #4ade80 52%, #16a34a 66%, #a4203a 82%, #6b1424 100%) !important;
    background-size: 320% 320% !important;
    animation: osaStaffHeaderShimmer 3.2s ease-in-out infinite, osaStaffHeaderGlow 1.6s ease-in-out infinite !important;
}

.osa-launcher-panel--chat-ui .osa-ai-header.is-staff-live .osa-ai-header__avatar {
    background: rgba(255,255,255,0.28) !important;
    border-color: rgba(255,255,255,0.48) !important;
    animation: osaStaffHeaderGlow 1.6s ease-in-out infinite !important;
}

/* Waiting header — quiet amber accent strip on top of the maroon, no
   shimmer animation. The user is still waiting, so the header should
   feel calm, not celebratory. */
.osa-launcher-panel--chat-ui .osa-ai-header.is-staff-waiting {
    box-shadow:
        inset 0 2px 0 rgba(251, 191, 36, 0.55),
        0 3px 14px rgba(132, 26, 45, 0.45),
        inset 0 -1px 0 rgba(0, 0, 0, 0.10) !important;
    animation: none !important;
}

/* ── Verified ribbon — light strip just above the composer ──────
   Sits at the bottom of the panel as a quiet status row: cream
   background, soft maroon-on-cream text, subtle gold shield. The
   "End session" button is a discreet ghost pill, not a CTA. */
.osa-launcher-panel--chat-ui .osa-ai-verified-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 6px 14px !important;
    background: #fbf6ee !important;
    border-top: 1px solid rgba(132, 26, 45, 0.10) !important;
    border-bottom: 1px solid rgba(132, 26, 45, 0.06) !important;
    box-shadow: none !important;
    color: #5a4a3a !important;
    position: relative !important;
    z-index: 2 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__left {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #c79a49;
    filter: none;
    flex-shrink: 0;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__text {
    font-size: 11.5px;
    color: #6b5847;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0;
    font-weight: 500;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__text strong {
    color: #841a2d;
    font-weight: 700;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__timer {
    color: #6b5847 !important;
    background: rgba(132, 26, 45, 0.06) !important;
    border: 1px solid rgba(132, 26, 45, 0.12) !important;
}
.osa-launcher-panel--chat-ui .osa-ai-verified-bar__timer svg {
    color: #8a6f5c !important;
}
.osa-launcher-panel--chat-ui .osa-ai-verified-bar__timer.is-warning {
    color: #92400e !important;
    background: rgba(251, 191, 36, 0.18) !important;
    border-color: rgba(251, 191, 36, 0.45) !important;
}
.osa-launcher-panel--chat-ui .osa-ai-verified-bar__timer.is-critical {
    color: #991b1b !important;
    background: rgba(220, 38, 38, 0.10) !important;
    border-color: rgba(220, 38, 38, 0.40) !important;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__end {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 4px 10px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(132, 26, 45, 0.18) !important;
    background: #ffffff !important;
    color: #841a2d !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    cursor: pointer;
    box-shadow: none !important;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__end:hover {
    background: #fdf3f5 !important;
    border-color: rgba(132, 26, 45, 0.32) !important;
    box-shadow: none !important;
    transform: none;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__end:active {
    transform: none;
    background: #f8e7eb !important;
    box-shadow: none !important;
}

.osa-launcher-panel--chat-ui .osa-ai-verified-bar__end svg {
    color: #841a2d;
    opacity: 0.9;
}

/* When staff is live, give the verified strip a faint green wash. */
.osa-launcher-panel--chat-ui .osa-ai-header.is-staff-live ~ .osa-ai-verified-bar {
    background: #effaf1 !important;
    border-top-color: rgba(34, 197, 94, 0.22) !important;
}

/* When waiting for staff, give the verified strip a faint amber wash. */
.osa-launcher-panel--chat-ui .osa-ai-header.is-staff-waiting ~ .osa-ai-verified-bar {
    background: #fdf6e3 !important;
    border-top-color: rgba(251, 191, 36, 0.30) !important;
}

.osa-ai-chips-wrapper.is-hidden-staff,
.osa-ai-chips-wrapper.is-hidden-verified {
    display: none !important;
}

.osa-ai-composer__hint.is-staff {
    color: #c2410c !important;
    font-weight: 600 !important;
}

.osa-launcher-panel--chat-ui .osa-ai-composer__hint.is-staff {
    color: #fb923c !important;
}

/* ── Locked chip group (after preference is chosen) ─── */
.osa-ai-chip.is-chosen {
    background: linear-gradient(135deg, #a4203a 0%, var(--brand) 100%) !important;
    color: #fff !important;
    border-color: var(--brand) !important;
    cursor: default !important;
    box-shadow: 0 2px 8px rgba(132,26,45,0.18) !important;
}

.osa-ai-chip.is-chosen::after {
    content: " \2713";
    font-weight: 700;
}

.osa-ai-chip.is-locked {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}

.osa-ai-chip[disabled],
.osa-ai-chip[aria-disabled="true"] {
    pointer-events: none;
}

/* ── Actions / inline buttons ─── */
.osa-launcher-panel--chat-ui .osa-ai-actions button {
    border-radius: 8px !important;
    background: rgba(255,255,255,0.82) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(132,26,45,0.16) !important;
}

/* ── Escalation draft textarea ─── */
.osa-launcher-panel--chat-ui .osa-esc-draft-ta {
    border-radius: 12px !important;
    background: rgba(255,255,255,0.88) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

/* Mobile: full-screen but keep rounded top edge */
@media (max-width: 768px) {
    .osa-launcher-panel--chat-ui {
        border-radius: 0 !important;
    }
    .osa-launcher-panel--chat-ui::before {
        border-radius: 0 !important;
    }
    .osa-launcher-panel--chat-ui .osa-ai-header {
        border-radius: 0 !important;
        padding-top: max(14px, env(safe-area-inset-top, 0px));
    }
    .osa-launcher-panel--chat-ui .osa-ai-composer {
        border-radius: 0 !important;
    }
}

/* FAB — pill shape */
.osa-launcher-fab {
    border-radius: 999px !important;
    background: linear-gradient(135deg, #9a1f35 0%, #841a2d 100%) !important;
    box-shadow: 0 6px 22px rgba(132,26,45,0.35), 0 2px 6px rgba(132,26,45,0.2) !important;
    padding: 0 1.35rem !important;
    gap: 0.5rem;
    min-height: 3rem !important;
}

/* -------------------------------------------------------------------------
   Low-end mobile: drop expensive compositing (blur/backdrop) — keep visuals close
   ------------------------------------------------------------------------- */
@media (max-width: 960px) {

    .osa-ai-chips-wrapper,
    .osa-ai-composer {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .osa-ai-msg--user .osa-ai-msg__bubble,
    .osa-ai-msg--assistant .osa-ai-msg__bubble {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .osa-launcher-panel::before {
        filter: blur(5px);
        opacity: 0.28;
    }

    .osa-launcher-fab {
        will-change: auto;
        box-shadow: 0 4px 14px rgba(132, 26, 45, 0.22);
    }

    .osa-launcher-fab:hover,
    .osa-launcher-fab:focus-visible {
        box-shadow: 0 8px 22px rgba(61, 34, 19, 0.2);
    }

    .osa-launcher-panel {
        box-shadow: 0 8px 28px rgba(20, 10, 5, 0.12) !important;
    }
}

/* ── Per-message status receipts (sent / delivered / seen) ────── */
.osa-msg-status {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #b9a99c;
  font-weight: 700;
  user-select: none;
}
.osa-msg-status--queued { color: #d1c4ba; }
.osa-msg-status--sent { color: #b9a99c; }
.osa-msg-status--delivered { color: #8a766a; }
.osa-msg-status--seen { color: #841a2d; }
.osa-ai-msg--user .osa-ai-msg__meta { gap: 6px; }

/* ── Staff typing pill (transient, auto-hides) ──────────────── */
.osa-staff-typing-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 12px 4px;
  padding: 6px 12px;
  background: #f7efe6;
  color: #5a4636;
  border: 1px solid #ead7c1;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(132, 26, 45, 0.06);
  animation: osaStaffTypingFade 200ms ease-out;
}
.osa-staff-typing-pill__dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.osa-staff-typing-pill__dots span {
  width: 5px;
  height: 5px;
  background: #841a2d;
  border-radius: 50%;
  display: inline-block;
  animation: osaStaffTypingDot 1.1s infinite ease-in-out both;
}
.osa-staff-typing-pill__dots span:nth-child(2) { animation-delay: 0.16s; }
.osa-staff-typing-pill__dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes osaStaffTypingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
@keyframes osaStaffTypingFade {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .osa-staff-typing-pill__dots span,
  .osa-staff-typing-pill { animation: none; }
}

/* ── Welcome bubble — EAC-themed (maroon + gold), high contrast ──
   The first bubble keeps its premium institutional treatment (deep
   maroon ground, warm gold accents, soft glow + shimmer) but the
   typography is tuned for legibility: pure-white body text with a
   subtle dark text-shadow so the words stay sharp against the
   gradient. Bold weight + tight letter-spacing seals the contrast. */
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble {
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(247,215,129,0.16) 0%, rgba(247,215,129,0) 55%),
    linear-gradient(135deg, #6b0f1f 0%, #5a0a18 55%, #3d0610 100%) !important;
  border: 1px solid rgba(247, 215, 129, 0.42) !important;
  color: #ffffff !important;
  padding-left: 18px !important;
  box-shadow:
    0 1px 0 rgba(247, 215, 129, 0.18) inset,
    0 8px 20px rgba(61, 6, 16, 0.32),
    0 0 0 1px rgba(247, 215, 129, 0.10);
  position: relative;
  overflow: hidden;
  animation: osaWelcomeBubbleGlow 4.2s ease-in-out infinite;
}

/* Gold left-edge ribbon — evokes the EAC seal's vertical accent. */
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #f7d781 0%, #c79a49 50%, #b6873a 100%);
  box-shadow: 0 0 12px rgba(247, 215, 129, 0.55);
  pointer-events: none;
}

/* High-contrast typography overrides. Pure white body text + a soft
   dark text-shadow so it reads cleanly on the maroon ground. */
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble,
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble p,
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble span {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(20, 0, 5, 0.45);
}
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble strong,
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble b {
  color: #ffe9a8 !important;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(20, 0, 5, 0.55);
}
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble a {
  color: #ffe9a8 !important;
  text-decoration: underline;
  text-decoration-color: rgba(255, 233, 168, 0.55);
  text-underline-offset: 2px;
}
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble a:hover {
  color: #fff5c8 !important;
  text-decoration-color: #ffe9a8;
}

/* Soft looping gold shimmer that sweeps diagonally — keeps the
   "alive / more tips coming" feel. */
.osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    transparent 38%,
    rgba(247, 215, 129, 0.18) 50%,
    transparent 62%,
    transparent 100%
  );
  background-size: 240% 100%;
  background-position: 120% 0;
  animation: osaWelcomeShimmer 5.5s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes osaWelcomeBubbleGlow {
  0%, 100% {
    box-shadow:
      0 1px 0 rgba(247, 215, 129, 0.18) inset,
      0 8px 20px rgba(61, 6, 16, 0.32),
      0 0 0 1px rgba(247, 215, 129, 0.10);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(247, 215, 129, 0.28) inset,
      0 10px 26px rgba(61, 6, 16, 0.42),
      0 0 0 1px rgba(247, 215, 129, 0.22);
  }
}

@keyframes osaWelcomeShimmer {
  0%   { background-position: 120% 0; }
  60%  { background-position: -120% 0; }
  100% { background-position: -120% 0; }
}

/* Carousel inner — text that fades as tips rotate. Inherits the
   white color from the bubble so we don't have to re-declare it. */
.osa-welcome-carousel {
  display: block;
  position: relative;
}
.osa-welcome-text {
  margin: 0;
  min-height: 2.6em;
  transition: opacity 220ms ease;
  font-weight: 600;
  letter-spacing: 0.005em;
}
.osa-welcome-text.is-fading { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .osa-welcome-text { transition: none; }
  .osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble,
  .osa-ai-msg.osa-ai-msg--welcome .osa-ai-msg__bubble::before { animation: none; }
}

/* ── OSA Staff bubble: dynamic green pulsing UI removed per request.
   Staff messages now render with the same neutral assistant bubble as
   the AI; the "OSA Staff" meta label is the only differentiator. */

/* ── Auto-linked URLs in chat replies ─────────────────────────────
   Applied by the widget's renderAssistantText linkify pass so that
   the Student Manual / Scholarship Form URLs returned by the chat
   pipeline render as clickable links instead of raw text. */
.osa-ai-msg__bubble .osa-ai-link,
.osa-launcher-panel--chat-ui .osa-ai-msg__bubble .osa-ai-link {
    color: #6b0f1f;
    text-decoration: underline;
    text-decoration-color: rgba(107, 15, 31, 0.45);
    text-underline-offset: 2px;
    font-weight: 600;
    word-break: break-word;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.osa-ai-msg__bubble .osa-ai-link:hover,
.osa-launcher-panel--chat-ui .osa-ai-msg__bubble .osa-ai-link:hover {
    color: #4a0a15;
    text-decoration-color: #6b0f1f;
}
.osa-ai-msg__bubble .osa-ai-link:visited,
.osa-launcher-panel--chat-ui .osa-ai-msg__bubble .osa-ai-link:visited {
    color: #6b0f1f;
}

/* Welcome bubble link palette: same maroon-on-white as every other
   assistant bubble now that the welcome treatment was reverted. */
