:root {
    --primary-color: #F9AA33;
    --bg-color: #232F34;
    --sidebar-bg: #232F34;
    --chat-bg: #1A2326;
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --border-color: rgba(255, 255, 255, 0.08);
    --input-bg: transparent;
    --user-msg-bg: #2C3439;
    --agent-msg-bg: transparent;
    --font-main: 'Roboto', sans-serif;
    --card-radius: 4px;
    --pill-radius: 50px;
    --text-main: #C8C8C8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    display: none;
}

body {
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 400;
    line-height: 32px;
    letter-spacing: 0.15px;
    background: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;

    /* Advanced font properties */
    font-feature-settings: normal;
    font-kerning: auto;
    font-language-override: normal;
    font-optical-sizing: auto;
    font-size-adjust: none;
    font-stretch: 100%;
    font-style: normal;
    font-variant-alternates: normal;
    font-variant-caps: normal;
    font-variant-east-asian: normal;
    font-variant-emoji: normal;
    font-variant-ligatures: normal;
    font-variant-numeric: normal;
    font-variant-position: normal;
    font-variation-settings: normal;
}

.user-profile span {
    font-family: var(--font-main);
    font-size: 14px;
    line-height: 32px;
    letter-spacing: 0.15px;
    height: 32px;
    width: 83.8359px;
    text-wrap-mode: nowrap;
    white-space-collapse: collapse;
    display: inline-block;
}

.app-container {
    display: flex;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.new-chat-btn {
    padding: 8px 16px;
    border-radius: var(--pill-radius);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Main Chat Area */
.chat-area {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--chat-bg);
}

.chat-header {
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--sidebar-bg);
    z-index: 100;
    width: 100%;
}

.messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
    max-width: 850px;
    /* Circa 52% del viewport */
    margin: 0 auto;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.chat-header h1 span {
    color: var(--primary-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 200px;
}

.back-link {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.header-center {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-tab.active {
    background: var(--primary-color);
    color: #000;
}

.nav-tab:not(.active):hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    width: 200px;
}

.notification-bell {
    position: relative;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.notification-bell .badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #007bff;
    color: white;
    font-size: 0.65rem;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: bold;
    line-height: 1;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--primary-color);
}

.avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}



.welcome-message {
    text-align: center;
    margin-top: 8vh;
}

.cs-logo {
    width: 220px;
    margin-bottom: 32px;
}

.welcome-message h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 16px;
    max-width: 85%;
    animation: fadeIn 0.4s ease-out;
}

.message.agent {
    max-width: 100%;
}

.message.user {
    align-self: flex-end;
    justify-content: flex-end;
}

.message .icon {
    display: none;
}

.message-content {
    line-height: 1.6;
    font-size: 14.5px;
    white-space: normal;
}

.message-content p {
    margin-bottom: 12px;
}

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

.message-content h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    margin-top: 20px;
    color: var(--primary-color);
    letter-spacing: -0.2px;
}

.message-content h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    margin-top: 18px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.message-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 14px;
    color: var(--text-primary);
}

.message-content h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    margin-top: 12px;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.message-content ul,
.message-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.message.user .message-content {
    background-color: var(--user-msg-bg);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 4px;
    font-weight: 400;
    border: 1px solid var(--border-color);
}

.message.agent .message-content {
    width: 100%;
    background-color: var(--agent-msg-bg);
    color: var(--text-primary);
    padding: 4px 0;
    border: none;
    font-weight: 400;
}

/* Input Area */
.input-container {
    padding: 24px 20px 40px;
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.floating-card {
    background-color: #232F34;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.input-wrapper {
    display: flex;
    flex-direction: column;
}

.input-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    background: transparent;
    padding: 0;
    border: none;
    position: relative;
}

.plus-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.plus-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: scale(1.05);
}

.attached-mcp-container {
    padding: 0 0 12px 0;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.attached-mcp-container:empty {
    display: none;
}

.mcp-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(var(--primary-color-rgb, 224, 153, 46), 0.15);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    gap: 8px;
    animation: fadeIn 0.2s ease-out;
}

.mcp-badge-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
}

.mcp-badge-close:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#mcp-path-overlay {
    position: absolute;
    left: 0;
    top: 4px;
    /* matches chat-input padding-top */
    font-weight: bold;
    color: var(--primary-color);
    font-size: 15px;
    pointer-events: none;
    white-space: pre;
    line-height: 1.5;
    /* matches chat-input */
    display: none;
}

#chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-main);
    font-size: 15px;
    padding: 4px 0;
    resize: none;
    max-height: 200px;
    color: #fff;
    line-height: 1.5;
}

