/* ============================================
   Universal Odoo Copilot - Light Theme
   Clean, modern, professional design
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* English Modern Palette */
    --bg-primary: #ffffff;
    --bg-secondary: #fdfdfd;
    /* Subtler off-white */
    --bg-tertiary: #f3f4f6;
    /* Cool gray */
    --text-primary: #1f2937;
    /* Charcoal, not black */
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;

    /* Oxford / Royal Theme */
    --accent: #2A4B7C;
    /* Oxford Blue */
    --accent-hover: #1e3a63;
    --accent-light: #e6ebf4;
    /* For backgrounds */

    /* Nature-inspired Status Colors */
    --success: #059669;
    /* Emerald */
    --error: #dc2626;
    /* Crimson */
    --warning: #d97706;
    /* Amber */

    --radius: 10px;
    /* Slightly softer */
    --radius-lg: 16px;

    /* Modern Diffused Shadow */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smoother */
}

/* Dark Theme - Midnight & Gunmetal */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    /* Midnight */
    --bg-secondary: #1e293b;
    /* Gunmetal */
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;

    --accent: #3b82f6;
    /* Bright royal blue for dark mode contrast */
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.1);

    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
}

.o_copilot_body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

/* App Layout */
.copilot-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 280px;
    /* Slightly wider for better readability */
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 0;
    flex-shrink: 0;
    height: 100vh;
    box-shadow: 1px 0 10px rgba(0, 0, 0, 0.02);
    /* Subtle depth */
}

/* Checkpoint: Sidebar modernized */
.sidebar-top {
    padding: 12px 12px 4px;
    flex-shrink: 0;
}

/* Chat Session List (Scrollable middle) */
.sidebar-main {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
}

/* Scrollbar for sidebar middle */
.sidebar-main::-webkit-scrollbar {
    width: 4px;
}

.sidebar-main::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

/* Sidebar Footer (Fixed Bottom Servers) */
.sidebar-footer {
    padding: 0;
    margin-top: auto;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    margin-bottom: 16px;
}

.new-chat-btn:hover {
    background: var(--accent-hover);
}

/* Chat Search */
.chat-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.chat-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.chat-search-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    transition: var(--transition);
}

.chat-search-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
}

.chat-search-wrapper input::placeholder {
    color: var(--text-muted);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Collapsible Sidebar Section */
.collapsible .section-header {
    cursor: pointer;
    margin-bottom: 0;
    padding: 14px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.collapsible .section-header:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.collapsible .connection-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s;
    background: var(--bg-primary);
}

.collapsible.expanded .connection-list {
    max-height: 400px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-color);
    overflow-y: auto;
}

.toggle-sidebar-section {
    transition: transform 0.3s;
}

.collapsible.expanded .toggle-sidebar-section {
    transform: rotate(180deg);
}

.collapsed .connection-list {
    display: none;
}

/* Chat List */
.chat-list,
.connection-list {
    list-style: none;
    padding: 0;
    margin: 0;
}


/* Chat Items (New Layout) */
.chat-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    border-radius: var(--radius);
    margin-bottom: 2px;
}

.chat-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.chat-item-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item-top i {
    font-size: 14px;
    min-width: 16px;
    text-align: center;
    opacity: 0.7;
}

.chat-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 28px;
    /* Align under text */
}

/* Connection Items */
.connection-item {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    transition: var(--transition);
    color: var(--text-secondary);
}

.chat-item:hover,
.connection-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-item.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.connection-item i {
    font-size: 14px;
}

.connection-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Connection Items - Compact */
.connection-item {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    margin-bottom: 2px;
}

.connection-item.active {
    background: rgba(13, 110, 253, 0.1);
    border-left: 3px solid var(--accent);
    color: var(--text-primary);
}

.connection-item.active .conn-status {
    box-shadow: 0 0 4px var(--success);
}

.conn-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.conn-status.connected {
    background: var(--success);
    box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
}

.conn-status.error {
    background: var(--error);
}

