/* ============================================================
   AI Agent — Additional Styles for Improvements
   Conversation History, Code Blocks, and Enhanced UI
   ============================================================ */

/* ============================================================
   CONVERSATION HISTORY SIDEBAR
   ============================================================ */
.conv-history {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    width: 300px;
    height: calc(100vh - var(--topbar-height) - var(--input-height));
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform var(--transition);
}

.conv-history.open {
    transform: translateX(0);
}

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

.conv-history-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.conv-history-actions {
    display: flex;
    gap: 4px;
}

.conv-search-wrapper {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
}

.conv-search-wrapper.hidden {
    display: none;
}

.conv-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.85rem;
}

.conv-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

.conv-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.conv-empty p {
    margin: 0 0 4px;
    font-size: 0.9rem;
}

.conv-empty-hint {
    font-size: 0.8rem;
    opacity: 0.8;
}

.conv-item {
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 4px;
    position: relative;
}

.conv-item:hover {
    background: var(--bg-elevated);
}

.conv-item.active {
    background: var(--accent);
    color: white;
}

.conv-item.active .conv-item-meta,
.conv-item.active .conv-item-preview,
.conv-item.active .conv-item-time,
.conv-item.active .conv-action-btn {
    color: rgba(255, 255, 255, 0.8);
}

.conv-item.active .conv-action-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.conv-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.conv-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-right: 8px;
}

.conv-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.conv-item-count {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: 10px;
}

.conv-item.active .conv-item-count {
    background: rgba(255, 255, 255, 0.2);
}

.conv-item-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.conv-item-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.conv-item:hover .conv-item-actions,
.conv-item:focus-within .conv-item-actions {
    opacity: 1;
}

.conv-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.conv-action-btn:hover {
    color: var(--text);
    background: var(--bg-input);
}

.conv-item.starred .star-btn {
    color: var(--warning);
}

.conv-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--text-muted);
}

.conv-loading.hidden {
    display: none;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.conv-error {
    text-align: center;
    padding: 20px;
    color: var(--error);
}

/* ============================================================
   CODE BLOCK ENHANCEMENTS
   ============================================================ */

.code-block-wrapper {
    position: relative;
    margin: 16px 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: #1e1e1e; /* Match code background */
    border: 1px solid var(--border);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.code-lang-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.code-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.code-action-btn:hover {
    color: var(--text);
    background: var(--bg-input);
}

.code-action-btn.copied {
    color: var(--success);
}

.msg-bubble pre {
    position: relative;
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.msg-bubble code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
    opacity: 0;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--bg-input);
    color: var(--text);
}

.code-copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.code-copy-btn .hidden {
    display: none;
}

.code-lang-label {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.7rem;
    padding: 3px 8px;
    background: var(--bg);
    border-radius: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* Line numbers for code blocks */
.line-numbers {
    counter-reset: line;
}

.line-numbers code {
    counter-increment: line;
}

.line-numbers code::before {
    content: counter(line);
    display: inline-block;
    width: 2em;
    margin-right: 1em;
    text-align: right;
    color: var(--text-muted);
    user-select: none;
}

/* ============================================================
   MESSAGE ENHANCEMENTS
   ============================================================ */

.msg-bubble {
    position: relative;
}

.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3,
.msg-bubble h4 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    line-height: 1.3;
}

.msg-bubble h1 { font-size: 1.4em; }
.msg-bubble h2 { font-size: 1.2em; }
.msg-bubble h3 { font-size: 1.1em; }
.msg-bubble h4 { font-size: 1em; }

.msg-bubble h1:first-child,
.msg-bubble h2:first-child,
.msg-bubble h3:first-child {
    margin-top: 0;
}

/* Task lists */
.msg-b ul.task-list {
    list-style: none;
    padding-left: 0;
}

.msg-bubble ul.task-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.msg-bubble ul.task-list input[type="checkbox"] {
    margin-top: 4px;
}

/* Tables */
.msg-bubble table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 0.9em;
}

.msg-bubble th,
.msg-bubble td {
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border);
}

.msg-bubble th {
    background: var(--bg-elevated);
    font-weight: 600;
}

.msg-bubble tr:nth-child(even) {
    background: var(--bg-surface);
}

