.chat-box-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding: 0px 8px 8px 8px;
    box-sizing: border-box;
}
.chat-box {
    width: 80%;
    max-width: 750px;
    height: auto;
    border-radius: 28px;
    background-color: var(--input-bg);
    padding: 10px;
    transition: width 0.2s ease, max-width 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    container-type: inline-size;
    container-name: chat-files-layout;
}

body.chat-area-compact .chat-box {
    width: 100%;
    max-width: 100%;
}

@container chat-layout (max-width: 1000px) {     
    .chat-box {
        width: 100%;
        max-width: 100%;
    }
     }
.chat-box-top {
    padding: 0px 10px;
    position: relative;
}
.chat-box-top-input {
    margin-top: 6px;
    margin-bottom: 16px;
    color: var(--text-color);
    width: 100%;
    height: 1.5em;
    max-height: 8em;
    resize: none;
    overflow-y: hidden;
    font-size: 16px;
    line-height: 1.5;
    box-sizing: border-box;
    outline: none;
    transition: max-height 0.2s ease;
}

body.chat-composer-expanded .chat-box-area {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)) 18px;
    pointer-events: none;
}

body.chat-composer-expanded .chat-box-area::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--background) 0%, transparent) 0%,
            color-mix(in srgb, var(--background) 18%, transparent) 52%,
            color-mix(in srgb, var(--background) 82%, transparent) 100%
        );
    pointer-events: none;
}

body.chat-composer-expanded .chat-box,
body.chat-composer-expanded .chat-box-warning {
    pointer-events: auto;
}

body.chat-composer-expanded .chat-box {
    width: min(1040px, calc(100vw - 36px));
    max-width: min(1040px, calc(100vw - 36px));
    margin: 0 auto;
    border: 1px solid color-mix(in srgb, var(--border-color) 92%, transparent);
    box-shadow: 0 24px 72px rgba(0, 0, 0, 0.24);
    transform: translateY(0);
}

body.chat-composer-expanded .chat-box-top-input {
    max-height: min(65dvh, 34rem);
}

body.chat-composer-expanded .chat-box-bottom {
    height: auto;
    min-height: 48px;
    gap: 10px;
}

body.chat-composer-expanded .chat-box-warning {
    position: relative;
    width: min(1040px, calc(100vw - 36px));
    margin: 10px auto 0;
}

@media (max-width: 768px) {
    body.chat-composer-expanded .chat-box-area {
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px;
    }

    body.chat-composer-expanded .chat-box {
        width: 100%;
        max-width: 100%;
        border-radius: 24px;
    }

    body.chat-composer-expanded .chat-box-top-input {
        max-height: min(58dvh, 26rem);
    }

    body.chat-composer-expanded .chat-box-warning {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-box,
    .chat-box-top-input {
        transition: none;
    }
}

.chat-box-cancel-hint {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-bottom: 14px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--hover) 68%, transparent);
    color: var(--text-color-secondary);
    font-size: 12px;
    line-height: 1.35;
    letter-spacing: 0.01em;
}

.chat-box-cancel-hint[hidden] {
    display: none !important;
}

.chat-box-dictation-visualizer {
    margin-top: 8px;
    margin-bottom: 16px;
    min-height: 38px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
}

.chat-box-dictation-visualizer[hidden] {
    display: none !important;
}

.chat-box-dictation-status {
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-color-secondary);
    letter-spacing: 0.01em;
    user-select: none;
    -webkit-user-select: none;
}

.chat-box-dictation-bars {
    --dictation-bar-count: 84;
    display: grid;
    grid-template-columns: repeat(var(--dictation-bar-count), minmax(1px, 1fr));
    align-items: center;
    align-content: center;
    gap: clamp(1px, 0.18vw, 4px);
    width: 100%;
    min-height: 18px;
    height: 18px;
}

.chat-box-dictation-bar {
    --dictation-bar-level: 0.08;
    width: 100%;
    justify-self: stretch;
    align-self: center;
    min-height: 3px;
    height: calc(2px + (var(--dictation-bar-level) * 14px));
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-color-secondary) 68%, transparent);
    opacity: calc(0.44 + (var(--dictation-bar-level) * 0.52));
    transition: height 80ms linear, opacity 120ms ease;
    will-change: height, opacity;
}

.chat-box-top.dictation-recording .chat-box-dictation-status {
    color: color-mix(in srgb, #ef4444 66%, var(--text-color-secondary));
}

.chat-box-top.dictation-transcribing .chat-box-dictation-status {
    color: var(--text-color-secondary);
}

.chat-box-top.dictation-transcribing .chat-box-dictation-bar {
    transition-duration: 110ms;
}

@media (max-width: 768px) {
    .chat-box-cancel-hint {
        margin-bottom: 12px;
        padding: 7px 10px;
        font-size: 11px;
    }

    .chat-box-dictation-visualizer {
        margin-top: 6px;
        margin-bottom: 14px;
        min-height: 32px;
        gap: 6px;
    }

    .chat-box-dictation-status {
        font-size: 11px;
    }

    .chat-box-dictation-bars {
        min-height: 16px;
        height: 16px;
        gap: clamp(1px, 0.22vw, 3px);
    }

    .chat-box-dictation-bar {
        min-height: 2px;
        height: calc(2px + (var(--dictation-bar-level) * 12px));
    }
     }
.chat-box-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 48px;
}
.chat-box-bottom-div {
    display: flex;
    align-items: center;
}
.chat-box-dropdown {
    position: relative;
    z-index: 40;
}
.chat-box-dropdown .select-dropdown {
    top: auto;
    right: auto;
    bottom: 48px;
    left: 0;
    min-width: 220px;
    z-index: 40;
}

#chatBoxFilesDropdown {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom left;
    transition:
        opacity 0.18s ease,
        transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
        visibility 0s linear 0.18s;
    will-change: opacity, transform;
}

#chatBoxFilesDropdown.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 0.18s ease,
        transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
        visibility 0s linear 0s;
}

@media (prefers-reduced-motion: reduce) {
    #chatBoxFilesDropdown,
    #chatBoxFilesDropdown.open {
        transition: none;
        transform: none;
    }
}

/* ── Thinking Button – Premium Redesign ── */

/* Dropdown menu */
.chat-box-thinking-control .select-dropdown {
    min-width: 0;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 6px;
    border-radius: 14px;
    background: var(--background);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: thinking-dropdown-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
}

/* The trigger button – standalone pill design, NOT inheriting circle button */
.chat-box-quick-setting-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 180px;
    height: 34px;
    border-radius: 17px;
    padding: 0 13px;
    gap: 7px;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    transition: background-color 0.2s ease,
                border-color 0.25s ease,
                box-shadow 0.25s ease,
                transform 0.15s ease;
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-quick-setting-button:hover {
        background: var(--hover);
    }
}