.conn-name {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-icon-sm {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
    opacity: 0;
}

.connection-item:hover .btn-icon-sm,
.section-header .btn-icon-sm {
    opacity: 1;
}

.btn-icon-sm:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-delete:hover {
    color: var(--error) !important;
}

.empty-item {
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Chat Header */
.chat-header {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    z-index: 5;
}

/* Header Actions - Flexbox row */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Server Selector in Header */
.server-selector-wrapper {
    position: relative;
}

.server-selector {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 32px 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    min-width: 160px;
    max-width: 200px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s ease;
}

.server-selector:hover {
    border-color: var(--accent);
}

.server-selector:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(42, 75, 124, 0.15);
}

/* Header Button (Theme, Settings, Voice, Keyboard) */
.header-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* Keyboard Shortcuts Modal */
.keyboard-shortcuts-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.keyboard-shortcuts-modal.hidden {
    display: none;
}

.ks-modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 360px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.ks-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.ks-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ks-modal-header h3 i {
    color: var(--accent);
}

.ks-modal-header .close-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.ks-modal-header .close-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.ks-modal-body {
    padding: 16px 20px;
}

.ks-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.ks-item kbd {
    min-width: 60px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    text-align: center;
    font-family: 'Inter', sans-serif;
}

.ks-item span {
    color: var(--text-primary);
    font-size: 14px;
}

/* Remove dropdown space if header actions empty */
.header-actions:empty {
    display: none;
}

.header-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.header-title i {
    color: var(--accent);
}

.connection-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 32px 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    min-width: 180px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s ease;
}

.connection-select:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-muted);
}

.connection-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.1);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    max-width: 500px;
    margin: auto;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: white;
}

.welcome-message h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
}

.welcome-message p {
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-size: 14px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.quick-action {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.quick-action:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    max-width: 90%;
    margin-bottom: 16px;
    animation: fadeIn 0.2s ease;
}

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

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

/* Message Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.message-avatar.user {
    background: var(--accent);
    color: white;
}

.message-avatar.ai,
.message-avatar.assistant {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.message-avatar.error {
    background: #ef4444;
    color: white;
}

/* Message Wrapper */
.message-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* Message Actions (Copy, Regenerate, Edit) */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.msg-action-btn {
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s ease;
}

.msg-action-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

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

/* Message Header (sender + time) */
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}

.message-sender {
    font-weight: 600;
    color: var(--text-primary);
}

.message-time {
    color: var(--text-muted);
}

/* Message Content */
.message-content {
    background: var(--bg-primary);
    /* Use primary bg (white/midnight) for crispness */
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    font-size: 14.5px;
    /* Slightly larger for readability */
    line-height: 1.6;
    box-shadow: var(--shadow);
}

.user-message .message-content {
    background: var(--accent);
    color: white;
    border: 1px solid var(--accent);
    /* Subtle definition */
    box-shadow: var(--shadow-lg);
}

