/* ===== AMBIENT SCOPE CHIP ===== */
/* Single-source chip styling so the floating, docked and fullscreen
   surfaces render the scope indicator consistently. The slot wrapper
   is a named hook so the docked rail layout can tighten the max
   width without reaching into ScopeChip itself. */
.chat-ambient-chip-slot {
    display: flex;
    justify-content: flex-start;
    padding: 0.25rem 0.5rem 0 0.5rem;
}

.ambient-scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    background: var(--rz-primary-lighter, rgba(95, 61, 196, 0.1));
    color: var(--rz-on-primary-lighter, var(--rz-primary));
    border-radius: 9999px;
    font-size: 0.8rem;
    line-height: 1.2;
    max-width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.ambient-scope-chip__icon {
    font-size: 0.95rem;
    opacity: 0.85;
}

.ambient-scope-chip__label {
    /* The docked rail is narrower than the floating popover, so the
       name can easily push the close button off-screen. Truncate in
       every mode — floating/fullscreen have plenty of width and a
       12rem cap is still comfortable there. */
    display: inline-block;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.ambient-scope-chip__entity {
    opacity: 0.7;
    font-size: 0.75rem;
}

.ambient-scope-chip__close {
    margin-left: 0.1rem;
}

/* ===== FULLSCREEN OVERLAY ===== */
.fullscreen-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--rz-base-background-color);
    z-index: 1100;
    display: flex;
}

.fullscreen-chat-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.chat-mobile-sidebar-backdrop {
    display: none;
}

/* ===== CONVERSATIONS SIDEBAR ===== */
.conversations-sidebar {
    width: 340px;
    border-right: 1px solid var(--rz-border-color);
    display: flex;
    flex-direction: column;
    background: var(--rz-base-100);
    transition: width 0.3s ease;
}

.conversations-sidebar.collapsed {
    width: 60px;
}

.sidebar-logo {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--rz-border-color);
}

.sidebar-logo img {
    max-height: 40px;
    max-width: 80%;
    object-fit: contain;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--rz-border-color);
    gap: 8px;
}

.new-chat-btn {
    flex: 1;
}

.conversations-sidebar.collapsed .new-chat-btn {
    display: none;
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sessions-loading,
.sessions-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0.6;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.session-item:hover {
    background: var(--rz-base-200);
}

.session-item.active {
    background: var(--rz-primary-lighter);
}

.session-info {
    flex: 1;
    overflow: hidden;
}

.session-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--rz-text-color);
}

.session-meta {
    font-size: 11px;
    color: var(--rz-text-disabled-color);
    margin-top: 2px;
}

/* Inline session name editing input */
.session-name-input {
    width: 100%;
    font-size: 13px;
    font-weight: 500;
    padding: 2px 6px;
    border: 1px solid var(--rz-primary);
    border-radius: 4px;
    background: var(--rz-base-background-color);
}

.session-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.session-item:hover .session-actions {
    opacity: 1;
}

/* Session menu button (3 dots) */
.session-menu-btn {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    min-width: 24px !important;
    color: var(--rz-primary) !important;
}

.session-menu-btn,
.session-menu-btn .rz-button,
.session-menu-btn .rz-splitbutton-menubutton {
    color: var(--rz-primary) !important;
    background: transparent !important;
}

.session-menu-btn:hover {
    background: transparent !important;
}

.session-menu-btn .rz-button-text {
    display: none;
}

/* ===== FULLSCREEN MAIN AREA ===== */
.fullscreen-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.fullscreen-header {
    padding: 14px 28px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--rz-base-background-color);
    backdrop-filter: saturate(1.1) blur(10px);
    -webkit-backdrop-filter: saturate(1.1) blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--rz-border-color) 60%, transparent);
}

.fullscreen-messages {
    flex: 1;
    padding: 32px 24px 24px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scroll-behavior: smooth;
    gap: 22px;                                    /* More breathing room between bubbles */
    scrollbar-gutter: stable;
}

/* Center the message column for readability while keeping the outer container wide
   enough for gallery and sidebars. ~820px matches Claude/ChatGPT reading width. */
.fullscreen-messages > * {
    max-width: 820px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure AI images can be large in fullscreen */
.fullscreen-messages .message-content {
    max-width: 100%;
}

.fullscreen-messages .message-text {
    max-width: 100%;
    font-size: 15px;
    line-height: 1.65;
}

/* Larger avatar in fullscreen, softer border */
.fullscreen-messages .message-avatar {
    width: 34px;
    height: 34px;
}

.fullscreen-messages .message-avatar .rz-icon {
    font-size: 18px;
}

/* Subtle divider between the message list and the input area */
.fullscreen-chat-main::after {
    content: "";
    display: block;
    height: 1px;
}

/* Fullscreen input box adjustments */
.fullscreen-input-box {
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 16px 24px 20px;
}

/* ===== GALLERY SIDEBAR ===== */
.gallery-sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--rz-base-background-color);
    border-left: 1px solid var(--rz-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rz-border-color);
}

.gallery-sidebar-header .rz-text {
    font-weight: 500;
}

/* ===== IMAGE EDITOR MODAL ===== */
.image-editor-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
}