.chat-box-quick-setting-button:active {
    transform: scale(0.97);
    box-shadow: none;
}

.chat-box-quick-setting-button[aria-expanded="true"] {
    background: var(--hover);
}

.chat-box-quick-setting-button:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Icon container with glow effect */
.chat-box-thinking-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    position: relative;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.chat-box-thinking-icon svg {
    width: 20px;
    height: 20px;
}
/* Label text */
.chat-box-thinking-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-color);
    transition: color 0.2s ease;
}

/* Caret with rotation animation */
.chat-box-thinking-caret {
    flex-shrink: 0;
    color: var(--text-color-secondary);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                color 0.2s ease;
    display: flex;
    align-items: center;
}

.chat-box-quick-setting-button[aria-expanded="true"] .chat-box-thinking-caret {
    transform: rotate(180deg);
    color: var(--text-color);
}

/* ── Dropdown option items ── */
.chat-box-thinking-option {
    justify-content: flex-start;
    gap: 12px;
    border-radius: 10px;
    padding: 8px 12px;
    transition: background-color 0.15s ease;
    font-size: 14px;
    font-weight: 450;
    color: var(--text-color);
    position: relative;
}

.chat-box-thinking-option-label {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-thinking-option:hover {
        background: var(--hover);
    }
}

.chat-box-thinking-option.is-active {
    background: var(--hover);
    font-weight: 550;
}

/* Check icon and spacer inside options */
.chat-box-thinking-option-spacer {
    margin-left: auto;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: inline-flex;
}

.chat-box-thinking-option svg {
    margin-left: auto;
    width: 18px;
    height: 18px;
    color: var(--text-color);
    flex-shrink: 0;
    display: inline-flex;
}

/* ── Quick-pick sub-dropdown (desktop only) ── */
.chatbox-files-quickpick {
    --select-submenu-closed-transform: translateX(-6px) scale(0.98);
    --select-submenu-open-transform: translateX(0) scale(1);
    --select-submenu-transform-origin: bottom left;
    display: flex;
    position: absolute;
    bottom: 0;
    left: calc(100% - 2px);
    right: auto;
    top: auto;
    width: 300px;
    max-height: 380px;
    max-height: min(380px, calc(100vh - 16px));
    max-height: min(380px, calc(100dvh - 16px));
    flex-direction: column;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 4px 16px var(--shadow-color);
    z-index: 41;
    overflow: hidden;
}

.chatbox-files-connections-submenu {
    --select-submenu-closed-transform: translateX(-6px) scale(0.98);
    --select-submenu-open-transform: translateX(0) scale(1);
    --select-submenu-transform-origin: bottom left;
    position: absolute;
    top: auto;
    bottom: 0;
    left: calc(100% - 2px);
    right: auto;
    min-width: 240px;
    z-index: 41;
    max-height: min(320px, calc(100vh - 16px));
    max-height: min(320px, calc(100dvh - 16px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.chatbox-files-quickpick__header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chatbox-files-quickpick__search {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-color);
    background: var(--input-bg, var(--background-secondary));
    outline: none;
}

.chatbox-files-quickpick__search:focus {
    border-color: var(--primary-color);
}

.chatbox-files-quickpick__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: none;
}

.chatbox-files-quickpick__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.3;
    transition: background 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .chatbox-files-quickpick__item:hover {
        background: var(--hover);
    }
}

.chatbox-files-quickpick__item.is-selected {
    background: rgba(59, 130, 246, 0.10);
}

.chatbox-files-quickpick__item-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbox-files-quickpick__item-icon img {
    width: 20px;
    height: 20px;
}

.chatbox-files-quickpick__item-check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-left: auto;
    color: var(--primary-color);
    display: none;
}

.chatbox-files-quickpick__item.is-selected .chatbox-files-quickpick__item-check {
    display: block;
}

.chatbox-files-quickpick__item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbox-files-quickpick__item--action {
    color: var(--text-color-secondary);
}

@media (hover: hover) and (pointer: fine) {
    .chatbox-files-quickpick__item--action:hover {
        color: var(--text-color);
    }
}

.chatbox-files-quickpick__item-action-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: var(--text-color-secondary);
}

.chatbox-files-quickpick__empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 13px;
}

/* Trigger button: push arrow to the right */
.chatbox-files-quickpick-trigger {
    justify-content: flex-start;
}

.chatbox-files-quickpick-arrow {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--text-color-secondary);
}

#chatBoxFilesDropdown .chatbox-files-menu-icon,
.js-chat-files-menu .chatbox-files-menu-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-color-secondary);
}

#chatBoxFilesDropdown .chatbox-files-menu-icon svg,
.js-chat-files-menu .chatbox-files-menu-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Hide arrow on mobile since the quickpick is not available */
@media (max-width: 768px) {
    .chatbox-files-quickpick-arrow {
        display: none;
    }
     }

/* Bridge the gap between the menu item and the quickpick (opens to the right) */
.js-quickpick-menu.has-submenu::after {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .js-quickpick-menu.has-submenu.open > .chatbox-files-quickpick {
        pointer-events: auto;
    }
}

/* On mobile, hide the quickpick submenu entirely */
@media (max-width: 768px) {
    .chatbox-files-connections-submenu {
        position: static;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        margin-top: 6px;
        width: 100%;
        min-width: 0;
        border-radius: 10px;
    }

    .chatbox-files-quickpick {
        display: none !important;
    }
     }

/* ── Mobile files bottom sheet ── */
.files-bs-backdrop {
    z-index: 10000;
}

.files-bs {
    display: none;
}

@media (max-width: 768px) {
    .files-bs {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-height: 85vh;
        max-height: 85dvh;
        background: var(--background);
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
        z-index: 10001;
        transform: translateY(100%);
        opacity: 0;
        visibility: hidden;
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                    opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1),
                    visibility 0.35s;
        will-change: transform, opacity;
        overflow: hidden;
    }

    .files-bs.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .files-bs.dragging {
        transition: none;
    }

    .files-bs__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 16px 12px;
        border-bottom: 1px solid var(--border-color);
        background: var(--background);
        flex-shrink: 0;
        gap: 12px;
        min-height: 44px;
    }

    .files-bs__title {
        flex: 1;
        min-width: 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--text-color);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
    }

    .files-bs__close {
        width: 44px;
        height: 44px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-color);
        cursor: pointer;
        transition: background 0.15s ease;
        flex-shrink: 0;
    }