.error-message .message-content {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.message p {
    margin: 0;
}

.message p+p {
    margin-top: 8px;
}

.message ul,
.message ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message li {
    margin: 4px 0;
}

.message pre {
    background: #f1f3f5;
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 12px 0;
    font-size: 13px;
}

.message code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Message Metadata (Sender + Timestamp) */
.message-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.message-sender {
    font-weight: 600;
    color: var(--text-primary);
}

.user-message .message-sender {
    color: rgba(255, 255, 255, 0.9);
}

.message-time {
    color: var(--text-muted);
    font-size: 11px;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-body {
    line-height: 1.6;
}

/* Tool Status Indicators */
.tool-status {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin: 10px 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.tool-status.running {
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
}

.tool-status.success {
    border-left: 4px solid #22c55e;
    background: #f0fdf4;
}

.tool-status.error {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

.tool-status.warning {
    border-left: 4px solid #f97316;
    background: #fff7ed;
}

.tool-status-header {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.tool-status-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.tool-args {
    padding: 8px 14px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border-color);
}

.tool-results {
    padding: 12px 14px;
    background: white;
    border-top: 1px solid var(--border-color);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Thinking Block */
.thinking-block {
    margin: 10px 0;
    border: 1px solid #e0e7ff;
    border-radius: var(--radius);
    background: #f5f7ff;
    overflow: hidden;
}

.thinking-block summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.thinking-block summary::-webkit-details-marker {
    display: none;
}

.thinking-block summary:hover {
    background: rgba(99, 102, 241, 0.05);
}

.thinking-content {
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text-muted);
    border-top: 1px solid #eef2ff;
    background: #fcfdfe;
    line-height: 1.6;
    font-style: normal;
    font-family: 'Inter', sans-serif;
}

/* Pagination Controls */
.a2ui-pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
}

.a2ui-pagination-controls button {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.a2ui-pagination-controls button:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.a2ui-pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.a2ui-pagination-controls span {
    font-weight: 500;
    color: var(--text-secondary);
}

/* File Preview */
.file-preview {
    padding: 8px 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-preview:empty {
    display: none;
}

.file-chip {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-chip .file-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.file-chip .remove-file {
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.file-chip .remove-file:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Message File Attachments */
.message-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.file-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.file-tag i {
    font-size: 10px;
}

/* Input Area */
.input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: var(--transition);
}

.input-container:focus-within {
    border-color: var(--accent);
}

.input-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: var(--transition);
    flex-shrink: 0;
}

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

.input-btn.recording {
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

.input-btn.stop-mode {
    color: #ef4444;
    border-color: #ef4444;
    background: #fef2f2;
}

.input-btn.stop-mode:hover {
    background: #fee2e2;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 8px;
    max-height: 120px;
    min-height: 20px;
    font-family: inherit;
}

#chatInput::placeholder {
    color: var(--text-muted);
}

#chatInput:focus {
    outline: none;
}

.send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-hover);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#connectionForm {
    padding: 20px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-row input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
}

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

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

/* Form Section Divider */
.form-section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-section-divider::before,
.form-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* Permission Row */
.permission-row {
    margin-bottom: 10px;
}

.permission-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.permission-label:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.permission-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.permission-label i {
    font-size: 16px;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.permission-label:has(input:checked) i {
    color: var(--accent);
}

.permission-label span {
    font-weight: 500;
    color: var(--text-primary);
    flex-shrink: 0;
}

.permission-label small {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-cancel:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-submit {
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-submit:hover {
    background: var(--accent-hover);
}

/* Loading */
.loading-dots {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 8px;
    }

    .new-chat-btn span,
    .sidebar-section h4,
    .conn-name,
    .chat-item span {
        display: none;
    }

    .new-chat-btn {
        padding: 10px;
    }

    .chat-item,
    .connection-item {
        justify-content: center;
        padding: 10px;
    }
}

/* ============================================
   A2UI Component Styles
   ============================================ */

.a2ui-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Chart */
.a2ui-chart {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 16px;
    max-width: 100%;
}

.a2ui-chart canvas {
    max-height: 300px;
}

/* DataTable */
.a2ui-datatable {
    width: 100%;
    overflow-x: auto;
}

.a2ui-search {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.data-table th:hover {
    color: var(--accent);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* Metric Card */
.a2ui-metric-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.metric-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.trend {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    display: inline-block;
}

.trend-up {
    color: var(--success);
}

.trend-up::before {
    content: '↑ ';
}

.trend-down {
    color: var(--error);
}

.trend-down::before {
    content: '↓ ';
}

/* Metric Grid */
.a2ui-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

/* Alert */
.a2ui-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.a2ui-alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid var(--accent);
    color: #93c5fd;
}

.a2ui-alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--success);
    color: #86efac;
}

.a2ui-alert-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid #f59e0b;
    color: #fcd34d;
}

.a2ui-alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--error);
    color: #fca5a5;
}

/* Card */
.a2ui-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.a2ui-card .card-header {
    padding: 12px 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.a2ui-card .card-body {
    padding: 16px;
    color: var(--text-secondary);
}

.a2ui-card .card-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

.card-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.card-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Button Group */
.a2ui-button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.a2ui-btn {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.a2ui-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.a2ui-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.a2ui-btn.primary:hover {
    background: var(--accent-hover);
}

/* Code Block */
.a2ui-code {
    background: #f1f3f5;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
}

.a2ui-code code {
    background: none;
    padding: 0;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e5e5e5;
}

/* ============================================
   Model Selector - Premium Dropdown
   ============================================ */

.model-selector-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-tertiary));
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 36px 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 200px;
    max-width: 280px;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 8.5L1.5 4h9L6 8.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.model-select:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    box-shadow: 0 2px 6px rgba(13, 110, 253, 0.15);
}