/* Blockquotes */
.msg-bubble blockquote {
    margin: 12px 0;
    padding: 12px 16px;
    border-left: 4px solid var(--accent);
    background: var(--bg-elevated);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.msg-bubble blockquote p:first-child {
    margin-top: 0;
}

.msg-bubble blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rules */
.msg-bubble hr {
    margin: 24px 0;
    border: none;
    border-top: 2px solid var(--border);
}

/* Selection colors */
.msg-bubble ::selection {
    background: var(--accent);
    color: white;
}

/* Focus styles for links */
.msg-bubble a {
    color: var(--accent-light);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
}

.msg-bubble a:hover,
.msg-bubble a:focus {
    text-decoration: none;
    border-bottom-style: solid;
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

/* ============================================================
   KEYBOARD SHORTCUTS OVERLAY
   ============================================================ */

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.shortcuts-overlay.open {
    opacity: 1;
    visibility: visible;
}

.shortcuts-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition);
}

.shortcuts-overlay.open .shortcuts-box {
    transform: scale(1);
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.shortcuts-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.shortcuts-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcuts-close:hover {
    color: var(--text);
    background: var(--bg-elevated);
}

.shortcuts-list {
    display: grid;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.shortcut-key {
    display: flex;
    gap: 4px;
}

kbd {
    padding: 4px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   MODEL BADGE PROVIDER STYLES
   ============================================================ */

.model-badge {
    transition: all var(--transition);
}

.model-badge.groq {
    color: #ff6b6b;
}

.model-badge.gemini {
    color: #4ade80;
}

.model-badge.openrouter {
    color: #a78bfa;
}

.model-badge.sambanova {
    color: #fbbf24;
}

.model-badge.active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

/* ============================================================
   STREAMING & STOP BUTTON STYLES
   ============================================================ */

.stop-btn {
    color: var(--error) !important;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.stop-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
}

.stop-btn svg {
    fill: currentColor;
}

.streaming-active {
    position: relative;
}

.streaming-active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-light), var(--accent));
    background-size: 200% 100%;
    opacity: 0.3;
    animation: shimmer 1.5s ease infinite;
    z-index: -1;
}

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

.msg-bubble.streaming {
    border-left: 3px solid var(--accent);
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), transparent);
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

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

.message {
    animation: fadeInUp 0.3s ease;
}

.conv-item {
    animation: slideIn 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .message,
    .conv-item {
        animation: none;
    }
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */

@media (max-width: 1024px) {
    .conv-history {
        width: 260px;
    }
}

@media (max-width: 768px) {
    .conv-history {
        top: var(--topbar-height);
        left: 0;
        width: 80%;
        max-width: 320px;
        height: calc(100vh - var(--topbar-height));
        z-index: 150;
        box-shadow: var(--shadow-lg);
    }

    .conv-history:not(.open) {
        transform: translateX(-100%);
    }

    .conv-history-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 149;
    }

    .conv-history-overlay.show {
        display: block;
    }

    .code-copy-btn {
        opacity: 1;
    }
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

/* Focus visible improvements */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline-offset: -2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border: #666;
        --border-light: #888;
        --text-muted: #555;
        --text-secondary: #444;
    }

    .conv-item.active {
        outline: 2px solid currentColor;
    }
}

/* Print styles */
@media print {
    .conv-history,
    .conv-history-overlay,
    .code-copy-btn,
    .shortcut-overlay {
        display: none !important;
    }

    .msg-bubble pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}

/* ============================================================
   AGENT MODE STYLES
   ============================================================ */

/* Badge for new features */
.badge-new {
    display: inline-block;
    padding: 2px 6px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
    margin-left: 6px;
    letter-spacing: 0.3px;
}

/* Agent chip styling */
.chip-agent {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.1));
    border-color: rgba(139, 92, 246, 0.3);
}

.chip-agent:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.2));
    border-color: rgba(139, 92, 246, 0.5);
}

.chip-agent .chip-icon {
    color: #8b5cf6;
}

/* ============================================================
   WELCOME SCREEN STYLES (v1.3.1 - Agent Stack Guidance)
   ============================================================ */

.welcome {
    padding: 40px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.welcome-shell {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 48px;
    align-items: start;
    margin-bottom: 48px;
}

.welcome-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    pointer-events: none;
}

.welcome-glow-primary {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -100px;
    left: -100px;
}

.welcome-glow-secondary {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: 100px;
    right: 200px;
}

.welcome-copy {
    position: relative;
}

.welcome-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-light);
    margin-bottom: 16px;
}

.welcome-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 16px;
    max-width: 540px;
}

.welcome-sub {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 520px;
}

.welcome-sub strong {
    color: var(--text);
    font-weight: 600;
}