.image-editor-modal {
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    max-height: 700px;
    background: var(--rz-base-background-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.chat-confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1.5rem;
}

.chat-confirm-modal {
    width: min(100%, 460px);
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.3);
    overflow: hidden;
}

.chat-confirm-modal-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rz-border-color);
    font-weight: 600;
}

.chat-confirm-modal-header .rzi {
    color: var(--rz-warning);
    font-size: 1.125rem;
}

.chat-confirm-modal-body {
    padding: 1.25rem;
    color: var(--rz-text-secondary-color);
    line-height: 1.5;
}

.chat-confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0 1.25rem 1.25rem;
}

/* ===== FLOATING CONTAINER ===== */
.floating-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 500px;
    height: 700px;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 12px;
    /* Layered shadow — softer and less flat than a single 32px blob.
       Ambient + key light pattern (Material 3 style). */
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 20px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.floating-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--rz-border-color);
    background: var(--rz-base-background-color);
}

.chat-reconnect-banner {
    margin: 0 16px 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--rz-info) 12%, var(--rz-base-background-color));
    border: 1px solid color-mix(in srgb, var(--rz-info) 28%, transparent);
    color: var(--rz-text-color);
    font-size: 13px;
}

/* Header buttons - transparent background, no hover background to avoid white circles */
.floating-chat-header .rz-button {
    background: transparent !important;
}

.floating-chat-header .rz-button:hover {
    background: transparent !important;
    opacity: 0.7;
}

/* Sessions dropdown in floating mode */
.sessions-dropdown-container {
    position: relative;
}

.sessions-dropdown-container .active {
    background: var(--rz-primary-lighter);
    border-radius: 4px;
}

.sessions-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    width: 280px;
    max-height: 400px;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 1100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sessions-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--rz-border-color);
    font-weight: 500;
    font-size: 13px;
    color: var(--rz-text-color);
}

.sessions-dropdown-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
}

.session-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--rz-base-100);
    transition: background 0.15s;
}

.session-dropdown-item:hover {
    background: var(--rz-base-100);
}

.session-dropdown-item.active {
    background: var(--rz-primary-lighter);
}

.session-dropdown-item .session-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-dropdown-item .session-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-dropdown-item .session-meta {
    font-size: 11px;
    color: var(--rz-text-secondary-color);
}

.sessions-loading,
.sessions-empty {
    padding: 16px;
    text-align: center;
    color: var(--rz-text-secondary-color);
    font-size: 13px;
}

.sessions-limit-warning {
    padding: 8px 12px;
    background: var(--rz-warning-lighter);
    color: var(--rz-warning-darker);
    font-size: 11px;
    text-align: center;
    border-top: 1px solid var(--rz-border-color);
}

.floating-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

/* ===== SKELETON LOADING ===== */
.messages-loading-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    flex: 1;
}