#chat-input::placeholder {
    color: var(--text-secondary);
}

.arrow-submit {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.arrow-submit.active {
    background-color: var(--primary-color);
    color: #000;
}

.arrow-submit.active:hover {
    background-color: #e0992e;
}

.input-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.memory-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-dropdowns {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-dropdowns .dropdown-label {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.highlight-text {
    color: var(--primary-color);
    font-weight: 500;
    margin-left: 4px;
}

.bottom-icons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 8px;
    color: var(--text-secondary);
}

.bottom-icons svg {
    cursor: pointer;
    transition: color 0.2s;
}

.bottom-icons svg:hover {
    color: var(--text-primary);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Citation Icons */
/* Message Content */
.message-content strong {
    font-weight: 600;
    color: #e3e3e3;
}

/* 1. Citation Badges (Info icon style) */
.citation-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: var(--primary-color);
    color: #000;
    border-radius: 4px;
    /* Square with slight roundness */
    font-size: 0.7rem;
    font-weight: 700;
    margin: 0 4px;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s;
    opacity: 0.8;
}

.citation-badge:hover {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 10px var(--primary-color);
}

/* 2. Rich Popup (Card style) */
.citation-popup {
    position: fixed;
    background: #ffffff;
    /* White bg like screenshot */
    color: #1f1f1f;
    /* Dark text for readability */
    border: none;
    border-radius: 8px;
    padding: 16px;
    width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateY(10px);
    font-family: var(--font-main);
}

.citation-popup.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.close-btn {
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    color: #5f6368;
    margin-left: auto;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-btn:hover {
    color: #1f1f1f;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.popup-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #444746;
    word-break: break-all;
}

.confidence-badge {
    background-color: #c4eed0;
    /* Light green */
    color: #0d652d;
    /* Dark green */
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    white-space: nowrap;
    margin-left: 8px;
}

.popup-content {
    font-size: 0.85rem;
    color: #444746;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

/* 3. Thinking Accordion */
.thinking-accordion {
    margin-bottom: 8px;
    /* Reduced from 16px */
    border-bottom: 1px solid var(--border-color);
}

.thinking-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    /* Slightly smaller */
    color: var(--text-secondary);
    padding: 4px 0;
    /* Reduced from 8px */
}

.thinking-header:hover {
    color: var(--text-main);
}

.thinking-content {
    display: none;
    padding: 6px 10px;
    /* Reduced */
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #a0a0a0;
    font-family: monospace;
}

.thinking-accordion.open .thinking-content {
    display: block;
}

.thinking-arrow {
    transition: transform 0.2s;
    font-size: 0.7rem;
}

.thinking-accordion.open .thinking-arrow {
    transform: rotate(180deg);
}


/* 4. Grounding Sources List */
.sources-list {
    margin-top: 16px;
    /* Reduced from 24px */
    padding-top: 8px;
    /* Reduced from 16px */
    border-top: 1px solid var(--border-color);
}

.sources-list h3 {
    font-size: 0.9rem;
    /* Reduced from 1rem */
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 8px;
    /* Reduced from 12px */
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    /* Reduced from 6px */
    color: #a8c7fa;
    /* Link color */
    text-decoration: none;
    font-size: 0.85rem;
    /* Slightly smaller */
    cursor: pointer;
    transition: opacity 0.2s;
}

.source-item:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.source-index {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 400;
    min-width: 15px;
}

.image-placeholder-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    color: #ffd700;
    margin: 4px 0;
    user-select: none;
    cursor: help;
}

.response-image-container {
    margin: 12px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-caption {
    width: 100%;
    padding: 10px 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--border-color);
    font-weight: 400;
}

.arcade-video-container {
    position: relative;
    padding-bottom: calc(58.33% + 41px);
    height: 0;
    width: 100%;
    margin: 1em 0;
}

.arcade-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    color-scheme: light;
}

.response-image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    display: block;
    cursor: zoom-in;
    transition: all 0.2s;
}

.response-image:hover {
    opacity: 0.8;
}

.citation-images-container {
    display: flex;
    flex-direction: column;
    /* Stack images vertically to avoid distortion */
    gap: 15px;
    margin: 12px 0 20px 0;
    padding-left: 15px;
    border-left: 3px solid var(--border-color);
}

.citation-images-container .response-image-container {
    margin: 0;
    max-width: 100%;
    /* Allow full width of the container */
}

.citation-images-container .response-image {
    width: auto;
    max-width: 100%;
    height: auto;
    /* Maintain aspect ratio */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


/* ── Slash-Command Menu ───────────────────────────────────────────────────── */

.input-zone {
    position: relative;
}

.slash-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #1a2535;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 500;
    max-height: 320px;
}