@media (hover: hover) and (pointer: fine) {
    .files-bs__close:hover {
        background: var(--hover);
    }
}

    .files-bs__close svg {
        width: 22px;
        height: 22px;
    }

    .files-bs__search {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    .files-bs__search-input {
        width: 100%;
        height: 44px;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 0 14px;
        font-size: 16px;
        color: var(--text-color);
        background: var(--input-bg, var(--background-secondary));
        box-sizing: border-box;
    }

    .files-bs__search-input:focus {
        outline: none;
        border-color: var(--primary-color);
    }

    .files-bs__list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 8px 12px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .files-bs__item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 10px;
        border-radius: 10px;
        cursor: pointer;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        color: var(--text-color);
        font-size: 15px;
        line-height: 1.3;
        -webkit-tap-highlight-color: transparent;
    }

    .files-bs__item:active {
        background: var(--hover);
    }

    .files-bs__item.is-selected {
        background: rgba(59, 130, 246, 0.10);
    }

    .files-bs__item-icon {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .files-bs__item-icon img {
        width: 26px;
        height: 26px;
    }

    .files-bs__item-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .files-bs__item-check {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        color: var(--primary-color);
        display: none;
    }

    .files-bs__item.is-selected .files-bs__item-check {
        display: block;
    }

    .files-bs__empty {
        padding: 32px 16px;
        text-align: center;
        color: var(--text-color-secondary);
        font-size: 15px;
    }
     }
.chat-box-button {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    border-radius: 50%;
    color: var(--text-color);
    margin-left: 6px;
}
.chat-box-button.left {
    margin-right: 6px;
    margin-left: 0px;
}
.chat-box-quick-setting-button {
    margin-right: 8px;
    margin-left: 0;
}
.chat-box-button.call, .chat-box-button.send {
    background-color: var(--background);
}
.chat-box-button.chat-box-stop-button {
    background-color: color-mix(in srgb, var(--error-color) 12%, var(--background));
    color: var(--error-color);
}
.chat-box-button.chat-box-stop-button[hidden] {
    display: none;
}
.chat-box-button.chat-box-stop-button[data-mode="stopping"] {
    cursor: progress;
    pointer-events: none;
    opacity: 0.82;
}
.chat-box-button.call.is-active-call {
    background-color: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}
.chat-box-button.call.is-connecting-call {
    animation: realtime-call-pulse 1.2s ease-in-out infinite;
}
.chat-box-button.call-mute {
    background-color: var(--background);
}
.chat-box-button.call-mute.is-active {
    background-color: rgba(239, 68, 68, 0.14);
    color: #ef4444;
}
.chat-box-button.send.is-uploading {
    cursor: progress;
    pointer-events: none;
}
.chat-box-button.send.is-canceling {
    cursor: progress;
    pointer-events: none;
    opacity: 0.82;
}
.chat-box-button.send[data-mode="queue"] {
    background-color: color-mix(in srgb, var(--primary-color) 14%, var(--background));
    color: var(--primary-color);
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-button.send[data-mode="queue"]:hover {
        background-color: color-mix(in srgb, var(--primary-color) 20%, var(--background));
    }
}
.chat-box-button.send[data-mode="queue"]:focus-visible {
    background-color: color-mix(in srgb, var(--primary-color) 20%, var(--background));
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 26%, transparent);
}
.chat-queue-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    margin-left: 8px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 80%, transparent);
    background: color-mix(in srgb, var(--background, #fff) 92%, transparent);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

/* Keep the queue chip fully hidden until there is at least one queued message. */
.chat-queue-chip[hidden] {
    display: none;
}

.chat-queue-chip.is-paused {
    border-color: color-mix(in srgb, var(--warning-color, #f59e0b) 45%, var(--border-color, #e2e8f0));
    background: color-mix(in srgb, var(--warning-color, #f59e0b) 8%, var(--background, #fff));
}

.chat-queue-chip.is-open {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.chat-queue-chip__toggle,
.chat-queue-chip__action {
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
}

.chat-queue-chip__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0 10px;
    height: 30px;
    border-radius: 999px;
    color: var(--text-color);
}

.chat-queue-chip__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.chat-queue-chip__icon svg {
    width: 16px;
    height: 16px;
}

.chat-queue-chip__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color-secondary);
    white-space: nowrap;
}

.chat-queue-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--primary-color, #3b82f6);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.chat-queue-chip__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: var(--text-color-secondary);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.chat-queue-chip__action svg {
    width: 16px;
    height: 16px;
}

.chat-queue-chip__action.is-active {
    color: var(--warning-color, #f59e0b);
}

@media (hover: hover) and (pointer: fine) {
    .chat-queue-chip__toggle:hover,
    .chat-queue-chip__action:hover:not(:disabled) {
        background: color-mix(in srgb, var(--primary-color, #3b82f6) 10%, transparent);
        color: var(--text-color);
        transform: translateY(-1px);
    }

    .chat-queue-chip__action--clear:hover:not(:disabled) {
        background: color-mix(in srgb, var(--error-color, #ef4444) 12%, transparent);
        color: var(--error-color, #ef4444);
    }
}

.chat-queue-chip__toggle:focus-visible,
.chat-queue-chip__action:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.chat-queue-chip__action:disabled,
.chat-queue-chip__toggle:disabled {
    cursor: default;
    opacity: 0.45;
    transform: none;
}

@media (max-width: 640px) {
    .chat-queue-chip {
        margin-left: 6px;
        padding: 3px;
    }

    .chat-queue-chip__toggle {
        padding: 0 8px;
        gap: 6px;
    }

    .chat-queue-chip__label {
        display: none;
    }

    .chat-queue-chip__action,
    .chat-queue-chip__toggle {
        height: 28px;
    }

    .chat-queue-chip__action {
        width: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-queue-chip,
    .chat-queue-chip__toggle,
    .chat-queue-chip__action {
        transition: none;
    }
}
.chat-box-button.chat-box-stop-button:focus-visible {
    background-color: color-mix(in srgb, var(--error-color) 18%, var(--background));
    outline: 2px solid var(--error-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--error-color) 24%, transparent);
}
.chat-box-button.chat-box-stop-button:disabled,
.chat-box-button.chat-box-stop-button[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}
.chat-box-button.chat-box-stop-button[data-mode="stopping"]:disabled,
.chat-box-button.chat-box-stop-button[data-mode="stopping"][aria-disabled="true"] {
    opacity: 0.82;
}
.chat-box-button.send:disabled,
.chat-box-button.send[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}
.chat-box-button.send.is-canceling:disabled,
.chat-box-button.send.is-canceling[aria-disabled="true"] {
    opacity: 0.82;
}
.chat-send-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.6);
    border-top-color: var(--primary-color);
    animation: spin 0.9s linear infinite;
}
.chat-send-spinner--canceling {
    border-color: color-mix(in srgb, currentColor 16%, transparent);
    border-top-color: currentColor;
    border-right-color: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-button.chat-box-stop-button:not(:disabled):hover {
        background-color: color-mix(in srgb, var(--error-color) 18%, var(--background));
    }

    .chat-box-button:hover {
        background-color: var(--hover);
    }
}
/* -------------------
   Temporary Chat Mode
   ------------------- */
.chat-container .chat-box {
    border: 1.5px solid transparent;
    box-sizing: border-box;
    transition: border-color 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease;
}

.chat-container[data-temp-chat="true"] .chat-box {
    border-color: var(--text-color);
}

.chat-container .chat-container-welcome {
    flex-direction: column;
}

.temp-chat-subtitle-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.chat-container[data-temp-chat="true"] .temp-chat-subtitle-wrapper {
    grid-template-rows: 1fr;
}

.temp-chat-subtitle {
    overflow: hidden;
    font-size: 13px;
    color: var(--text-color-secondary);
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: normal;
    padding-top: 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), padding-top 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.chat-container[data-temp-chat="true"] .temp-chat-subtitle {
    opacity: 1;
    transform: translateY(0);
    padding-top: 8px;
}

.chat-box-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0px;
    font-size: 12px;
    color: var(--text-color-secondary);
}

.chat-files-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.chat-files-modal-overlay.open {
    display: flex;
    opacity: 1;
}

.chat-files-modal {
    width: min(640px, 100%);
    max-width: 640px;
    background: var(--background);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: min(80vh, 680px);
    overflow: hidden;
}

.chat-files-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
}

.chat-files-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-files-modal__close {
    border: none;
    background: none;
    color: var(--text-color-secondary);
    padding: 8px;
    border-radius: 999px;
    transition: background 0.2s ease;
    transition: background 0.2s ease;
    height: 36px;
    width: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (hover: hover) and (pointer: fine) {
    .chat-files-modal__close:hover {
        background: var(--hover);
    }
}

.chat-files-modal__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px 24px;
    overflow-y: auto;
}

.chat-files-modal__filters {
    display: flex;
    gap: 12px;
}

.chat-files-modal__sort,
.chat-files-modal__folder-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.chat-files-modal__sort label,
.chat-files-modal__folder-filter label {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
}

.chat-files-modal__sort select,
.chat-files-modal__folder-filter select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text-color);
    background: var(--input-bg, var(--background-secondary));
    appearance: none;
}

.chat-files-modal__search input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text-color);
    background: var(--input-bg, var(--background-secondary));
}

.chat-files-modal__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-files-modal__item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: var(--background-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .chat-files-modal__item:hover {
        border-color: var(--border-color);
    }
}

.chat-files-modal__item.is-selected {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.08);
}

