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

/* The /next8 palette, kept here so the chat looks the same on every page. */
.collabit-bot {
    --bot-ink: #041b18;
    --bot-deep: #0b4a43;
    --bot-green: #007b67;
    --bot-green-dark: #00614f;
    --bot-mint: #8fe0c6;
    --bot-mint-2: #e3f8ef;
    --bot-paper: #f3f8f6;
    --bot-text: #0f2a3f;
    --bot-muted: #51665f;
    --bot-line: #d6e5df;
    --bot-danger: #b3401f;
    --bot-head: 'Poppins', 'Poppins Fallback', system-ui, sans-serif;
    --bot-body: 'Work Sans', 'Work Sans Fallback', system-ui, sans-serif;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    display: flex;
    justify-content: flex-end;
    font-family: var(--bot-body);
    color: var(--bot-text);
}

.collabit-bot :focus-visible {
    outline: 3px solid var(--bot-mint);
    outline-offset: 2px;
}

/* Launcher */

.collabit-bot__launcher {
    width: 60px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--bot-deep) 0%, var(--bot-green) 100%);
    color: #fff;
    padding: 0;
    box-shadow: 0 16px 36px rgba(4, 27, 24, 0.28), 0 2px 6px rgba(4, 27, 24, 0.18);
    cursor: pointer;
    position: relative;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.collabit-bot__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px rgba(4, 27, 24, 0.32), 0 3px 8px rgba(4, 27, 24, 0.2);
}

.collabit-bot__launcher-icon {
    display: inline-flex;
}

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

.collabit-bot__launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #ec6642;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.collabit-bot__launcher-badge[hidden] {
    display: none;
}

.collabit-bot.has-attention .collabit-bot__launcher {
    animation: collabit-bot-pop 800ms ease 3;
}

.collabit-bot.is-open .collabit-bot__launcher {
    display: none;
}

/* Panel */

.collabit-bot__panel {
    width: min(400px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 112px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(11, 74, 67, 0.14);
    border-radius: 20px;
    box-shadow: 0 28px 70px rgba(4, 27, 24, 0.26), 0 4px 14px rgba(4, 27, 24, 0.1);
    overflow: hidden;
    animation: collabit-bot-in 180ms ease-out;
}

.collabit-bot__panel[hidden] {
    display: none !important;
}

.collabit-bot__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 16px 18px;
    background: linear-gradient(150deg, var(--bot-ink) 0%, var(--bot-deep) 72%, #0d5a4f 100%);
    color: #fff;
}

.collabit-bot__avatar {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--bot-mint-2);
    color: var(--bot-green);
}

.collabit-bot__heading {
    flex: 1;
    min-width: 0;
}

.collabit-bot__header h2 {
    margin: 0;
    font-family: var(--bot-head);
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
    color: #fff;
}

.collabit-bot__subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.8);
}

.collabit-bot__subtitle::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--bot-mint);
    box-shadow: 0 0 0 3px rgba(143, 224, 198, 0.25);
    vertical-align: 1px;
}

.collabit-bot__env {
    flex: none;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff1cc;
    color: #5c4300;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.collabit-bot__close {
    flex: none;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: background 140ms ease;
}

.collabit-bot__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.collabit-bot__mode {
    padding: 10px 18px;
    border-bottom: 1px solid #bfeedd;
    background: var(--bot-mint-2);
    color: var(--bot-deep);
    font-size: 13px;
    line-height: 1.45;
    font-weight: 600;
}

/* Conversation */

.collabit-bot__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 16px 8px;
    background: var(--bot-paper);
}

.collabit-bot__intro {
    margin: 0 4px 14px;
    color: var(--bot-muted);
    font-size: 13px;
    line-height: 1.5;
}

.collabit-bot__messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.collabit-bot__message {
    max-width: 86%;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    animation: collabit-bot-rise 160ms ease-out;
}

.collabit-bot__message:first-child,
.collabit-bot__message.is-continued {
    margin-top: 0;
}

.collabit-bot__message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--bot-line);
    border-bottom-left-radius: 6px;
}

.collabit-bot__message--operator {
    align-self: flex-start;
    background: var(--bot-mint-2);
    border: 1px solid #bfeedd;
    border-bottom-left-radius: 6px;
}

.collabit-bot__message--user {
    align-self: flex-end;
    background: var(--bot-green);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.collabit-bot__message-meta {
    margin-bottom: 3px;
    font-size: 12px;
    font-weight: 700;
    color: var(--bot-deep);
    white-space: normal;
}

.collabit-bot__message-time {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--bot-muted);
    white-space: normal;
}

.collabit-bot__message--user .collabit-bot__message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.78);
}

.collabit-bot__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    white-space: normal;
}

.collabit-bot__links a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 11px;
    border: 1px solid #b9e3d3;
    border-radius: 999px;
    background: var(--bot-paper);
    color: var(--bot-green-dark);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 140ms ease;
}

.collabit-bot__links a::after {
    content: '→';
    font-weight: 400;
}