.slash-menu.visible {
    display: block;
}

.slash-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.slash-hint {
    font-size: 0.68rem;
    opacity: 0.55;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.slash-menu-list {
    overflow-y: auto;
    max-height: 270px;
}

.slash-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.12s;
}

.slash-menu-item:last-child {
    border-bottom: none;
}

.slash-menu-item:hover,
.slash-menu-item.selected {
    background: rgba(249, 170, 51, 0.09);
}

.slash-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.slash-tool-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-color);
}

.slash-tool-server {
    font-size: 0.68rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.07);
    padding: 1px 7px;
    border-radius: 4px;
}

.slash-tool-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}


/* ── MCP Parameter Modal ─────────────────────────────────────────────────── */

.mcp-param-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.mcp-param-modal.visible {
    display: flex;
}

.mcp-param-card {
    background: #1a2535;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.mcp-param-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#mcp-param-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.mcp-param-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}

.mcp-param-close:hover {
    color: var(--text-primary);
}

.mcp-param-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.mcp-param-field {
    margin-bottom: 16px;
}

.mcp-param-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mcp-param-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.mcp-param-field input:focus {
    border-color: var(--primary-color);
}

.mcp-param-run {
    width: 100%;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 4px;
    transition: opacity 0.15s;
}

.mcp-param-run:hover {
    opacity: 0.88;
}


/* ── Leo Mentor Welcome Screen ───────────────────────────────────────────── */

/* Body / chat-area gradient (matches Figma design) */
body {
    background: linear-gradient(to bottom, #0a0a1a, #1a1a2e, #0f0f1e);
}

.chat-area {
    background: transparent;
}

/* Override default welcome-message for Leo */
.welcome-message.leo-welcome {
    margin-top: 0;
    text-align: left;
    width: 100%;
}

/* Keyframes */
@keyframes leoFadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes leoFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes leoScaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes leoSlideIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes leoFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}
@keyframes leoTilt {
    0%, 100% { transform: rotate(-3deg); }
    50%       { transform: rotate(3deg); }
}
@keyframes leoSparkle {
    0%, 100% { transform: rotate(0deg); }
    25%       { transform: rotate(10deg); }
    75%       { transform: rotate(-10deg); }
}

/* Animation utility classes */
.anim-hidden { opacity: 0; }

.leo-animate-up    { animation: leoFadeInUp 0.6s ease forwards; }
.leo-animate-fade  { animation: leoFadeIn   0.6s ease forwards; }
.leo-animate-scale { animation: leoScaleIn  0.5s ease forwards; }
.leo-animate-slide { animation: leoSlideIn  0.5s ease forwards; }

.delay-100  { animation-delay: 0.1s; }
.delay-200  { animation-delay: 0.2s; }
.delay-300  { animation-delay: 0.3s; }
.delay-400  { animation-delay: 0.4s; }
.delay-500  { animation-delay: 0.5s; }
.delay-700  { animation-delay: 0.7s; }
.delay-800  { animation-delay: 0.8s; }
.delay-900  { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1.0s; }

.leo-prompt-0 { animation-delay: 0.8s; }
.leo-prompt-1 { animation-delay: 0.9s; }
.leo-prompt-2 { animation-delay: 1.0s; }
.leo-prompt-3 { animation-delay: 1.1s; }

.leo-hidden { display: none !important; }

/* ── Home view ── */
.leo-home {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem 0;
    width: 100%;
}

.leo-float-wrapper {
    display: inline-block;
    animation: leoFloat 3s ease-in-out infinite;
}

.leo-avatar {
    width: 96px;
    height: 96px;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, #f97316, #ea580c);
    box-shadow: 0 25px 50px rgba(249, 115, 22, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    animation: leoTilt 4s ease-in-out infinite;
    user-select: none;
}

.leo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 9999px;
    background-color: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    font-size: 0.875rem;
    font-weight: 500;
}

.leo-sparkle-icon {
    animation: leoSparkle 2s ease infinite 3s;
    flex-shrink: 0;
}

.leo-headline-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.leo-headline {
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    font-weight: 700;
    color: white;
    line-height: 1.1;
}

.leo-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    max-width: 600px;
    line-height: 1.5;
}

.leo-cta-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.leo-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 18px 32px;
    border-radius: 1rem;
    background-color: #f97316;
    color: white;
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.2);
    transition: opacity 0.2s, transform 0.15s;
    font-family: var(--font-main);
    line-height: 1.5;
}