.skeleton-message {
    opacity: 0.7;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg,
        var(--rz-base-200) 25%,
        var(--rz-base-300) 50%,
        var(--rz-base-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(90deg,
        var(--rz-base-200) 25%,
        var(--rz-base-300) 50%,
        var(--rz-base-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== MESSAGES ===== */
.chat-message {
    display: flex;
    gap: 8px;
    max-width: 95%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 80%;
}

.chat-message.assistant {
    align-self: flex-start;
    align-items: flex-start; /* Avatar aligned to top */
    max-width: 100%;
    width: 100%;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    /* Soft holographic background that complements the sparkle glyph. The previous
       solid primary fill clashed with the gradient SVG — this subtle radial keeps
       contrast on both light and dark themes without dominating the icon. */
    background: radial-gradient(circle at 30% 30%,
        rgba(192, 132, 252, 0.18) 0%,
        rgba(99, 102, 241, 0.12) 60%,
        transparent 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.message-avatar .rzi {
    font-size: 16px;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-text p {
    margin: 0 0 8px 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.chat-message.user .message-text {
    background: var(--rz-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Assistant messages: no box, full width (ChatGPT style) */
.chat-message.assistant .message-text {
    background: transparent;
    padding: 0;
    border-radius: 0;
    width: 100%;
    position: relative; /* For preview overlay positioning */
}

.chat-message.assistant .message-content {
    flex: 1;
    min-width: 0;
    width: 100%;
}

/* Headings in chat messages - controlled sizes for readability */
.floating-chat-messages .model-md h1,
.floating-chat-messages .model-md h2,
.floating-chat-messages .model-md h3,
.floating-chat-messages .model-md h4,
.floating-chat-messages .model-md h5,
.floating-chat-messages .model-md h6,
.fullscreen-messages .model-md h1,
.fullscreen-messages .model-md h2,
.fullscreen-messages .model-md h3,
.fullscreen-messages .model-md h4,
.fullscreen-messages .model-md h5,
.fullscreen-messages .model-md h6 {
    margin: 0.6em 0 0.25em;
    line-height: 1.3;
    font-weight: 600;
}

.floating-chat-messages .model-md h1,
.fullscreen-messages .model-md h1 { font-size: 1.15em; }

.floating-chat-messages .model-md h2,
.fullscreen-messages .model-md h2 { font-size: 1.08em; }

.floating-chat-messages .model-md h3,
.fullscreen-messages .model-md h3 { font-size: 1.02em; }

.floating-chat-messages .model-md h4,
.fullscreen-messages .model-md h4 { font-size: 1em; }

.floating-chat-messages .model-md h5,
.fullscreen-messages .model-md h5 { font-size: 0.95em; }

.floating-chat-messages .model-md h6,
.fullscreen-messages .model-md h6 { font-size: 0.92em; }

/* AI Preview containers inside chat messages */
/* AI Preview - HIDDEN by default, only show when it has a revealed image */
.message-text .ai-preview-wrap,
.message-content .ai-preview-wrap {
    display: none !important;
}

/* Only show preview when it has an actual visible frame OR is live */
.message-text .ai-preview-wrap:has(img.ai-reveal),
.message-content .ai-preview-wrap:has(img.ai-reveal),
.message-text .ai-preview-wrap.ai-live,
.message-content .ai-preview-wrap.ai-live {
    position: relative;
    display: inline-block !important;
    max-width: var(--img-max, 500px);
    margin: 12px 0 !important;
    border-radius: 12px;
    /* Show skeleton background */
    background: linear-gradient(135deg,
        var(--rz-base-200, #1a1a2e) 0%,
        var(--rz-base-300, #16213e) 100%);
    overflow: hidden;
}

/* Transparent background when image is visible */
.message-text .ai-preview-wrap:has(img.ai-reveal),
.message-content .ai-preview-wrap:has(img.ai-reveal) {
    background: transparent;
}

/* Always hide when finalized */
.message-text .ai-preview-wrap.ai-prune,
.message-content .ai-preview-wrap.ai-prune {
    display: none !important;
}

/* In fullscreen mode, images at reasonable size */
.fullscreen-messages .ai-preview-wrap,
.fullscreen-messages figure.ai-final {
    max-width: 500px !important;
    width: 100%;
}

/* Override message constraints for AI content in fullscreen */
.fullscreen-messages .chat-message.assistant {
    max-width: 100%;
}

.message-text .ai-preview-wrap.ai-live,
.message-content .ai-preview-wrap.ai-live {
    display: block !important;
}

/* When image container exists, overlay the preview on top */
.message-text:has(.ai-image-container) .model-md .ai-preview-wrap.ai-live {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    margin: 0;
}

/* Skeleton scanning animation */
.message-text .ai-preview-wrap.scanning::before,
.message-content .ai-preview-wrap.scanning::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.1) 50%,
        transparent 100%
    );
    animation: ai-scan 1.5s ease-in-out infinite;
    z-index: 2;
    pointer-events: none;
}

@keyframes ai-scan {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Preview frames inside skeleton */
.message-text .ai-preview-wrap > img.ai-frame,
.message-content .ai-preview-wrap > img.ai-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-text .ai-preview-wrap > img.ai-frame.ai-reveal,
.message-content .ai-preview-wrap > img.ai-frame.ai-reveal {
    opacity: 1;
}

/* Hidden preview images (data carriers) */
.message-text img.ai-preview,
.message-content img.ai-preview {
    display: none !important;
}

/* Mark elements for cleanup */
.message-text .ai-prune,
.message-content .ai-prune {
    display: none !important;
}

/* AI caption styling */
.message-text .ai-caption,
.message-content .ai-caption {
    margin-top: 12px;
    line-height: 1.5;
}

.message-actions {
    display: flex;
    gap: 2px;
    opacity: 0.6;
}

.message-actions:hover {
    opacity: 1;
}

/* Feedback visual para botones like/dislike */
.message-actions .action-liked {
    color: var(--rz-primary) !important;
    opacity: 1;
}

.message-actions .action-disliked {
    color: var(--rz-primary) !important;
    opacity: 1;
}

.message-actions .action-liked .rzi,
.message-actions .action-disliked .rzi {
    font-variation-settings: 'FILL' 1;
}

/* ===== CITATION PANEL ===== */
.citation-panel {
    margin-top: 8px;
    margin-bottom: 4px;
}

.citation-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--rz-border-color);
    border-radius: 20px;
    background: color-mix(in srgb, var(--rz-base-background-color) 95%, var(--rz-primary));
    color: var(--rz-text-color);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.citation-toggle:hover {
    background: color-mix(in srgb, var(--rz-base-background-color) 88%, var(--rz-primary));
    border-color: var(--rz-primary);
}

.citation-chevron {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.citation-chevron.expanded {
    transform: rotate(180deg);
}

.citation-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 4px 0;
}

.citation-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--rz-border-color);
    border-radius: 10px;
    background: var(--rz-base-background-color);
    text-decoration: none;
    color: var(--rz-text-color);
    font-size: 13px;
    min-width: 180px;
    max-width: 300px;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.citation-item:hover {
    background: color-mix(in srgb, var(--rz-base-background-color) 92%, var(--rz-primary));
    border-color: var(--rz-primary-lighter);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.citation-index {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--rz-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.citation-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.citation-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.citation-url {
    font-size: 11px;
    color: var(--rz-text-disabled-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.citation-link-icon {
    font-size: 14px;
    color: var(--rz-text-disabled-color);
    flex-shrink: 0;
}

.citation-item:hover .citation-link-icon {
    color: var(--rz-primary);
}

/* Reasoning/Thinking content styles - ChatGPT modern style */
.reasoning-container {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-bottom: 10px;
    margin-left: 0;
    padding: 0;
    overflow: hidden;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.reasoning-container.collapsed {
    display: block;
}

.reasoning-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: color-mix(in srgb, var(--rz-text-disabled-color, #9ca3af) 92%, transparent);
    background: transparent;
    border: 0;
    text-align: left;
    user-select: none;
    transition: color 0.15s ease, opacity 0.15s ease;
    gap: 5px;
    opacity: 0.92;
}

.reasoning-header:hover {
    color: var(--rz-text-secondary-color);
    background: transparent;
    opacity: 1;
}

.reasoning-header-text {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.reasoning-header-text::after {
    content: '';
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: scale(0.7);
}

.reasoning-content {
    padding: 6px 0 2px 19px;
    font-size: 11px;
    line-height: 1.5;
    color: color-mix(in srgb, var(--rz-text-disabled-color, #9ca3af) 92%, transparent);
    border-top: none;
    max-height: 260px;
    overflow-y: auto;
    font-style: normal;
}

.reasoning-content :deep(p) {
    margin-bottom: 0.4em;
    font-size: 11px;
    color: inherit;
}

.reasoning-content :deep(code) {
    font-size: 11px;
    background: color-mix(in srgb, var(--rz-base-200) 65%, transparent);
    padding: 1px 4px;
    border-radius: 3px;
}

.reasoning-container.streaming {
    opacity: 1;
}

.reasoning-content.streaming {
    max-height: 220px;
}

.reasoning-container.streaming .reasoning-header {
    color: color-mix(in srgb, var(--rz-text-disabled-color, #9ca3af) 78%, var(--rz-text-secondary-color));
}

.reasoning-container.streaming .reasoning-header-text::after {
    opacity: 1;
    animation: thinking-pulse 1.15s ease-in-out infinite;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.chat-stream-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--rz-text-disabled-color, #9ca3af);
    margin-bottom: 8px;
    min-height: 28px;
    line-height: 1.3;
    letter-spacing: 0.01em;
    padding: 0;
    width: fit-content;
    max-width: 100%;
    align-self: flex-start;
    text-align: left;
    border: none;
    background: transparent;
    animation: toolStatusFadeIn 0.3s ease-out;
}

.chat-stream-status.clickable {
    cursor: pointer;
}

.chat-stream-status.clickable:hover {
    color: var(--rz-text-secondary-color);
}

.chat-stream-status-label {
    display: inline-block;
    text-align: left;
    font-weight: 500;
    color: var(--rz-text-disabled-color, #9ca3af);
    animation: toolStatusPulse 2.4s ease-in-out infinite;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .chat-stream-status-label {
        background: linear-gradient(90deg,
            rgba(148, 163, 184, 0.48) 0%,
            rgba(148, 163, 184, 0.48) 32%,
            rgba(226, 232, 240, 0.98) 50%,
            rgba(148, 163, 184, 0.48) 68%,
            rgba(148, 163, 184, 0.48) 100%);
        background-size: 220% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: shimmerWave 1.8s ease-in-out infinite;
    }

    .chat-stream-status.has-reasoning .chat-stream-status-label {
        background: linear-gradient(90deg,
            color-mix(in srgb, var(--rz-primary) 35%, var(--rz-text-disabled-color, #9ca3af)) 0%,
            color-mix(in srgb, var(--rz-primary) 35%, var(--rz-text-disabled-color, #9ca3af)) 32%,
            color-mix(in srgb, var(--rz-primary) 78%, white) 50%,
            color-mix(in srgb, var(--rz-primary) 35%, var(--rz-text-disabled-color, #9ca3af)) 68%,
            color-mix(in srgb, var(--rz-primary) 35%, var(--rz-text-disabled-color, #9ca3af)) 100%);
        background-size: 220% 100%;
    }
}

.chat-stream-status-chevron {
    font-size: 16px;
    opacity: 0.8;
    margin-left: 0.15rem;
}

/* ===== TOOL STEP TIMELINE =====
   Shows each tool invocation during an assistant turn as its own line
   (spinner while running, check + duration once done). Populated from
   ChatMessage.LiveSteps which is filled by StreamAIResponseCoreAsync.
   Voice mode never sets LiveSteps, so this block is ignored there. */
.chat-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.chat-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    line-height: 1.35;
    letter-spacing: 0.01em;
    color: var(--rz-text-disabled-color, #9ca3af);
    padding: 2px 0;
    animation: chatStepFadeIn 220ms ease-out;
    will-change: opacity, transform;
}

.chat-step.is-done {
    color: color-mix(in srgb, var(--rz-text-disabled-color, #9ca3af) 85%, transparent);
    opacity: 0.82;
}

.chat-step.is-failed {
    color: var(--rz-danger, #ef4444);
    opacity: 1;
}

.chat-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.chat-step.is-done .chat-step-icon {
    color: var(--rz-success, #10b981);
    animation: chatStepCheckPop 300ms cubic-bezier(.34,1.56,.64,1);
}

.chat-step.is-failed .chat-step-icon {
    color: var(--rz-danger, #ef4444);
}

.chat-step-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.5px solid color-mix(in srgb, var(--rz-primary) 30%, transparent);
    border-top-color: var(--rz-primary, #6366f1);
    border-radius: 50%;
    animation: chatStepSpin 780ms linear infinite;
}

.chat-step-label {
    font-weight: 500;
    flex: 1 1 auto;
    min-width: 0;
}

.chat-step.is-running .chat-step-label {
    background: linear-gradient(90deg,
        rgba(148, 163, 184, 0.55) 0%,
        rgba(148, 163, 184, 0.55) 32%,
        rgba(226, 232, 240, 0.98) 50%,
        rgba(148, 163, 184, 0.55) 68%,
        rgba(148, 163, 184, 0.55) 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmerWave 1.8s ease-in-out infinite;
}

.chat-step-duration {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
    flex: 0 0 auto;
}

@keyframes chatStepFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes chatStepCheckPop {
    0% { transform: scale(0.4); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .chat-step,
    .chat-step-spinner,
    .chat-step.is-done .chat-step-icon,
    .chat-step.is-running .chat-step-label {
        animation: none !important;
    }
}

@keyframes toolStatusFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toolStatusPulse {
    0% { opacity: 0.55; }
    50% { opacity: 0.95; }
    100% { opacity: 0.55; }
}

@keyframes shimmerWave {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ===== ATTACHMENT BAR ===== */
.attachment-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    border-top: 1px solid var(--rz-border-color);
    background: var(--rz-base-50);
}

.attachment-chip {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--rz-base-200);
    border: 1px solid var(--rz-border-color);
    min-width: 148px;
    max-width: 220px;
    position: relative;
}

.attachment-chip.pdf {
    background: rgba(231, 76, 60, 0.1);
    border-color: #e74c3c;
    color: #e74c3c;
}

.attachment-chip.word {
    background: rgba(41, 128, 185, 0.1);
    border-color: #2980b9;
    color: #2980b9;
}

.attachment-chip.excel {
    background: rgba(39, 174, 96, 0.1);
    border-color: #27ae60;
    color: #27ae60;
}

.attachment-chip.ppt {
    background: rgba(230, 126, 34, 0.1);
    border-color: #e67e22;
    color: #e67e22;
}

.attachment-chip.text {
    background: rgba(127, 140, 141, 0.1);
    border-color: #7f8c8d;
    color: #7f8c8d;
}

.attachment-chip.image {
    background: linear-gradient(180deg, rgba(255,255,255,0.92) 0%, rgba(243, 247, 252, 0.98) 100%);
    border-color: color-mix(in srgb, var(--rz-primary) 30%, var(--rz-border-color));
    color: var(--rz-text-color);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.attachment-preview {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
}

.attachment-preview-button {
    display: block;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    border-radius: 12px;
    overflow: hidden;
}

.attachment-preview-large {
    width: 100%;
    height: 148px;
    display: block;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--rz-border-color) 55%, transparent);
    background: color-mix(in srgb, var(--rz-base-100) 82%, white);
    transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.attachment-preview-button:hover .attachment-preview-large,
.attachment-preview-button:focus-visible .attachment-preview-large {
    transform: scale(1.02);
    filter: saturate(1.04);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.attachment-name {
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--rz-text-color);
    font-weight: 600;
    line-height: 1.25;
    padding-right: 1.6rem;
}

.attachment-chip.image .attachment-name {
    padding: 0.2rem 1.6rem 0 0.1rem;
}

.attachment-chip ::deep .rz-button {
    position: absolute;
    top: 6px;
    right: 6px;
}

.chat-attachment-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(8, 12, 20, 0.88);
    backdrop-filter: blur(4px);
    outline: none;
}

body.chat-attachment-lock {
    overflow: hidden;
}

.chat-attachment-lightbox {
    position: relative;
    width: min(92vw, 1100px);
    max-height: 90vh;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, white 14%, transparent);
    background: color-mix(in srgb, var(--rz-base-900) 92%, black);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.chat-attachment-lightbox-body {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.75rem 4.5rem 1.5rem;
}

.chat-attachment-lightbox-image {
    max-width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 14px;
    background: white;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.3);
}

.chat-attachment-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem 1.25rem;
    color: white;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.06));
}

.chat-attachment-lightbox-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-lightbox-counter {
    flex-shrink: 0;
    color: rgba(255,255,255,0.72);
    font-size: 0.9rem;
}

.chat-attachment-lightbox-close,
.chat-attachment-lightbox-nav {
    position: absolute;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chat-attachment-lightbox-close:hover,
.chat-attachment-lightbox-nav:hover {
    background: rgba(15, 23, 42, 0.78);
    transform: translateY(-1px);
}

.chat-attachment-lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
}

.chat-attachment-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
}

.chat-attachment-lightbox-nav.prev {
    left: 1rem;
}

.chat-attachment-lightbox-nav.next {
    right: 1rem;
}

@media (max-width: 768px) {
    .attachment-chip {
        min-width: 136px;
        max-width: 184px;
    }

    .attachment-preview-large {
        height: 116px;
    }

    .chat-attachment-lightbox-overlay {
        padding: 0.75rem;
    }

    .chat-attachment-lightbox-body {
        min-height: 46vh;
        padding: 3.5rem 1rem 1rem;
    }

    .chat-attachment-lightbox-image {
        max-height: 58vh;
    }

    .chat-attachment-lightbox-nav {
        width: 2.5rem;
        height: 2.5rem;
    }

    .chat-attachment-lightbox-nav.prev {
        left: 0.5rem;
    }

    .chat-attachment-lightbox-nav.next {
        right: 0.5rem;
    }
}

/* ===== USER MESSAGE ATTACHMENTS (ChatGPT Style) ===== */
.user-attach-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 6px 0 12px;
}

/* Base chip for user message attachments */
.uatt {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 260px;
    max-width: 560px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border-radius: 8px;
}

/* Document chips */
.uatt--doc {
    padding-left: 0;
}

.uatt-left {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.uatt-ext {
    font-size: 12px;
    letter-spacing: .3px;
}

.uatt-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.uatt-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    max-height: 3.1em;
    text-align: left;
    color: var(--rz-text-color);
}

.uatt-meta {
    font-size: 12px;
    opacity: .75;
    margin-top: 2px;
    text-align: left;
    color: var(--rz-text-secondary-color);
}

/* Image attachments */
.uatt--img {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    flex-direction: column;
    padding: 8px 8px 10px;
    gap: 8px;
}

.uatt-img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.uatt-caption {
    font-size: 12px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    max-height: 2.5em;
    text-align: left;
    color: var(--rz-text-color);
}

/* Colors by file type (ChatGPT style) */
.uatt--pdf .uatt-left { background: #E11D48; }
.uatt--word .uatt-left { background: #2563EB; }
.uatt--excel .uatt-left { background: #16A34A; }
.uatt--ppt .uatt-left { background: #EA580C; }
.uatt--txt .uatt-left,
.uatt--json .uatt-left,
.uatt--xml .uatt-left { background: #475569; }

/* ===== ULTRA MINIMAL INPUT (ChatGPT style) ===== */
.gpt-input-area {
    padding: 12px 16px 16px;
    background: transparent;
}

.gpt-input-box {
    background: var(--rz-base-100);
    border: none;
    border-radius: 24px;
    padding: 14px 18px 12px;
}

.gpt-input-box:focus-within {
    background: var(--rz-base-100);
}

.gpt-textarea-row {
    display: flex;
    width: 100%;
}

.gpt-textarea {
    width: 100%;
    border: none !important;
    border-width: 0 !important;
    background: transparent !important;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 0;
    min-height: 24px;
    max-height: 200px;
    height: auto;
    color: var(--rz-text-color);
    outline: none !important;
    box-shadow: none !important;
    overflow-y: hidden;
}

.gpt-textarea:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.gpt-textarea::placeholder {
    color: var(--rz-text-disabled-color);
}

.gpt-tools-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    gap: 8px;
}

.gpt-tools-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gpt-tools-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gpt-tool-wrapper {
    position: relative;
}

.gpt-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    min-width: 32px;
    padding: 0 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--rz-text-tertiary-color);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.gpt-tool-btn:hover:not(:disabled) {
    background: var(--rz-base-200);
    color: var(--rz-text-color);
}

.gpt-tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gpt-tool-btn.active {
    color: var(--rz-primary);
    background: rgba(var(--rz-primary-rgb), 0.1);
}

.gpt-tool-btn .rzi {
    font-size: 18px;
}

.gpt-tool-labeled {
    padding: 0 12px;
}

.gpt-tool-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Mode toggles (Web Search, Code Mode, ...) — pill-shaped buttons
   with role=switch and aria-checked so screen readers treat the
   control as a toggle. Desktop shows the icon plus label; narrow
   mobile hides the label but keeps the icon plus aria-label/title
   for accessibility. */
.gpt-tools-left {
    gap: 0.75rem;
}

.gpt-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 32px;
    min-width: 32px;
    padding: 0 0.75rem;
    border: 1px solid transparent;
    background: var(--rz-base-100);
    color: var(--rz-text-color);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.gpt-mode-toggle:hover:not(:disabled):not(.active) {
    background: var(--rz-base-200);
    border-color: var(--rz-base-300);
}

.gpt-mode-toggle:focus-visible {
    outline: 2px solid var(--rz-primary);
    outline-offset: 2px;
}

.gpt-mode-toggle:active:not(:disabled) {
    transform: scale(0.97);
}

.gpt-mode-toggle.active {
    background: var(--rz-primary);
    color: white;
    border-color: var(--rz-primary);
    box-shadow: 0 0 0 3px var(--rz-primary-lighter, rgba(var(--rz-primary-rgb, 59, 130, 246), 0.25));
}

.gpt-mode-toggle.active:hover:not(:disabled) {
    background: var(--rz-primary-dark, var(--rz-primary));
}

.gpt-mode-toggle:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gpt-mode-toggle .rzi {
    font-size: 18px;
    line-height: 1;
}

.gpt-mode-toggle-label {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Send button - minimal and proportional */
.gpt-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: var(--rz-text-tertiary-color);
    color: white;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.gpt-send-btn:hover:not(:disabled):not(.disabled) {
    background: var(--rz-text-color);
}

.gpt-send-btn:active:not(:disabled):not(.disabled) {
    transform: scale(0.95);
}

.gpt-send-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.gpt-send-btn svg {
    width: 16px;
    height: 16px;
}

.gpt-send-btn .rzi {
    font-size: 16px;
}

.gpt-stop-btn {
    background: var(--rz-danger);
}

.gpt-stop-btn:hover:not(:disabled) {
    background: var(--rz-danger-dark);
}

/* ── Voice mode ────────────────────────────────────── */
.gpt-mic-btn {
    background: transparent;
    color: var(--rz-text-tertiary-color);
}
.gpt-mic-btn:hover:not(:disabled):not(.disabled) {
    background: var(--rz-base-200);
    color: var(--rz-text-color);
}

.voice-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--rz-base-100);
    border-radius: 16px;
    border: 1px solid var(--rz-border-color);
}
.voice-panel-compact {
    padding: 8px 12px;
    gap: 8px;
}

.voice-orb {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--rz-primary-lighter) 0%, var(--rz-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: voice-pulse 2s ease-in-out infinite;
}
.voice-orb-small {
    width: 32px;
    height: 32px;
}
.voice-orb-inner {
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}

.voice-orb[data-voice-state="listening"] {
    animation: voice-pulse 1.2s ease-in-out infinite;
    background: radial-gradient(circle, var(--rz-success-lighter) 0%, var(--rz-success) 100%);
}
.voice-orb[data-voice-state="thinking"] {
    animation: voice-spin 1.5s linear infinite;
    background: radial-gradient(circle, var(--rz-warning-lighter) 0%, var(--rz-warning) 100%);
}
.voice-orb[data-voice-state="speaking"] {
    animation: voice-pulse 0.8s ease-in-out infinite;
    background: radial-gradient(circle, var(--rz-primary-lighter) 0%, var(--rz-primary) 100%);
}
.voice-orb[data-voice-state="connecting"] {
    animation: voice-spin 2s linear infinite;
    opacity: 0.7;
}

.voice-status {
    font-size: 13px;
    color: var(--rz-text-secondary-color);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@keyframes voice-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(var(--rz-primary-rgb, 59,130,246), 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(var(--rz-primary-rgb, 59,130,246), 0); }
}
@keyframes voice-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gpt-char-counter {
    font-size: 12px;
    font-weight: 500;
    color: var(--rz-text-disabled-color);
    font-variant-numeric: tabular-nums;
}

.gpt-char-counter.warning {
    color: var(--rz-warning);
}

.gpt-char-counter.error {
    color: var(--rz-danger);
}

.gpt-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    z-index: 1000;
}

.gpt-dropdown-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--rz-text-disabled-color);
    padding: 4px 8px 8px;
    letter-spacing: 0.5px;
}

.gpt-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--rz-text-color);
    text-align: left;
    transition: background 0.15s;
}

.gpt-dropdown-item:hover {
    background: var(--rz-base-200);
}

.gpt-dropdown-item.selected {
    background: var(--rz-primary-lighter);
    color: var(--rz-primary);
}

.gpt-dropdown-item .rzi {
    font-size: 16px;
    opacity: 0.7;
}

.gpt-char-counter {
    font-size: 11px;
    color: var(--rz-text-disabled-color);
    padding-right: 8px;
}

.gpt-char-counter.warning {
    color: var(--rz-warning);
}

.gpt-char-counter.error {
    color: var(--rz-danger);
}

/* ===== Legacy INPUT (fallback) ===== */
.floating-chat-input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--rz-border-color);
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.attach-btn {
    margin-bottom: 6px;
}

.chat-textarea {
    flex: 1;
    border: 1px solid var(--rz-border-color);
    border-radius: 8px;
    padding: 10px 12px;
    padding-bottom: 24px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    max-height: 200px;
    min-height: 24px;
    height: auto;
    overflow-y: hidden;
    background: var(--rz-base-background-color);
    box-sizing: border-box;
    transition: border-color 0.2s;
    color: var(--rz-text-color);
}

.chat-textarea:focus {
    outline: none;
    border-color: var(--rz-primary);
}

.chat-textarea.near-limit {
    border-color: var(--rz-warning);
}

.chat-textarea.at-limit {
    border-color: var(--rz-danger);
}

.char-counter {
    position: absolute;
    bottom: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--rz-text-disabled-color);
    pointer-events: none;
}

.char-counter.warning {
    color: var(--rz-warning);
    font-weight: 500;
}

.char-counter.error {
    color: var(--rz-danger);
    font-weight: 600;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 8px;
}

.input-spacer {
    flex: 1;
}

/* ===== REASONING EFFORT SELECTOR ===== */
.reasoning-selector {
    position: relative;
}

.reasoning-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: var(--rz-panel-background-color);
    border: 1px solid var(--rz-border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    min-width: 280px;
    z-index: 1000;
    overflow: hidden;
}

.reasoning-menu.floating-menu {
    min-width: 200px;
}

.reasoning-menu-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid var(--rz-border-color);
}

.reasoning-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.reasoning-option:hover {
    background: var(--rz-secondary-lighter);
}

.reasoning-option.selected {
    background: var(--rz-primary-light);
}

.reasoning-option ::deep .rz-icon {
    font-size: 20px;
    color: var(--rz-text-secondary-color);
}

.reasoning-option.selected ::deep .rz-icon {
    color: var(--rz-primary);
}

.reasoning-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reasoning-option-title {
    font-weight: 500;
    font-size: 14px;
}

.reasoning-option-desc {
    font-size: 12px;
    color: var(--rz-text-secondary-color);
}

.floating-menu .reasoning-option-text {
    display: none;
}

.floating-menu .reasoning-option span {
    font-size: 13px;
}

.chat-disclaimer {
    padding: 6px 16px 10px;
    text-align: center;
}

/* ===== GENERATED IMAGES ===== */
.generated-image {
    margin: 8px 0;
    border-radius: 8px;
    overflow: hidden;
    max-width: 512px;
}

.generated-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.generated-image img:hover {
    transform: scale(1.02);
}

.revised-prompt {
    font-size: 12px;
    color: var(--rz-text-disabled-color);
    margin-top: 8px;
    padding: 8px;
    background: var(--rz-base-100);
    border-radius: 4px;
}

/* ===== FLOATING BUTTON ===== */
.floating-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    /* Glass + holographic halo so the AiSparkIcon sparkle stays the visual focus.
       Previously was a flat var(--rz-primary) fill which made the glyph unreadable. */
    background:
        radial-gradient(circle at 30% 28%, rgba(192, 132, 252, 0.24) 0%, rgba(99, 102, 241, 0.14) 55%, transparent 80%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.88) 0%, rgba(30, 27, 75, 0.88) 100%);
    color: white;
    border: 1px solid rgba(167, 139, 250, 0.35);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s, border-color 0.2s;
    z-index: 999;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.floating-chat-button:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 22px rgba(192, 132, 252, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    border-color: rgba(192, 132, 252, 0.55);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .fullscreen-chat-container {
        position: relative;
    }

    .chat-mobile-sidebar-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        z-index: 2;
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .conversations-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 320px);
        max-width: 320px;
        z-index: 3;
        box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
        transition: transform 0.25s ease;
    }

    .conversations-sidebar.collapsed {
        width: min(86vw, 320px);
        transform: translateX(-100%);
        overflow: hidden;
        border-right: 1px solid var(--rz-border-color);
    }

    .fullscreen-chat-main {
        max-width: 100%;
        width: 100%;
        min-width: 0;
    }

    .fullscreen-header {
        padding: 0.75rem;
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--rz-base-background-color);
    }

    .fullscreen-messages {
        padding: 0.875rem 0.75rem;
        max-height: none;
    }

    .fullscreen-input-box {
        max-width: none;
        width: auto;
        margin: 0 0.75rem;
    }

    .gallery-sidebar {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        min-width: 0;
        height: min(48dvh, 420px);
        z-index: 4;
        border-left: none;
        border-top: 1px solid var(--rz-border-color);
        box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.18);
    }

    .chat-message,
    .chat-message.user {
        max-width: 100%;
    }

    .message-text {
        font-size: 13px;
    }

    .citation-list {
        flex-direction: column;
    }

    .citation-item {
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .user-attach-bar {
        justify-content: stretch;
    }

    .uatt,
    .uatt--img {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .gpt-tools-row {
        flex-wrap: wrap;
        align-items: center;
    }

    .gpt-tools-left {
        flex: 1 1 auto;
        flex-wrap: wrap;
    }

    .gpt-tools-right {
        gap: 8px;
        margin-left: auto;
    }

    .gpt-tool-label {
        display: none;
    }

    .gpt-tools-left {
        gap: 0.5rem;
    }

    .gpt-mode-toggle {
        height: 36px;
        padding: 0 0.875rem;
        font-size: 13px;
    }

    .voice-panel {
        width: 100%;
        justify-content: space-between;
    }

    .chat-disclaimer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .sessions-dropdown {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        bottom: calc(84px + env(safe-area-inset-bottom));
        top: auto;
        width: auto;
        max-height: min(55dvh, 420px);
    }
}

@media (max-width: 480px) {
    .floating-chat-container {
        width: calc(100vw - 16px);
        height: calc(100dvh - 32px);
        bottom: 8px;
        right: 8px;
    }

    .floating-chat-button {
        bottom: calc(16px + env(safe-area-inset-bottom));
        right: 16px;
    }

    .conversations-sidebar,
    .conversations-sidebar.collapsed {
        width: 100%;
        max-width: 100%;
    }

    .sidebar-header {
        padding: 10px;
    }

    .fullscreen-header {
        padding: 0.625rem;
    }

    .fullscreen-messages {
        padding: 0.75rem 0.625rem;
    }

    .attachment-bar {
        padding: 8px 12px;
    }

    .attachment-chip {
        min-width: 120px;
        max-width: 100%;
        flex: 1 1 calc(50% - 6px);
    }

    /* Icons-only mode toggles on very narrow viewports. The aria-label and
       title remain populated so the control is still announced by screen
       readers and revealed on long-press / hover. */
    .gpt-mode-toggle {
        padding: 0 0.5rem;
        min-width: 36px;
    }

    .gpt-mode-toggle-label {
        display: none;
    }
}