.collabit-bot__links a:hover {
    background: var(--bot-mint-2);
}

.collabit-bot__message.is-sending {
    opacity: 0.72;
}

.collabit-bot__message.is-failed {
    background: #fff;
    color: var(--bot-text);
    border: 1px solid rgba(179, 64, 31, 0.55);
}

.collabit-bot__message-status {
    margin-top: 4px;
    font-size: 11.5px;
    text-align: right;
    color: rgba(255, 255, 255, 0.85);
    white-space: normal;
}

.collabit-bot__message.is-failed .collabit-bot__message-status {
    color: var(--bot-danger);
    font-weight: 600;
}

.collabit-bot__retry {
    border: 0;
    background: none;
    padding: 0;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.collabit-bot__typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 5px;
    margin-top: 10px;
    padding: 14px 16px;
    border: 1px solid var(--bot-line);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    background: #fff;
}

.collabit-bot__messages > .collabit-bot__typing:first-child {
    margin-top: 0;
}

.collabit-bot__typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bot-green);
    animation: collabit-bot-typing 1.2s ease-in-out infinite;
}

.collabit-bot__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.collabit-bot__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

.collabit-bot__error {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 20px 16px;
    border: 1px dashed var(--bot-line);
    border-radius: 16px;
    background: #fff;
    text-align: center;
}

.collabit-bot__error p {
    margin: 0;
    color: var(--bot-muted);
    font-size: 14px;
}

.collabit-bot__error-retry {
    border: 1px solid var(--bot-green);
    border-radius: 999px;
    background: #fff;
    color: var(--bot-green-dark);
    padding: 8px 16px;
    font: 600 13px/1 var(--bot-body);
    cursor: pointer;
}

.collabit-bot__prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 0 6px;
}

.collabit-bot__prompts[hidden] {
    display: none;
}

.collabit-bot__prompt {
    border: 1px solid #b9e3d3;
    background: #fff;
    color: var(--bot-green-dark);
    border-radius: 999px;
    padding: 8px 13px;
    font: 600 13px/1.3 var(--bot-body);
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.collabit-bot__prompt:hover {
    background: var(--bot-mint-2);
    border-color: var(--bot-mint);
}

/* Composer */

.collabit-bot__form {
    border-top: 1px solid var(--bot-line);
    padding: 12px 14px 10px;
    background: #fff;
}

.collabit-bot__composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 5px 5px 5px 14px;
    border: 1px solid #c9dbd4;
    border-radius: 18px;
    background: #fff;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.collabit-bot__composer:focus-within {
    border-color: var(--bot-green);
    box-shadow: 0 0 0 3px rgba(0, 123, 103, 0.14);
}

.collabit-bot__form textarea {
    flex: 1;
    box-sizing: border-box;
    min-width: 0;
    min-height: 38px;
    max-height: 140px;
    margin: 0;
    padding: 8px 0;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--bot-text);
    font: 15px/1.45 var(--bot-body);
    box-shadow: none;
}

.collabit-bot__form textarea:focus-visible {
    outline: 0;
}

.collabit-bot__send {
    flex: none;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: var(--bot-green);
    color: #fff;
    padding: 0;
    cursor: pointer;
    transition: background 140ms ease, opacity 140ms ease, transform 140ms ease;
}

.collabit-bot__send:hover {
    background: var(--bot-deep);
}

.collabit-bot__form.is-empty .collabit-bot__send {
    opacity: 0.45;
}

.collabit-bot__send:disabled {
    opacity: 0.45;
    cursor: progress;
}

.collabit-bot__actions {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    min-height: 16px;
    margin-top: 6px;
    padding: 0 4px;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--bot-muted);
}

.collabit-bot__status:empty {
    display: none;
}

.collabit-bot.has-status .collabit-bot__hint {
    display: none;
}

.collabit-bot__count {
    margin-left: auto;
    white-space: nowrap;
}

.collabit-bot__count[hidden] {
    display: none;
}

@media (pointer: coarse) {
    .collabit-bot__hint {
        display: none;
    }
}

@keyframes collabit-bot-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes collabit-bot-rise {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes collabit-bot-typing {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes collabit-bot-pop {
    0%,
    100% {
        transform: scale(1);
    }
    35% {
        transform: scale(1.08);
    }
    65% {
        transform: scale(0.98);
    }
}

/* Phones: the open chat takes the whole screen. */
@media (max-width: 640px) {
    .collabit-bot {
        right: 16px;
        bottom: 16px;
    }

    body .collabit-bot.is-open {
        inset: 0;
        translate: none;
    }

    .collabit-bot.is-open .collabit-bot__panel {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: 0;
        border-radius: 0;
        animation: none;
    }

    .collabit-bot__header {
        padding-top: max(14px, env(safe-area-inset-top));
    }

    .collabit-bot__form {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    /* 16px stops iOS zooming into the box. */
    .collabit-bot__form textarea {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .collabit-bot,
    .collabit-bot * {
        animation: none !important;
        transition: none !important;
    }
}