.model-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.model-select option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
}

.model-select option:hover,
.model-select option:focus,
.model-select option:checked {
    background: var(--accent);
    color: white;
}

/* Model icon indicator */
.model-selector-container::before {
    content: '🤖';
    font-size: 16px;
    margin-right: 4px;
}

/* Header actions layout improvement */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive model selector */
@media (max-width: 768px) {
    .model-select {
        min-width: 120px;
        max-width: 150px;
        font-size: 12px;
        padding: 6px 28px 6px 8px;
    }

    .model-selector-container::before {
        display: none;
    }

    .model-selector-label {
        display: none;
    }
}

/* ============================================
   Account Selector - Google OAuth
   ============================================ */

.account-selector-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.account-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(135deg, #fff8e1, #fffde7);
    border: 1px solid #ffc107;
    border-radius: var(--radius);
    padding: 6px 28px 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 140px;
    max-width: 180px;
    transition: var(--transition);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffc107' d='M6 8.5L1.5 4h9L6 8.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    font-family: inherit;
}

.account-select:hover {
    border-color: #ff9800;
    box-shadow: 0 2px 6px rgba(255, 152, 0, 0.2);
}

.account-select:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.15);
}

/* Message Queue UI */

.message-queue-container {
    padding: 10px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: none;
    /* Hidden by default */
    max-height: 150px;
    overflow-y: auto;
}

.message-queue-container.has-items {
    display: block;
    animation: slideUp 0.3s ease;
}

.queue-header {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.queue-item:hover {
    border-color: var(--accent);
}

.queue-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
    color: var(--text-primary);
}

.queue-item-remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.queue-item-remove:hover {
    background: #fee2e2;
    color: #ef4444;
}

@keyframes slideUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

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

/* Typing Indicator */
.typing-indicator {
    display: inline-block;
}

.typing-indicator::after {
    content: '...';
    animation: typing 1.5s steps(4, end) infinite;
    display: inline-block;
    width: 0;
    overflow: hidden;
    vertical-align: bottom;
}

@keyframes typing {
    to {
        width: 1.25em;
    }
}

.connect-account-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #4285f4;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.connect-account-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.4);
}

.connect-account-btn:active {
    transform: scale(0.98);
}

/* Responsive account selector */
@media (max-width: 768px) {
    .account-select {
        min-width: 100px;
        max-width: 120px;
        font-size: 11px;
        padding: 4px 24px 4px 6px;
    }

    .connect-account-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* User Message Alignment */
.message.user-message {
    align-self: flex-end;
}

.message.user-message .message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Stop Mode Button */
.send-btn.stop-mode {
    background: #ef4444;
}

.send-btn.stop-mode:hover {
    background: #dc2626;
}

/* ===================== @MENTION AUTOCOMPLETE ===================== */
.mention-dropdown {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
}

.mention-item:hover,
.mention-item.active {
    background: var(--bg-tertiary);
}

.mention-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.mention-status.connected {
    background: var(--success);
}

.mention-name {
    font-weight: 500;
    color: var(--text-primary);
}

.mention-db {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* ===================== TOOL APPROVAL UI ===================== */
.tool-approval-prompt {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--radius);
    padding: 12px;
    margin: 8px 0;
}

.approval-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
}

.approval-header i {
    font-size: 18px;
}

.approval-details {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 12px;
    max-height: 150px;
    overflow-y: auto;
}

.approval-details pre {
    margin: 0;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-all;
}

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

.btn-approve,
.btn-deny {
    padding: 6px 16px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-approve {
    background: var(--success);
    color: white;
}

.btn-approve:hover {
    background: #157347;
}

.btn-deny {
    background: var(--error);
    color: white;
}

.btn-deny:hover {
    background: #bb2d3b;
}

.tool-approval-prompt.approved {
    opacity: 0.7;
}

.tool-approval-prompt.denied {
    opacity: 0.5;
}

/* ===================== HEADER BUTTONS ===================== */
.header-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--accent);
    color: white;
}

/* ===================== SETTINGS MODAL ===================== */
.settings-modal {
    max-width: 400px;
}