.chat-files-modal__item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--background, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-files-modal__item-icon img {
    width: 28px;
    height: 28px;
}

.chat-files-modal__item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-files-modal__item-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
    word-break: break-word;
}

.chat-files-modal__item-meta {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
}

.chat-files-modal__empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 0.95rem;
}

.chat-files-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--background);
}

.chat-drive-modal {
    width: min(760px, 100%);
    max-width: 760px;
}

.chat-drive-modal__heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.chat-drive-modal__subtitle {
    margin: 0;
    color: var(--text-color-secondary);
    font-size: 0.95rem;
    line-height: 1.45;
}

.chat-drive-modal__body {
    gap: 14px;
}

.chat-drive-modal__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-drive-modal__search {
    flex: 1;
    min-width: 0;
}

.chat-drive-modal__refresh {
    padding: 10px 16px;
    font-size: 0.92rem;
}

.chat-drive-modal__status {
    min-height: 22px;
    font-size: 0.92rem;
    color: var(--text-color-secondary);
}

.chat-drive-modal__status.is-error {
    color: var(--error-color);
}

.chat-drive-modal__status.is-connected {
    color: var(--success-color);
}

.chat-drive-modal__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-drive-modal__item {
    display: grid;
    grid-template-columns: auto 40px 1fr auto;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
    background:
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.08), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.015), rgba(15, 23, 42, 0));
    background-color: var(--background-secondary);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .chat-drive-modal__item:hover {
        border-color: rgba(59, 130, 246, 0.24);
        transform: translateY(-1px);
    }
}

.chat-drive-modal__item.is-selected {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.08);
}

.chat-drive-modal__checkbox {
    margin-top: 4px;
}

.chat-drive-modal__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.chat-drive-modal__icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.chat-drive-modal__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-drive-modal__name {
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-word;
}

.chat-drive-modal__meta,
.chat-drive-modal__submeta {
    font-size: 0.84rem;
    color: var(--text-color-secondary);
    line-height: 1.45;
}

.chat-drive-modal__open {
    color: var(--primary-color);
    font-size: 0.84rem;
    text-decoration: none;
    align-self: center;
    white-space: nowrap;
}

.chat-drive-modal__empty {
    padding: 44px 20px;
    text-align: center;
    border-radius: 16px;
    border: 1px dashed var(--border-color);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.04), rgba(59, 130, 246, 0.01));
    color: var(--text-color-secondary);
    font-size: 0.95rem;
}

.chat-drive-modal__footer {
    flex-wrap: wrap;
}

.microsoft-picker-modal {
    max-width: 860px;
}

.microsoft-picker-body {
    gap: 14px;
}

.microsoft-picker-provider-tabs {
    display: flex;
    gap: 10px;
}

.microsoft-picker-provider-tab {
    border: 1px solid var(--border-color);
    background: var(--background-secondary);
    color: var(--text-color-secondary);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.microsoft-picker-provider-tab.active {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
    color: var(--primary-color);
}

.microsoft-picker-toolbar {
    align-items: stretch;
}

.microsoft-picker-back {
    white-space: nowrap;
}

.microsoft-picker-selectors {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.microsoft-picker-selectors.is-visible {
    display: grid;
}

.microsoft-picker-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--text-color-secondary);
}

.microsoft-picker-selector select {
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--background-secondary);
    color: var(--text-color);
}

.microsoft-picker-breadcrumb {
    font-size: 0.84rem;
    color: var(--text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.microsoft-picker-row {
    width: 100%;
}

.microsoft-picker-row__spacer {
    width: 18px;
    height: 18px;
    margin-top: 4px;
}

.microsoft-picker-symbol {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.16), rgba(59, 130, 246, 0.08));
    color: #0f4c81;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.microsoft-picker-symbol.is-folder {
    color: #9a3412;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.16), rgba(234, 88, 12, 0.08));
}

.microsoft-picker-open {
    border: none;
    background: transparent;
    cursor: pointer;
}

/* ============================================================================
 * Meeting Modal — minimal, modern, mobile-first redesign.
 * Uses CSS variables from init.css so it adapts to every theme.
 * ========================================================================= */