.welcome-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.welcome-pill {
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.welcome-action-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Spotlight / Recommendation Panel */
.welcome-spotlight {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.welcome-spotlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #3b82f6);
}

.spotlight-kicker {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b5cf6;
    margin-bottom: 12px;
}

.welcome-spotlight h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.spotlight-copy {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.spotlight-points {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.spotlight-point {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spotlight-point strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.spotlight-point span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.spotlight-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Welcome Section Head */
.welcome-section-head {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.welcome-section-head span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.welcome-section-head p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Chip Grid and Inline Chips */
.chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.chip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.chip:hover {
    background: var(--bg-input);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.chip-inline {
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
}

.chip-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    color: var(--accent);
}

.chip-inline .chip-icon {
    width: 28px;
    height: 28px;
}

.chip-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chip-copy strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.chip-copy small {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive Welcome */
@media (max-width: 1024px) {
    .welcome-shell {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .welcome-spotlight {
        order: -1;
    }

    .welcome-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 640px) {
    .welcome {
        padding: 24px 16px;
    }

    .welcome-title {
        font-size: 1.5rem;
    }

    .welcome-sub {
        font-size: 1rem;
    }

    .chips-grid {
        grid-template-columns: 1fr;
    }

    .chip {
        padding: 12px;
    }
}

/* Agent Indicator */
.agent-indicator {
    position: fixed;
    bottom: calc(var(--input-height) + 20px);
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 500px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 90;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.agent-indicator.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.agent-indicator.active {
    animation: agentPulse 2s ease-in-out infinite;
}

@keyframes agentPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
}

.agent-pulse {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.agent-status {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
}

.agent-cancel {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.agent-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
}

.agent-progress {
    height: 3px;
    background: var(--border);
    overflow: hidden;
}

.agent-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    transition: width 0.5s ease;
}

.agent-steps {
    max-height: 200px;
    overflow-y: auto;
    padding: 12px 16px;
}

.agent-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    animation: stepIn 0.3s ease;
}

.agent-step:last-child {
    border-bottom: none;
}

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

.agent-step-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.agent-step-text {
    flex: 1;
    line-height: 1.4;
}

.agent-step-tool_call .agent-step-icon {
    color: var(--accent);
}

.agent-step-complete .agent-step-icon,
.agent-step-tool_result .agent-step-icon {
    color: var(--success);
}

.agent-step-error .agent-step-icon {
    color: var(--error);
}

/* Agent Result Styling */
.agent-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.agent-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.agent-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Agent mode in sidebar */
.nav-item[data-mode="agent"] {
    position: relative;
}

.nav-item[data-mode="agent"]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-light));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-item[data-mode="agent"].active::before {
    opacity: 1;
}

/* Agent Message Styling */
.agent-message .msg-bubble {
    border-left: 3px solid var(--accent);
}

.msg-mode {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    margin-left: 8px;
}

/* Model badge - agent variant */
.model-badge.agent {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .agent-indicator {
        bottom: calc(var(--input-height) + 10px);
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        transform: none;
    }

    .agent-indicator.hidden {
        transform: translateY(20px);
    }

    .agent-steps {
        max-height: 150px;
    }
}

/* ============================================================
   APP SHELL POLISH
   Rebuilds the missing UI layer for the welcome screen, controls,
   layout responsiveness, and product-facing sections.
   ============================================================ */

:root {
    --font-body: 'Manrope', 'Inter', sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --accent-warm: #ff7a3d;
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.28);
}

body {
    font-family: var(--font-body);
    background:
        radial-gradient(circle at top left, rgba(255, 122, 61, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0)),
        var(--bg);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.3), transparent 82%);
    pointer-events: none;
    opacity: 0.5;
}

[data-theme="light"] body {
    background:
        radial-gradient(circle at top left, rgba(255, 122, 61, 0.14), transparent 28%),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(248, 250, 252, 0.9)),
        var(--bg);
}

[data-theme="light"] body::before {
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
}

.hidden {
    display: none !important;
}

.logo-text,
.topbar-label,
.welcome-title,
.welcome-section-head span,
.faq-heading,
.faq-item h3,
.welcome-spotlight h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

.sidebar,
.topbar,
.input-wrap,
.conv-history {
    backdrop-filter: blur(18px);
}

.sidebar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)), var(--bg-surface);
}

.topbar {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)), var(--bg-surface);
}

.main-area {
    background: linear-gradient(180deg, rgba(255, 122, 61, 0.05), transparent 30%);
}

.chat-inner,
.typing-row {
    max-width: 1100px;
}

.icon-btn,
.attach-btn,
.send-btn,
.action-btn,
.file-chip-remove,
.sidebar-close,
.shortcuts-close {
    appearance: none;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)), var(--bg-elevated);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.icon-btn:hover,