.settings-body {
    padding: 16px;
}

.settings-group {
    margin-bottom: 16px;
}

.settings-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.settings-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.theme-options {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.theme-option:hover {
    border-color: var(--accent);
}

.theme-option.active {
    border-color: var(--accent);
    background: rgba(13, 110, 253, 0.1);
    color: var(--accent);
}

.theme-option i {
    font-size: 20px;
}

.settings-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.btn-save-settings {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-save-settings:hover {
    background: var(--accent-hover);
}

/* Token Stats Container */
.token-stats-container,
.audit-stats-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.token-stat {
    flex: 1;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-refresh-stats {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-refresh-stats:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

.btn-refresh-stats.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Model/Tool Breakdown Lists */
.token-model-breakdown,
.audit-top-tools {
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 4px;
    margin-bottom: 4px;
    background: var(--bg-tertiary);
}

.breakdown-item .item-name {
    color: var(--text-primary);
    font-weight: 500;
}

.breakdown-item .item-value {
    color: var(--text-muted);
}

.breakdown-item .item-tokens {
    color: var(--accent);
    font-weight: 600;
}

/* Settings modal scrollable body */
.settings-modal .settings-body {
    max-height: 400px;
    overflow-y: auto;
}

/* Schema Scan Section */
.schema-scan-container {
    margin-top: 8px;
}

.scan-info {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.btn-scan-schema {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    justify-content: center;
    transition: var(--transition);
}

.btn-scan-schema:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-scan-schema.loading i {
    animation: spin 1s linear infinite;
}

.btn-scan-schema.success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* A2UI Action Engine Styles */
.clickable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.a2ui-chart.clickable:hover canvas {
    /* Subtle hint for charts */
    opacity: 0.9;
}

/* A2UI Small Buttons for Tables */
.a2ui-btn-small {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.a2ui-btn-small:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.a2ui-btn-small.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.a2ui-btn-small.btn-primary:hover {
    filter: brightness(1.1);
}

.a2ui-btn-small.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.a2ui-btn-small.btn-danger:hover {
    filter: brightness(1.1);
}

/* A2UI Input Components */
.a2ui-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.a2ui-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.a2ui-input-wrapper label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.a2ui-input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.a2ui-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

/* A2UI Commerce Components */

/* Product Card */
.a2ui-product-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
    width: 200px;
    /* Fixed width for standard card, responsive in grid */
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.a2ui-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #f0f0f0;
}

.product-content {
    padding: 12px;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.product-actions {
    display: flex;
}

.a2ui-btn-primary {
    flex: 1;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: filter 0.2s;
}

.a2ui-btn-primary:hover {
    filter: brightness(1.1);
}

/* Carousel */
.a2ui-carousel-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 4px;
    margin-bottom: 16px;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: thin;
}

.a2ui-carousel-track {
    display: flex;
    gap: 16px;
}

.a2ui-carousel-track .carousel-item {
    /* Ensure items don't shrink */
    flex-shrink: 0;
}

/* Offer Banner */
.a2ui-offer-banner {
    position: relative;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.offer-text {
    font-size: 14px;
}

.offer-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    transition: background 0.2s;
}

.offer-code:hover {
    background: rgba(255, 255, 255, 0.3);
}

.offer-close {
    position: absolute;
    top: 4px;
    right: 8px;
    cursor: pointer;
    opacity: 0.7;
    font-size: 18px;
}

.offer-close:hover {
    opacity: 1;
}

/* A2UI V6: Persistence & Smart Forms */

/* Pin Button */
.a2ui-pin-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
    /* Hidden by default */
}

/* Show on hover of container */
.a2ui-chart:hover .a2ui-pin-btn,
.a2ui-metric-card:hover .a2ui-pin-btn,
.a2ui-product-card:hover .a2ui-pin-btn,
.a2ui-smart-form:hover .a2ui-pin-btn {
    opacity: 1;
}

.a2ui-pin-btn:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
    transform: scale(1.1);
}

.a2ui-pin-btn.saved {
    background: #dcfce7;
    color: #16a34a;
    border-color: #16a34a;
    opacity: 1;
}

/* Smart Form */
.a2ui-smart-form {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    width: 100%;
    max-width: 400px;
}

.a2ui-smart-form h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.full-width {
    width: 100%;
}

/* A2UI V7: Rich Information Components */

/* Profile Card */
.a2ui-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-primary);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 260px;
    text-align: center;
}

.profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 12px;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    width: 100%;
    justify-content: space-around;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.stat-val {
    font-weight: 700;
    font-size: 14px;
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Kanban Card */
.a2ui-kanban-card {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    /* Default status color */
    margin-bottom: 8px;
}

.kanban-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.kanban-title {
    font-weight: 600;
    font-size: 14px;
}

.kanban-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-hover);
}