.chat-meeting-modal {
    width: min(560px, 100%);
    max-width: 560px;
    max-height: min(90vh, 760px);
    overflow: hidden;
    /* Play the shared modal entry animation when the modal becomes visible,
       matching the opening animation used across the other modals. The
       animation runs each time the overlay switches to display: flex.
       Reduced-animation preferences are handled globally in init.css. */
    animation: modalScaleIn 0.2s ease;
}

/* Soft gradient wash behind the header to give the modal a premium feel. */
.chat-meeting-modal__header {
    align-items: flex-start;
    gap: 14px;
    padding: 24px 24px 18px;
    border-bottom: none;
    position: relative;
}

/* Gradient icon badge anchoring the modal identity. */
.chat-meeting-modal__badge {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color, var(--primary-color)));
    box-shadow: 0 6px 16px -6px var(--shadow-color, rgba(0, 0, 0, 0.25)),
                inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-meeting-modal__heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.chat-meeting-modal__heading .chat-files-modal__title {
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.chat-meeting-modal__subtitle {
    margin: 0;
    color: var(--text-color-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.chat-meeting-modal__body {
    gap: 16px;
    padding: 4px 24px 20px;
}

.chat-meeting-source-panel[hidden],
.chat-meeting-selection[hidden],
.chat-meeting-progress[hidden],
.chat-meeting-governance[hidden] {
    display: none !important;
}

/* ---------- Source picker (segmented tabs) ---------- */

.chat-meeting-modal__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    background: var(--input-bg, var(--background-secondary));
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.chat-meeting-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text-color-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.chat-meeting-tab__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex-shrink: 0;
}

.chat-meeting-tab__label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meeting-tab:focus-visible {
    outline: none;
    border-color: var(--primary-color);
    color: var(--text-color);
}

@media (hover: hover) and (pointer: fine) {
    .chat-meeting-tab:hover:not(:disabled):not(.is-active) {
        color: var(--text-color);
        background: var(--hover);
    }
}

.chat-meeting-tab.is-active {
    background: var(--background);
    color: var(--primary-color);
    border-color: var(--border-color);
    font-weight: 600;
    box-shadow: 0 2px 6px -2px var(--shadow-color, rgba(15, 23, 42, 0.12));
}

.chat-meeting-tab.is-active .chat-meeting-tab__icon {
    color: var(--primary-color);
}

.chat-meeting-tab.is-disabled,
.chat-meeting-tab:disabled {
    color: var(--text-color-tertiary);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ---------- Source panels ---------- */

.chat-meeting-source-panel {
    display: none;
}

.chat-meeting-source-panel.is-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- Upload dropzone ---------- */

.chat-meeting-dropzone {
    width: 100%;
    border: 1.5px dashed var(--border-color);
    border-radius: 16px;
    padding: 34px 24px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-meeting-dropzone:focus-visible {
    outline: none;
    border-color: var(--primary-color);
    border-style: solid;
    box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-meeting-dropzone.is-dragover {
    border-color: var(--primary-color);
    border-style: solid;
    background: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-meeting-dropzone.is-dragover .chat-meeting-dropzone__icon {
    transform: translateY(-3px) scale(1.06);
}

@media (hover: hover) and (pointer: fine) {
    .chat-meeting-dropzone:hover:not(:disabled) {
        border-color: var(--primary-color);
    }
}

.chat-meeting-dropzone:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-meeting-dropzone__icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 4px;
    box-shadow: 0 8px 18px -8px var(--shadow-color, rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
    background: var(--primary-color)
}

@media (prefers-reduced-motion: reduce) {
    .chat-meeting-dropzone,
    .chat-meeting-dropzone__icon,
    .chat-meeting-dropzone:hover:not(:disabled),
    .chat-meeting-dropzone.is-dragover .chat-meeting-dropzone__icon {
        transform: none;
    }
}

.chat-meeting-dropzone__title {
    font-size: 1rem;
    font-weight: 650;
    color: var(--text-color);
}

.chat-meeting-dropzone__copy,
.chat-meeting-dropzone__hint {
    color: var(--text-color-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.chat-meeting-dropzone__hint {
    font-size: 0.8rem;
    color: var(--text-color-tertiary);
}

/* ---------- Recorder ---------- */

.chat-meeting-recorder {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-meeting-recorder__indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg, var(--background-secondary));
    color: var(--text-color-secondary);
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.chat-meeting-recorder__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
}

.chat-meeting-recorder.is-recording {
    border-color: rgba(239, 68, 68, 0.4);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(239, 68, 68, 0.1) 0%, transparent 55%),
        var(--background);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.chat-meeting-recorder.is-recording .chat-meeting-recorder__indicator {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.chat-meeting-recorder.is-recording .chat-meeting-recorder__dot {
    animation: chat-meeting-pulse 1.4s ease-in-out infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .chat-meeting-recorder.is-recording .chat-meeting-recorder__dot {
        animation: none;
    }
}

.chat-meeting-recorder__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chat-meeting-recorder__eyebrow {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-color-tertiary);
    font-weight: 600;
}

.chat-meeting-recorder__status {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-meeting-recorder__details {
    font-size: 0.825rem;
    line-height: 1.45;
    color: var(--text-color-secondary);
}

.chat-meeting-recorder__timer {
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--input-bg, var(--background-secondary));
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.chat-meeting-recorder.is-recording .chat-meeting-recorder__timer {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.chat-meeting-recorder__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/*
 * `.nav-btn` establishes a flex display, which otherwise overrides the
 * browser's default `[hidden]` display rule. The discard control is hidden
 * until there is recording media to discard, so enforce that state here.
 */
.chat-meeting-recorder__actions .nav-btn[hidden] {
    display: none !important;
}

/* ---------- Selected file ---------- */

.chat-meeting-selection {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.chat-meeting-selection__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color, var(--primary-color)));
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 14px -8px var(--shadow-color, rgba(0, 0, 0, 0.3));
}

.chat-meeting-selection__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.chat-meeting-selection__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-word;
    line-height: 1.35;
}

.chat-meeting-selection__details {
    font-size: 0.8rem;
    color: var(--text-color-secondary);
}

.chat-meeting-selection__remove {
    border: none;
    background: transparent;
    color: var(--text-color-secondary);
    padding: 6px;
    border-radius: 8px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.chat-meeting-selection__remove:focus-visible {
    outline: none;
    background: var(--hover);
    color: var(--text-color);
}

@media (hover: hover) and (pointer: fine) {
    .chat-meeting-selection__remove:hover {
        background: var(--hover);
        color: var(--text-color);
    }
}

/* ---------- Progress ---------- */

.chat-meeting-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--background);
}

.chat-meeting-progress__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.chat-meeting-progress__meta strong {
    color: var(--text-color);
    font-weight: 600;
}

.chat-meeting-progress__meta span {
    color: var(--text-color-secondary);
    font-variant-numeric: tabular-nums;
}

.chat-meeting-progress__bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--input-bg, var(--background-secondary));
    overflow: hidden;
}

.chat-meeting-progress__fill {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color, var(--primary-color)));
    transition: width 0.25s ease;
}

/* ---------- Governance ---------- */

.chat-meeting-governance {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 16px 16px 18px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color);
}