.icon-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(255, 122, 61, 0.35);
    color: var(--text);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 10, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 95;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1200;
    min-width: 220px;
    max-width: min(90vw, 360px);
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 122, 61, 0.22);
    background: linear-gradient(180deg, rgba(255, 122, 61, 0.14), rgba(0, 0, 0, 0)), var(--bg-surface);
    color: var(--text);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity var(--transition), transform var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.export-wrap {
    position: relative;
}

.export-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 170px;
    padding: 8px;
    display: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)), var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 100;
}

.export-menu.show {
    display: grid;
    gap: 6px;
}

.export-item {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.export-item:hover,
.export-item:focus-visible {
    background: var(--bg-elevated);
    color: var(--text);
}

.welcome {
    position: relative;
    overflow: hidden;
    margin: 24px 0 44px;
    padding: 30px;
    border-radius: 32px;
    border: 1px solid var(--border);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)), var(--bg-surface);
    box-shadow: var(--shadow-xl);
}

.welcome-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.55;
    pointer-events: none;
}

.welcome-glow-primary {
    width: 240px;
    height: 240px;
    top: -40px;
    left: -40px;
    background: rgba(255, 122, 61, 0.34);
}

.welcome-glow-secondary {
    width: 220px;
    height: 220px;
    right: 10%;
    top: 10%;
    background: rgba(59, 130, 246, 0.24);
}

.welcome-shell,
.chips-grid,
.faq-grid {
    position: relative;
    z-index: 1;
}

.welcome-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.95fr);
    gap: 24px;
    align-items: stretch;
}

.welcome-copy {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.welcome-kicker,
.spotlight-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 122, 61, 0.24);
    background: rgba(255, 122, 61, 0.12);
    color: #ffd1b8;
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

[data-theme="light"] .welcome-kicker,
[data-theme="light"] .spotlight-kicker {
    color: #8a3d18;
    background: rgba(255, 122, 61, 0.1);
}

.welcome-logo {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: white;
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.22);
}

.welcome-title {
    max-width: 12ch;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    line-height: 0.95;
    margin: 0;
}

.welcome-sub {
    max-width: 62ch;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.welcome-sub strong {
    color: var(--text);
}

.welcome-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.welcome-pill {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
}

.welcome-action-row,
.spotlight-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.welcome-spotlight {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    border-radius: 28px;
    border: 1px solid rgba(255, 122, 61, 0.22);
    background: linear-gradient(180deg, rgba(255, 122, 61, 0.14), rgba(255, 122, 61, 0.05)), var(--bg-elevated);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.welcome-spotlight h2 {
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    line-height: 1;
}

.spotlight-copy {
    color: var(--text-secondary);
    line-height: 1.6;
}

.spotlight-points {
    display: grid;
    gap: 12px;
}

.spotlight-point {
    padding: 14px 15px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(13, 15, 20, 0.16);
}

[data-theme="light"] .spotlight-point {
    background: rgba(255, 255, 255, 0.75);
}

.spotlight-point strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.95rem;
    color: var(--text);
}

.spotlight-point span {
    font-size: 0.87rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.welcome-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 28px 0 14px;
}

.welcome-section-head span {
    font-size: 1.15rem;
    font-weight: 700;
}

.welcome-section-head p {
    max-width: 42ch;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

.chips-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.chip {
    width: 100%;
    min-height: 94px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)), var(--bg-elevated);
    color: var(--text);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.chip:hover,
.chip:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(255, 122, 61, 0.35);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.16);
}

.chip-inline {
    min-height: 82px;
    flex: 1 1 280px;
}

.chip-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 122, 61, 0.12);
    border: 1px solid rgba(255, 122, 61, 0.18);
    color: var(--accent-warm);
}

.chip-copy {
    display: grid;
    gap: 4px;
}

.chip-copy strong {
    font-size: 0.96rem;
    line-height: 1.35;
}