.kanban-meta {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.kanban-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* Timeline */
.a2ui-timeline {
    padding-left: 12px;
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
    padding-left: 24px;
    border-left: 2px solid var(--border-color);
}

.timeline-item:last-child {
    border-left: 2px solid transparent;
}

.timeline-icon {
    position: absolute;
    left: -7px;
    top: 0;
    background: var(--bg-primary);
    color: var(--primary-color);
    font-size: 10px;
    width: 12px;
    text-align: center;
}

.timeline-date {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

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

/* Progress Ring */
.a2ui-progress-ring {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a2ui-progress-ring svg {
    transform: rotate(0deg);
    /* Initial rotation handled in markup */
}

.a2ui-progress-ring circle {
    transition: stroke-dashoffset 0.5s ease-in-out;
}

.progress-label {
    position: absolute;
    text-align: center;
}

.progress-val {
    font-size: 18px;
    font-weight: 700;
}

.progress-txt {
    font-size: 10px;
    color: var(--text-muted);
}

/* A2UI V8: Planning Components */

/* Gantt Chart */
.a2ui-gantt {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
}

.a2ui-gantt h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
}

.gantt-track {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gantt-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gantt-label {
    width: 120px;
    font-size: 12px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    text-align: right;
    font-weight: 500;
}

.gantt-bar-container {
    flex: 1;
    position: relative;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    /* Clips the bar if calc goes wild */
}

.gantt-bar {
    position: absolute;
    top: 4px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 6px;
    min-width: 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.gantt-bar:hover {
    opacity: 0.8;
}

.gantt-progress {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px 0 0 6px;
}

.gantt-footer {
    margin-top: 8px;
    text-align: right;
    font-size: 10px;
    color: var(--text-muted);
}

/* A2UI V12: Funnel Chart */
.a2ui-funnel {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 100%;
    margin-top: 10px;
}

.a2ui-funnel h4 {
    margin: 0 0 16px 0;
    text-align: center;
}

.funnel-stage {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.funnel-bar-box {
    width: 100%;
    display: flex;
    justify-content: center;
}

.funnel-bar {
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 500;
    transition: width 0.5s ease;
    white-space: nowrap;
    overflow: hidden;
    padding: 0 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* A2UI V13: Action Cards */
.a2ui-action-card {
    border-left: 4px solid var(--accent-color);
}

.action-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.action-icon {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 18px;
}

.action-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
}

.action-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.a2ui-btn-primary {
    background: var(--accent-color);
    color: white;
}

.a2ui-btn-danger {
    background: #ef4444;
    color: white;
}

.a2ui-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* ===================== VOICE OVERLAY STYLES ===================== */
.voice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.voice-overlay.active {
    opacity: 1;
    visibility: visible;
}

.voice-overlay #voice-canvas {
    width: 100%;
    max-width: 400px;
    height: 300px;
}

.voice-transcript {
    color: white;
    font-size: 24px;
    text-align: center;
    padding: 20px;
    max-width: 80%;
    margin-top: 20px;
    font-family: 'Inter', sans-serif;
    min-height: 60px;
}

.voice-controls {
    margin-top: 30px;
}

.voice-btn-close {
    background: #ef4444;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: background 0.2s ease;
}

.voice-btn-close:hover {
    background: #dc2626;
}

.voice-btn-close i {
    margin-right: 8px;
}

/* ===================== AUTH OVERLAY ===================== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.auth-overlay.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.auth-modal {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, #333);
}

.auth-tab {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.auth-tab:hover {
    color: var(--text-primary, #fff);
}

.auth-tab.active {
    color: var(--primary-color, #6366f1);
    border-bottom-color: var(--primary-color, #6366f1);
}

.auth-form {
    display: none;
    padding: 32px;
}

.auth-form.active {
    display: block;
}

.auth-form .auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-form .auth-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary-color, #6366f1), #8b5cf6);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.auth-form h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin: 0 0 4px;
}

.auth-form .auth-header p {
    font-size: 14px;
    color: var(--text-secondary, #888);
    margin: 0;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #fff);
    margin-bottom: 6px;
}

.auth-form .input-wrapper {
    position: relative;
}

.auth-form .input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #888);
    font-size: 14px;
}

.auth-form .input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary, #fff);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form .input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-form .input-wrapper input::placeholder {
    color: var(--text-secondary, #666);
}

.auth-form .auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    margin-top: 8px;
    background: var(--primary-color, #6366f1);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.auth-form .auth-btn:hover {
    background: #818cf8;
    transform: translateY(-1px);
}

.auth-form .auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.auth-alert {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.auth-alert.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Blur main content when auth overlay is shown */
.copilot-app.blurred {
    filter: blur(8px);
    pointer-events: none;
}

/* ===================== COMMAND PALETTE ===================== */
.command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 10001;
    animation: fadeIn 0.15s ease;
}

.command-palette.hidden {
    display: none !important;
}

.command-modal {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideDown 0.15s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.command-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #333);
}

.command-header i {
    color: var(--text-secondary, #888);
    font-size: 14px;
}

.command-header input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 15px;
    color: var(--text-primary, #fff);
    outline: none;
}

.command-header input::placeholder {
    color: var(--text-secondary, #666);
}

.command-header kbd {
    padding: 4px 8px;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary, #888);
    font-family: inherit;
}

.command-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.command-group {
    margin-bottom: 8px;
}

.command-group-title {
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
    text-align: left;
}

.command-item:hover,
.command-item.selected {
    background: var(--bg-hover, #2a2a2a);
}

.command-item i {
    width: 20px;
    text-align: center;
    color: var(--primary-color, #6366f1);
    font-size: 14px;
}

.command-item span {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary, #fff);
}

.command-item kbd {
    padding: 3px 6px;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    font-size: 10px;
    color: var(--text-secondary, #888);
    font-family: inherit;
}

.command-footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--border-color, #333);
    background: var(--bg-primary, #0d0d0d);
}

.command-footer span {
    font-size: 11px;
    color: var(--text-secondary, #888);
    display: flex;
    align-items: center;
    gap: 6px;
}

.command-footer kbd {
    padding: 2px 5px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 3px;
    font-size: 10px;
}

/* ===================== KEYBOARD HINTS ===================== */
.keyboard-hints {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.hint-toggle {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 10px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hint-toggle:hover {
    background: var(--bg-hover, #2a2a2a);
    color: var(--text-primary, #fff);
}

.hint-panel {
    position: absolute;
    bottom: 50px;
    right: 0;
    width: 200px;
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.hint-panel.hidden {
    display: none;
}

.hint-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-primary, #fff);
}

.hint-item kbd {
    min-width: 50px;
    padding: 3px 6px;
    background: var(--bg-primary, #0d0d0d);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    font-size: 11px;
    color: var(--primary-color, #6366f1);
    font-family: inherit;
    text-align: center;
}

/* ============================================
   Dashboard Metrics Header
   ============================================ */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}

.metric-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.metric-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent);
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.metric-trend {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-trend.up {
    color: var(--success);
}

.metric-trend.down {
    color: var(--error);
}

/* Usage Progress Bar */
.usage-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin: 12px 16px;
}

.usage-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.usage-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-bar-fill.warning {
    background: var(--warning);
}

.usage-bar-fill.danger {
    background: var(--error);
}

.usage-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    text-align: right;
}

/* ============================================
   Comprehensive Mobile Responsiveness
   ============================================ */

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .copilot-sidebar {
        width: 280px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .dashboard-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {

    /* Hide sidebar on mobile, show as overlay */
    .copilot-container {
        flex-direction: column;
    }

    .copilot-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
    }

    .copilot-sidebar.open {
        left: 0;
    }

    /* Mobile overlay when sidebar open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Mobile header with hamburger */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-menu-btn {
        width: 40px;
        height: 40px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: var(--text-primary);
        cursor: pointer;
    }

    /* Dashboard metrics stack on mobile */
    .dashboard-metrics {
        grid-template-columns: 1fr 1fr;
        padding: 12px;
        gap: 10px;
    }

    .metric-card {
        padding: 12px;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .metric-value {
        font-size: 18px;
    }

    /* Chat input touch-friendly */
    .chat-input-container {
        padding: 12px;
    }

    .chat-input {
        min-height: 48px;
        font-size: 16px;
        /* Prevents iOS zoom */
        padding: 14px 16px;
    }

    .send-btn {
        width: 48px;
        height: 48px;
    }

    /* Messages full width on mobile */
    .message {
        max-width: 95%;
    }

    .message.user {
        max-width: 90%;
    }

    /* Hide keyboard hints on mobile */
    .keyboard-hints {
        display: none !important;
    }

    /* Command palette full screen on mobile */
    .command-modal {
        width: 95%;
        max-width: none;
        max-height: 80vh;
    }

    .command-item {
        padding: 14px 16px;
    }

    /* Auth overlay mobile */
    .auth-modal {
        width: 95%;
        max-width: none;
        padding: 24px;
    }

    /* A2UI components responsive */
    .a2ui-chart-container {
        height: 250px;
    }

    .a2ui-data-table {
        font-size: 12px;
    }

    .a2ui-data-table th,
    .a2ui-data-table td {
        padding: 8px 10px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-header .server-select {
        font-size: 13px;
        max-width: 140px;
    }

    .message-content {
        padding: 12px 14px;
    }

    .usage-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .usage-bar-value {
        text-align: left;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn,
    button {
        min-height: 44px;
    }

    .session-item {
        padding: 14px 16px;
    }

    /* Disable hover effects */
    .session-item:hover,
    .metric-card:hover,
    .command-item:hover {
        transform: none;
    }
}

/* Print styles */
@media print {

    .copilot-sidebar,
    .chat-input-container,
    .keyboard-hints,
    .command-palette,
    .auth-overlay {
        display: none !important;
    }

    .copilot-main {
        width: 100%;
    }

    .message-content {
        border: 1px solid #ccc;
    }
}

/* ============================================
   Voice UI - Modern Pulsing Orb
   ============================================ */

.voice-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.voice-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Orb Container */
.voice-orb-container {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

/* The Glowing Orb */
.voice-orb {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.6);
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    animation: orb-idle 3s infinite ease-in-out;
}

/* Ripple Rings */
.voice-ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, 0.3);
    opacity: 0;
    transform: scale(0.5);
}

/* State: Listening (Active Pulse) */
.voice-overlay.listening .voice-orb {
    transform: scale(1.1);
    box-shadow: 0 0 60px rgba(139, 92, 246, 0.8);
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    /* Warm gradient when listening */
    animation: orb-listening 1.5s infinite ease-in-out;
}

.voice-overlay.listening .voice-ripple {
    animation: ripple 2s infinite linear;
}

.voice-ripple:nth-child(2) {
    animation-delay: 0.5s;
}

.voice-ripple:nth-child(3) {
    animation-delay: 1s;
}

/* State: Processing (Spin/Busy) */
.voice-overlay.processing .voice-orb {
    background: linear-gradient(135deg, #10b981, #06b6d4);
    /* Cool gradient */
    animation: orb-processing 1s infinite linear;
}

.voice-transcript {
    font-size: 24px;
    font-weight: 500;
    color: white;
    text-align: center;
    max-width: 800px;
    padding: 0 20px;
    line-height: 1.5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-height: 80px;
}

.voice-controls {
    margin-top: 40px;
    display: flex;
    gap: 20px;
}

.voice-btn-close {
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

@keyframes orb-idle {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(59, 130, 246, 0.7);
    }
}

@keyframes orb-listening {

    0%,
    100% {
        transform: scale(1.1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.2);
        filter: brightness(1.2);
    }
}

@keyframes orb-processing {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(0.9);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    30% {
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}