.chat-meeting-governance__header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-meeting-governance__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-meeting-governance__copy,
.chat-meeting-governance__hint {
    color: var(--text-color-secondary);
    font-size: 0.825rem;
    line-height: 1.5;
    margin: 0;
}

.chat-meeting-governance__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-color);
    line-height: 1.45;
    font-size: 0.875rem;
    cursor: pointer;
}

.chat-meeting-governance__checkbox input {
    margin: 2px 0 0;
    accent-color: var(--primary-color);
    flex-shrink: 0;
    cursor: pointer;
}

.chat-meeting-governance__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.chat-meeting-governance__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.chat-meeting-governance__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color-secondary);
}

.chat-meeting-governance__control {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg, var(--background-secondary));
    color: var(--text-color);
    padding: 9px 12px;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.chat-meeting-governance__textarea {
    min-height: 84px;
    resize: vertical;
}

/* Legal-basis custom-select: allow it to shrink inside the governance grid
   (the shared widget defaults to a 160px min-width that would overflow on
   narrow screens) and keep its trigger height aligned with sibling inputs. */
.chat-meeting-governance__select {
    min-width: 0;
}

.chat-meeting-governance__select .admin-select-trigger {
    height: 38px;
}

@media (hover: hover) and (pointer: fine) {
    .chat-meeting-governance__control:hover {
        border-color: var(--text-color-tertiary);
    }
}

.chat-meeting-governance__control:focus-visible,
.chat-meeting-governance__control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--background);
}

/* ---------- Footnote ---------- */

.chat-meeting-modal__note {
    margin: 0;
    color: var(--text-color-tertiary);
    font-size: 0.8rem;
    line-height: 1.5;
    text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .chat-files-modal {
        width: 100%;
        border-radius: 16px;
    }
    .chat-files-modal__header,
    .chat-files-modal__body,
    .chat-files-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    .chat-drive-modal__toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .chat-drive-modal__item {
        grid-template-columns: auto 36px 1fr;
    }
    .chat-drive-modal__open {
        grid-column: 3;
        justify-self: flex-start;
        align-self: flex-start;
    }
    /* Meeting modal: bottom sheet on small screens. */
    .chat-files-modal-overlay:has(> #chatBoxMeetingModal) {
        padding: 0;
        align-items: flex-end;
    }
    .chat-meeting-modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
        border-bottom: none;
    }
    .chat-meeting-modal__header {
        padding: 18px 18px 10px;
    }
    .chat-meeting-modal__body {
        padding: 4px 18px 18px;
        gap: 14px;
    }
    .chat-meeting-modal ~ .chat-files-modal__footer,
    #chatBoxMeetingModal .chat-files-modal__footer {
        padding: 14px 18px 18px;
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }
    .chat-meeting-tab__label {
        font-size: 0.825rem;
    }
    .chat-meeting-recorder {
        flex-wrap: wrap;
    }
    .chat-meeting-recorder__timer {
        margin-left: auto;
    }
}

@media (max-width: 480px) {
    .chat-files-modal__footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .chat-files-modal__footer .nav-btn {
        width: 100%;
        justify-content: center;
    }
    .chat-meeting-modal__tabs {
        grid-template-columns: 1fr;
        gap: 2px;
    }
    .chat-meeting-tab {
        justify-content: flex-start;
        padding: 10px 12px;
    }
    .chat-meeting-recorder {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }
    .chat-meeting-recorder__timer {
        margin-left: 0;
        align-self: flex-start;
    }
    .chat-meeting-recorder__actions .nav-btn {
        flex: 1;
        min-width: 0;
    }
    .chat-meeting-governance__grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
 * Mention Menu — modal that appears when typing "@" in the chat input.
 * Two modes:
 *   - .mention-menu--categories  : shown when only "@" is typed; categories
 *                                  are collapsed cards that expand on click.
 *   - .mention-menu--filtered    : shown when a query follows "@"; all matches
 *                                  are shown grouped by category.
 * ========================================================================= */

.mention-menu {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    max-height: 360px;
    overflow: hidden;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 32px rgba(15, 23, 42, 0.12);
    z-index: 1000;
    display: none;
    flex-direction: column;
    margin-bottom: 8px;
    overscroll-behavior: contain;
}

.mention-menu.open {
    display: flex;
    animation: fadeSlideIn 0.18s ease-out;
}

[data-reduce-animations="true"] .mention-menu.open {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .mention-menu.open {
        animation: none;
    }
}

.mention-menu__body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 6px;
    scrollbar-gutter: stable;
}

.mention-menu--empty .mention-menu__body {
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.mention-menu__empty {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    text-align: center;
}

/* ---------- Categories mode ---------- */
.mention-menu__category {
    display: flex;
    flex-direction: column;
}

.mention-menu__category + .mention-menu__category {
    margin-top: 2px;
}

.mention-menu__category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-color);
    font-family: inherit;
    text-align: left;
    transition: background 0.15s ease;
}

.mention-menu__category-header.is-highlighted {
    background: var(--hover);
}

@media (hover: hover) and (pointer: fine) {
    .mention-menu__category-header:hover {
        background: var(--hover);
    }
}

.mention-menu__category-header:focus-visible {
    outline: 2px solid var(--primary-color, #2563eb);
    outline-offset: -2px;
}

.mention-menu__category-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.mention-menu__category-icon svg {
    width: 16px;
    height: 16px;
}

.mention-menu__category-label {
    flex: 1;
    min-width: 0;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-menu__category-count {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-color-secondary);
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-color, #333) 6%, transparent);
    min-width: 24px;
    text-align: center;
}

.mention-menu__category-chevron {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color-tertiary, #9b9a97);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.mention-menu__category-chevron svg {
    width: 14px;
    height: 14px;
}

.mention-menu__category-header.is-expanded .mention-menu__category-chevron {
    transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
    .mention-menu__category-chevron {
        transition: none;
    }
}

[data-reduce-animations="true"] .mention-menu__category-chevron {
    transition: none;
}

.mention-menu__category-items {
    display: flex;
    flex-direction: column;
    padding: 2px 0 4px 0;
    margin-left: 18px;
    border-left: 1px solid var(--border-color);
    padding-left: 8px;
    animation: fadeSlideIn 0.16s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .mention-menu__category-items {
        animation: none;
    }
}

[data-reduce-animations="true"] .mention-menu__category-items {
    animation: none;
}

/* ---------- Filtered mode ---------- */
.mention-menu__section {
    display: flex;
    flex-direction: column;
}

.mention-menu__section--with-divider {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

.mention-menu__section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.mention-menu__section-label-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mention-menu__section-label-count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text-color-tertiary, #9b9a97);
}

.mention-menu__list {
    display: flex;
    flex-direction: column;
}

/* ---------- Items (shared between modes) ---------- */
.mention-menu__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
}