.leo-btn-primary:hover  { opacity: 0.9; transform: scale(1.05); }
.leo-btn-primary:active { transform: scale(0.95); }

.leo-hint {
    font-size: 0.875rem;
    color: #6b7280;
}

.leo-prompts-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

.leo-prompts-label {
    font-size: 0.875rem;
    color: #9ca3af;
}

.leo-prompts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
    width: 100%;
    max-width: 672px;
}

.leo-prompt-btn {
    padding: 12px 20px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #d1d5db;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    width: 100%;
    font-family: var(--font-main);
    line-height: 1.5;
}

.leo-prompt-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.leo-prompt-btn:active { transform: scale(0.98); }

/* ── Onboarding view ── */
.leo-onboarding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.leo-intro-card {
    width: 100%;
    border-radius: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.leo-sm-wrapper {
    animation: leoFloat 2.5s ease-in-out infinite;
    flex-shrink: 0;
}

.leo-sm {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    background: linear-gradient(135deg, #f97316, #ea580c);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: leoTilt 3s ease-in-out infinite;
}

.leo-intro-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.6;
}

.leo-intro-text p:first-child {
    font-size: 1.125rem;
    color: white;
}

.leo-name { color: #fb923c; }

.leo-iframe-wrap {
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 600px;
}

.leo-iframe-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.leo-next-steps {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.leo-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 0.75rem;
    background-color: #f97316;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.2);
    transition: opacity 0.2s, transform 0.15s;
    font-family: var(--font-main);
    line-height: 1.5;
}

.leo-btn-secondary:hover  { opacity: 0.9; transform: scale(1.05); }
.leo-btn-secondary:active { transform: scale(0.95); }

.leo-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: #9ca3af;
    transition: color 0.2s;
    font-family: var(--font-main);
}

.leo-back-btn:hover { color: white; }


/* ── Message bubbles for dark Figma theme ───────────────────────────────── */

.message.user .message-content {
    background-color: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 1rem;
    color: white;
}

.message.agent .message-content {
    color: rgba(255, 255, 255, 0.9);
}


/* ── Figma-style header override ────────────────────────────────────────── */

.leo-header {
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

.chat-header.leo-header h1 {
    font-size: 1.125rem;
    font-weight: 500;
    color: white;
    position: static;
    left: auto;
    transform: none;
    flex: 1;
    letter-spacing: normal;
}

.leo-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f97316, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}
.leo-user-avatar:hover { opacity: 0.75; }

.leo-header-title { cursor: pointer; transition: opacity 0.2s; }
.leo-header-title:hover { opacity: 0.75; }


/* ── Figma-style input override ──────────────────────────────────────────── */

/* Outer container: centered column with hint + input */
.input-container {
    padding: 16px 24px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    margin: 0 auto;
}

.input-hint {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

/* Remove floating-card visual — the textarea IS the card */
.input-container .floating-card {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    width: 100%;
    max-width: 768px;
}

.input-container .input-zone {
    position: relative;
    width: 100%;
    max-width: 768px;
}

/* Remove browser default red border on textarea (Firefox) */
textarea {
    box-shadow: none;
}

/* Figma-style textarea */
.input-container #chat-input {
    width: 100%;
    padding: 16px 52px 16px 20px;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: var(--font-main);
    resize: none;
    max-height: 200px;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-container #chat-input::placeholder {
    color: #6b7280;
}

.input-container #chat-input:focus {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.1);
}

/* Figma-style send button: absolute inside the textarea */
.input-container #send-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #f97316;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    margin-bottom: 0;
}

.input-container #send-btn:hover {
    background: rgba(249, 115, 22, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.input-container #send-btn:active {
    transform: translateY(-50%) scale(0.9);
}

.input-container #send-btn.active {
    color: #f97316;
    background: rgba(249, 115, 22, 0.15);
}

/* Hide actions bar and slash menu label in Leo layout */
.input-container .input-actions-bar {
    display: none;
}

/* Input wrapper/row: relative for absolute send btn */
.input-container .input-wrapper {
    position: relative;
}

.input-container .input-row {
    position: relative;
}

/* Leo avatar image */
.leo-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: 1.5rem;
    object-fit: cover;
    box-shadow: 0 25px 50px rgba(249, 115, 22, 0.2);
    animation: leoTilt 4s ease-in-out infinite;
}

@media (min-width: 768px) {
    .leo-avatar-img { width: 112px; height: 112px; }
}

/* Leo small avatar (onboarding) */
.leo-sm-img {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    object-fit: cover;
    animation: leoTilt 3s ease-in-out infinite;
}