.chip-copy small {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.chip-agent {
    background: linear-gradient(160deg, rgba(255, 122, 61, 0.14), rgba(59, 130, 246, 0.08)), var(--bg-elevated);
    border-color: rgba(255, 122, 61, 0.24);
}

.chip-agent:hover,
.chip-agent:focus-visible {
    background: linear-gradient(160deg, rgba(255, 122, 61, 0.2), rgba(59, 130, 246, 0.1)), var(--bg-elevated);
    border-color: rgba(255, 122, 61, 0.35);
}

.chip-agent .chip-icon {
    color: #ffb58d;
    background: rgba(255, 122, 61, 0.2);
    border-color: rgba(255, 122, 61, 0.28);
}

.input-wrap {
    position: sticky;
    bottom: 0;
    z-index: 60;
    padding: 16px 20px 20px;
    background: linear-gradient(180deg, rgba(13, 15, 20, 0), rgba(13, 15, 20, 0.2) 12%, var(--bg-surface) 32%);
}

.file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.file-chip-thumb {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    object-fit: cover;
}

.file-chip-icon {
    font-size: 0.95rem;
}

.file-chip-name {
    color: var(--text);
    font-weight: 600;
}

.file-chip-size {
    color: var(--text-muted);
}

.file-chip-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    transition: background var(--transition), color var(--transition);
}

.file-chip-remove:hover,
.file-chip-remove:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.input-shell {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 14px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)), var(--bg-elevated);
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.16);
}

.file-input-hidden {
    display: none;
}

.attach-btn,
.send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.attach-btn {
    width: 46px;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.attach-btn:hover,
.attach-btn:focus-visible {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(255, 122, 61, 0.28);
}

.input-field {
    flex: 1;
    min-height: 48px;
    max-height: 180px;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    line-height: 1.6;
    resize: none;
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:focus {
    outline: none;
}

.input-actions {
    display: flex;
    align-items: center;
}

.send-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: white;
    box-shadow: 0 18px 32px rgba(59, 130, 246, 0.28);
}

.send-btn:hover,
.send-btn:focus-visible {
    transform: translateY(-1px) scale(1.01);
    filter: saturate(1.05);
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.char-count {
    font-variant-numeric: tabular-nums;
}

.char-count.warn {
    color: var(--warning);
}

.char-count.limit {
    color: var(--error);
}

.msg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.msg-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.action-btn:hover,
.action-btn:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 122, 61, 0.3);
}

.user-message .msg-bubble,
.ai-message .msg-bubble {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid var(--border);
}

.ai-message .msg-bubble {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)), var(--bg-surface);
}

.user-message .msg-bubble {
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.12), rgba(255, 122, 61, 0.08)), var(--bg-elevated);
}

.msg-file-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.msg-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.msg-file-thumb {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    object-fit: cover;
}

.scroll-btn {
    position: fixed;
    right: 24px;
    bottom: 122px;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 32px rgba(59, 130, 246, 0.28);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity var(--transition), transform var(--transition);
    z-index: 85;
}

.scroll-btn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.faq-section {
    padding: 12px 20px 60px;
}

.faq-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.faq-heading {
    margin-bottom: 18px;
    font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.faq-item {
    padding: 22px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)), var(--bg-surface);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.1);
}

.faq-item h3 {
    margin-bottom: 10px;
    font-size: 1.05rem;
    line-height: 1.3;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

@media (max-width: 1080px) {
    .welcome-shell {
        grid-template-columns: 1fr;
    }

    .chips-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .faq-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: min(88vw, 320px);
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar-menu,
    .sidebar-close {
        display: inline-flex;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
        z-index: 110;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-area {
        margin-left: 0;
    }

    .topbar-center {
        position: static;
        left: auto;
        transform: none;
        flex: 1;
        min-width: 0;
        justify-content: center;
        margin-left: 8px;
    }

    .topbar-label {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mode-badge {
        display: none !important;
    }

    .chat-scroll {
        padding: 18px 0;
    }

    .chat-inner {
        padding: 0 14px;
    }

    .welcome {
        margin-top: 12px;
        padding: 22px 18px;
        border-radius: 28px;
    }

    .welcome-title {
        max-width: none;
        font-size: clamp(2.1rem, 11vw, 3rem);
    }

    .welcome-section-head,
    .input-footer,
    .msg-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .chips-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }

    .input-wrap,
    .faq-section {
        padding-left: 14px;
        padding-right: 14px;
    }

    .input-shell {
        padding: 12px;
        border-radius: 20px;
    }

    .attach-btn,
    .send-btn {
        width: 44px;
        height: 44px;
    }

    .scroll-btn {
        right: 16px;
        bottom: 108px;
    }

    .toast {
        top: 14px;
        right: 14px;
        left: 14px;
        max-width: none;
    }
}

@media (max-width: 520px) {
    .topbar-actions {
        gap: 6px;
    }

    .topbar-actions .icon-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .welcome-kicker,
    .spotlight-kicker {
        font-size: 0.7rem;
    }

    .chip,
    .chip-inline {
        min-height: 80px;
        padding: 14px 15px;
    }
}