.mention-menu__item.is-highlighted,
.mention-menu__item:focus-visible {
    background: var(--hover);
}

@media (hover: hover) and (pointer: fine) {
    .mention-menu__item:hover {
        background: var(--hover);
    }
}

.mention-menu__item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.mention-menu__item-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.mention-menu__item-icon svg {
    width: 15px;
    height: 15px;
}

.mention-menu__item-icon--bare {
    background: transparent !important;
    color: var(--text-color);
}

.mention-menu__item-icon--bare svg,
.mention-menu__item-icon--bare img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    border-radius: 5px;
}

.mention-menu__item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mention-menu__item-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.mention-menu__item-description {
    font-size: 0.78rem;
    color: var(--text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ---------- Selected chip icons in the input ---------- */
.inline-skill-element-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    background: var(--primary-color);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.inline-skill-element-icon svg {
    width: 22px;
    height: 22px;
}

/* Keep note descriptions to a single truncated line */
.inline-note-snippet {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-queue-overlay {
    display: none;
    flex-direction: column;
    background: color-mix(in srgb, var(--background-secondary, #f8fafc) 85%, black 0%);
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 80%, transparent);
    border-radius: 18px;
    margin-bottom: 12px;
    max-height: 220px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    position: relative;
    animation: fadeSlideIn 0.25s ease-out;
}

.message-queue-overlay.open {
    display: flex;
}

.message-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    gap: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 70%, transparent);
    background: color-mix(in srgb, var(--background, #fff) 94%, transparent);
}

.message-queue-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-queue-title-icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary-color, #3b82f6) 18%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #3b82f6);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary-color, #3b82f6) 25%, transparent);
}

.message-queue-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-color-secondary);
}

.message-queue-meta::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-color-secondary);
    opacity: 0.6;
}

.message-queue-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 140px;
}

.message-queue-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-queue-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    transition: background 0.2s ease, transform 0.2s ease;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 60%, transparent);
}

.message-queue-item:last-child {
    border-bottom: none;
}

@media (hover: hover) and (pointer: fine) {
    .message-queue-item:hover {
        background: color-mix(in srgb, var(--primary-color, #3b82f6) 6%, transparent);
    }
}

.message-queue-item:focus-within {
    background: color-mix(in srgb, var(--primary-color, #3b82f6) 8%, transparent);
}

.message-queue-item.dragging {
    opacity: 0.6;
    background: color-mix(in srgb, var(--primary-color, #3b82f6) 12%, transparent);
    transform: scale(0.98);
}

.message-queue-item.drop-target-before,
.message-queue-item.drop-target-after {
    position: relative;
}

.message-queue-item.drop-target-before::before,
.message-queue-item.drop-target-after::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    height: 2px;
    background: var(--primary-color, #3b82f6);
    box-shadow: 0 0 6px color-mix(in srgb, var(--primary-color, #3b82f6) 40%, transparent);
    border-radius: 999px;
}

.message-queue-item.drop-target-before::before {
    top: 4px;
}

.message-queue-item.drop-target-after::after {
    bottom: 4px;
}

.message-queue-item-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 2px 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
}

.message-queue-item-main:focus-visible {
    outline: 2px solid var(--primary-color, #3b82f6);
    outline-offset: 4px;
    border-radius: 12px;
}

.message-queue-item-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color, #3b82f6) 75%, white 20%), var(--primary-color, #3b82f6));
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.2);
    flex-shrink: 0;
}

.message-queue-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: var(--text-color);
}

.message-queue-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.message-queue-item-message {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-queue-item-message--placeholder {
    color: var(--text-color-secondary);
    font-style: italic;
}

.message-queue-item-timestamp {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-color-secondary);
}

.message-queue-item-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid color-mix(in srgb, var(--border-color, #e2e8f0) 70%, transparent);
    background: color-mix(in srgb, var(--background, #fff) 94%, transparent);
    border-radius: 10px;
    color: var(--text-color-secondary);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

@media (hover: hover) and (pointer: fine) {
    .message-queue-item-action:hover:not(:disabled) {
        background: color-mix(in srgb, var(--primary-color, #3b82f6) 10%, transparent);
        border-color: color-mix(in srgb, var(--primary-color, #3b82f6) 35%, var(--border-color, #e2e8f0));
        color: var(--primary-color, #3b82f6);
        transform: translateY(-1px);
    }

    .message-queue-item-delete:hover:not(:disabled) {
        background: rgba(239, 68, 68, 0.12);
        border-color: rgba(239, 68, 68, 0.25);
        color: #ef4444;
    }
}

.message-queue-item-action:focus-visible {
    outline: 2px solid var(--primary-color, #3b82f6);
    outline-offset: 2px;
}

.message-queue-item-action:disabled {
    cursor: default;
    opacity: 0.45;
    color: var(--text-color-secondary);
    transform: none;
}

.message-queue-item-action svg {
    width: 16px;
    height: 16px;
}

@media (max-width: 640px) {
    
    .message-queue-overlay {
        max-height: 180px;
    }

    .message-queue-item {
        padding: 10px 14px;
    }

    .message-queue-item-actions {
        gap: 6px;
    }

    .message-queue-item-action {
        width: 32px;
        height: 32px;
    }
}

.queue-count-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary-color, #3b82f6);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.2);
}

@media (prefers-color-scheme: dark) {
    .message-queue-overlay {
        background: color-mix(in srgb, var(--background-secondary, #0f172a) 88%, black 0%);
        border-color: color-mix(in srgb, var(--border-color, #1e293b) 70%, transparent);
        box-shadow: 0 15px 35px rgba(2, 6, 23, 0.6), 0 5px 15px rgba(2, 6, 23, 0.4);
    }

    .message-queue-header {
        background: color-mix(in srgb, var(--background, #0b1220) 85%, transparent);
    }

    .message-queue-item {
        border-color: color-mix(in srgb, var(--border-color, #1e293b) 60%, transparent);
    }

    .message-queue-item-action {
        background: color-mix(in srgb, var(--background, #0b1220) 90%, transparent);
    }
     }

/* -------------------
   Reference Parts Element
   ------------------- */
.inline-reference-element {
    background-color: var(--surface-secondary, var(--input-bg));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: background-color 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

@media (hover: hover) and (pointer: fine) {
    .inline-reference-element:hover {
        background-color: var(--hover, var(--surface-secondary));
        border-color: var(--border-color-hover, var(--border-color));
    }
}

.inline-reference-element-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--surface-tertiary, var(--background));
    border: 1px solid var(--border-color);
    color: var(--text-color);
    flex-shrink: 0;
}

.inline-reference-element-icon svg {
    width: 20px;
    height: 20px;
}

.inline-reference-element .inline-files-element-content-bottom span {
    color: var(--text-color-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.inline-chat-reference-element {
    background-color: color-mix(in srgb, var(--surface-secondary, var(--input-bg)) 92%, var(--primary-color, #3b82f6) 8%);
    border: 1px solid color-mix(in srgb, var(--border-color) 82%, var(--primary-color, #3b82f6) 18%);
}

@media (hover: hover) and (pointer: fine) {
    .inline-chat-reference-element:hover {
        background-color: color-mix(in srgb, var(--surface-secondary, var(--input-bg)) 84%, var(--primary-color, #3b82f6) 16%);
        border-color: color-mix(in srgb, var(--border-color) 70%, var(--primary-color, #3b82f6) 30%);
    }
}

/* -------------------
   Selection Tooltip
   ------------------- */
.selection-tooltip {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background-color: var(--background-color, #ffffff);
    border: 1px solid var(--border-color, #e9e9e7);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.92);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.2s;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.selection-tooltip::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 6px;
    background-color: var(--background-color, #ffffff);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.selection-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.selection-tooltip-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 34px;
    padding: 0 14px;
    border: none;
    border-radius: 9px;
    background-color: transparent;
    color: var(--text-color, #333333);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.2s ease, transform 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    white-space: nowrap;
    font-family: inherit;
}

@media (hover: hover) and (pointer: fine) {
    .selection-tooltip-btn:hover {
        background-color: #3f3f46;
        color: #ffffff;
    }
}

.selection-tooltip-btn:active {
    transform: scale(0.96);
}

.selection-tooltip-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.selection-tooltip-btn-icon svg {
    width: 16px;
    height: 16px;
}

.selection-tooltip-btn-label {
    white-space: nowrap;
}

/* Dark mode for selection tooltip */
[data-mode="dark"] .selection-tooltip {
  background-color: var(--background-color, #1F1F1F);
  border-color: var(--border-color, #2C2C2E);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.25);
}

[data-mode="dark"] .selection-tooltip::after {
  background-color: var(--background-color, #1F1F1F);
}

[data-mode="dark"] .selection-tooltip-btn {
  color: var(--text-color, #E8EAED);
}

@media (hover: hover) and (pointer: fine) {
    [data-mode="dark"] .selection-tooltip-btn:hover {
        background-color: color-mix(in srgb, var(--background-color, #1F1F1F) 74%, #ffffff 12%);
        color: var(--text-color, #E8EAED);
    }
}

[data-mode="dark"] .selection-tooltip-btn[data-action="add-reference"] {
  color: #a5b4fc;
}

@media (hover: hover) and (pointer: fine) {
    [data-mode="dark"] .selection-tooltip-btn[data-action="add-reference"]:hover {
        background-color: color-mix(in srgb, var(--primary-color, #4E89F9) 18%, transparent);
        color: #a5b4fc;
    }
}

/* -------------------
   Dictation / Voice Input States
   ------------------- */

/* Recording state - pulsing red indicator */
.chat-box-button.is-recording {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    animation: dictation-pulse 1.5s ease-in-out infinite;
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-button.is-recording:hover {
        background-color: rgba(239, 68, 68, 0.25);
    }
}

/* Transcribing state - loading spinner */
.chat-box-button.is-transcribing {
    position: relative;
    pointer-events: auto;
    cursor: pointer;
}

.chat-box-button.is-transcribing::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-top-color: var(--primary-color, #3b82f6);
    animation: spin 0.8s linear infinite;
}

.chat-box-button.is-transcribing svg {
    opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-button.is-transcribing:hover {
        background-color: rgba(239, 68, 68, 0.12);
    }
}

@media (hover: hover) and (pointer: fine) {
    .chat-box-button.is-transcribing:hover::after {
        border-top-color: #ef4444;
    }
}

/* =============================================
   Large Paste Modal
   ============================================= */

.large-paste-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.large-paste-modal-overlay.open {
    display: flex;
    opacity: 1;
}

.large-paste-modal {
    width: min(520px, 100%);
    background: var(--background);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.2s ease;
}

.large-paste-modal-overlay.open .large-paste-modal {
    transform: scale(1) translateY(0);
}

.large-paste-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}

.large-paste-modal__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.large-paste-modal__close {
    border: none;
    background: none;
    color: var(--text-color-secondary);
    padding: 6px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
    .large-paste-modal__close:hover {
        background: var(--hover);
    }
}

.large-paste-modal__body {
    padding: 0 24px 8px;
}

.large-paste-modal__info {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    line-height: 1.5;
    margin: 0;
}

.large-paste-modal__preview {
    margin-top: 12px;
    background: var(--hover, rgba(0,0,0,0.04));
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    max-height: 120px;
    overflow: hidden;
    position: relative;
}

.large-paste-modal__preview-text {
    font-family: var(--font-mono, "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace);
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text-color-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.large-paste-modal__preview::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--hover, rgba(245,245,245,1)));
    pointer-events: none;
    border-radius: 0 0 10px 10px;
}

.large-paste-modal__stats {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-color-secondary);
}

.large-paste-modal__stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.large-paste-modal__actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 20px;
}

.large-paste-modal__action {
    flex: 1;
    padding: 11px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.large-paste-modal__action--paste {
    background: var(--hover, rgba(0,0,0,0.04));
    color: var(--text-color);
}

@media (hover: hover) and (pointer: fine) {
    .large-paste-modal__action--paste:hover {
        background: var(--border-color);
    }
}

.large-paste-modal__action--file {
    background: var(--accent, #2563eb);
    color: #fff;
    border-color: var(--accent, #2563eb);
}

@media (hover: hover) and (pointer: fine) {
    .large-paste-modal__action--file:hover {
        opacity: 0.9;
        box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    }
}

.large-paste-modal__action svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Disabled input during transcription */
.chat-box-top-input.is-transcribing {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Stop icon for recording state */
.dictation-stop-icon {
    width: 12px;
    height: 12px;
    background-color: currentColor;
    border-radius: 2px;
}

@media (max-width: 768px) {
  .microsoft-picker-selectors {
    grid-template-columns: 1fr;
}

  .microsoft-picker-toolbar {
    flex-wrap: wrap;
}
     }
