/* =============================================================================
   VEILA MOBILE STYLES - Fixed App Layout
   ============================================================================= */

/* Mobile-specific variables - 3 BAR STRUCTURE - Works in both orientations */
@media (max-width: 768px), (max-height: 768px) and (orientation: landscape) {
    :root {
        --mobile-header-height: 40px;      /* Logo + Account */
        --mobile-agent-bar-height: 35px;   /* Agent selector only */
        --mobile-tab-bar-height: 35px;     /* 3-way tabs */
        --mobile-total-header: 110px;      /* All 3 bars combined */
        --mobile-content-height: calc(100vh - var(--mobile-total-header));
        --mobile-content-height-dynamic: calc(100dvh - var(--mobile-total-header));
    }
}

/* FIXED SCREEN - No scrolling, No zooming - Works in both orientations */
@media (max-width: 768px), (max-height: 768px) and (orientation: landscape) {
    html, body {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
        position: fixed !important;
        width: 100vw !important;
        touch-action: manipulation !important;
        user-zoom: fixed !important;
        -webkit-user-scalable: no !important;
    }
    
    /* Prevent zoom completely */
    * {
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        user-zoom: none !important;
    }
    
    input, textarea {
        -webkit-user-select: text;
        font-size: 16px !important;
        zoom: 1 !important;
    }
}

/* =============================================================================
   MOBILE APP CONTAINER
   ============================================================================= */

@media (max-width: 768px), (max-height: 768px) and (orientation: landscape) {
    #appContainer {
        display: flex !important;
        flex-direction: column !important;
        height: 100vh !important;
        height: 100dvh !important; /* Dynamic viewport height */
        width: 100vw !important;
        width: 100dvw !important; /* Dynamic viewport width */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        overflow: hidden !important;
        background: var(--bg-primary) !important;
    }
    
    /* Hide desktop-only elements */
    .workspace-container,
    #workspaceButton,
    .workspace-btn,
    .traces-sidebar,
    #tracesSidebar,
    .desktop-only {
        display: none !important;
    }
}

/* =============================================================================
   MOBILE HEADER
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: var(--mobile-header-height);
        padding: 0 1rem;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-glass);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    .mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .mobile-logo .veila-icon {
        width: 20px;
        height: 20px;
        background: linear-gradient(135deg, #4c1d95 0%, #6b1c3e 70%, #d4af37 100%);
        clip-path: polygon(0% 0%, 50% 100%, 100% 0%, 80% 0%, 50% 65%, 20% 0%);
    }
    
    .mobile-logo .veila-text {
        font-size: 1.1rem;
        font-weight: 200;
        color: var(--text-primary);
        letter-spacing: 0.5px;
    }
    
    /* ACCOUNT BUTTON WITH DROPDOWN (⚙️) */
    .mobile-account-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        font-size: 1rem;
        cursor: pointer;
        position: relative;
    }
    
    /* Account dropdown with Settings, Upgrade, Logout */
    .mobile-account-dropdown {
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(16px);
        z-index: 1001;
        display: none;
        min-width: 160px;
        margin-top: 4px;
    }
    
    .mobile-account-dropdown.active {
        display: block;
    }
    
    .mobile-account-dropdown .dropdown-item {
        padding: 0.75rem 1rem;
        color: var(--text-primary);
        font-size: 0.9rem;
        cursor: pointer;
        border-bottom: 1px solid var(--border-glass);
        transition: background 0.2s;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .mobile-account-dropdown .dropdown-item:last-child {
        border-bottom: none;
    }
    
    .mobile-account-dropdown .dropdown-item:hover,
    .mobile-account-dropdown .dropdown-item:active {
        background: var(--glass-hover);
    }
}

/* =============================================================================
   MOBILE AGENT BAR (Bar 2)
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-agent-bar {
        display: flex;
        align-items: center;
        height: var(--mobile-agent-bar-height);
        padding: 0 1rem;
        background: var(--bg-tertiary);
        border-bottom: 1px solid var(--border-glass);
        position: fixed;
        top: var(--mobile-header-height);
        left: 0;
        right: 0;
        z-index: 999;
    }
    
    .mobile-agent-selector {
        width: 100%;
        height: 28px;
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 6px;
        padding: 0 0.75rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
        font-size: 0.9rem;
    }
    
    .mobile-agent-selector .agent-name {
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-agent-selector .dropdown-arrow {
        color: var(--text-tertiary);
        font-size: 0.8rem;
    }
}

/* =============================================================================
   MOBILE TAB BAR (Bar 3)
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-tab-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        height: var(--mobile-tab-bar-height);
        padding: 0 1rem;
        background: var(--bg-quaternary);
        border-bottom: 1px solid var(--border-glass);
        position: fixed;
        top: calc(var(--mobile-header-height) + var(--mobile-agent-bar-height));
        left: 0;
        right: 0;
        z-index: 998;
    }
    
    /* 3 TAB SELECTOR - Agents | Chat | Traces */
    .mobile-tabs {
        display: flex;
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        border-radius: 6px;
        overflow: hidden;
    }
    
    .mobile-tab {
        padding: 0.4rem 1rem;
        background: transparent;
        border: none;
        color: var(--text-tertiary);
        font-size: 0.85rem;
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
        white-space: nowrap;
    }
    
    .mobile-tab:not(:last-child)::after {
        content: '';
        position: absolute;
        right: 0;
        top: 20%;
        height: 60%;
        width: 1px;
        background: var(--border-glass);
    }
    
    .mobile-tab.active {
        color: var(--accent-electric);
        background: rgba(139, 92, 246, 0.1);
    }
    
    .mobile-tab:active {
        transform: scale(0.95);
    }
}

/* =============================================================================
   MOBILE CONTENT AREA
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-content {
        position: fixed;
        top: var(--mobile-total-header);
        left: 0;
        right: 0;
        bottom: 0;
        height: calc(100vh - var(--mobile-total-header));
        height: calc(100dvh - var(--mobile-total-header)); /* Dynamic viewport */
        overflow: hidden;
        background: var(--bg-primary);
    }
    
    .mobile-tab-content {
        display: none;
        height: 100%;
        width: 100%;
        overflow: hidden;
    }
    
    .mobile-tab-content.active {
        display: flex;
        flex-direction: column;
    }
}

/* =============================================================================
   AGENTS TAB (Mobile)
   ============================================================================= */

@media (max-width: 768px) {
    /* Agents header with action buttons */
    .mobile-agents-header {
        padding: 1rem;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-glass);
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    
    .mobile-new-conversation-btn,
    .mobile-edit-agent-btn {
        background: var(--accent-electric);
        color: white;
        border: none;
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        cursor: pointer;
        flex: 1;
        max-width: 120px;
    }
    
    .mobile-edit-agent-btn {
        background: var(--glass-secondary);
        color: var(--text-primary);
        border: 1px solid var(--border-glass);
    }
    
    .mobile-conversations-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem;
    }
    
    .mobile-conversation-item {
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-conversation-item:active {
        transform: scale(0.98);
        background: var(--glass-hover);
    }
    
    .mobile-conversation-item.active {
        border-color: var(--accent-electric);
        background: rgba(139, 92, 246, 0.1);
    }
    
    .mobile-conversation-title {
        color: var(--text-primary);
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-conversation-preview {
        color: var(--text-tertiary);
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mobile-agent-info {
        padding: 1rem;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-glass);
    }
    
    .mobile-edit-prompt-btn {
        width: 100%;
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        color: var(--text-secondary);
        padding: 0.5rem;
        border-radius: 6px;
        font-size: 0.85rem;
        cursor: pointer;
    }
}

/* =============================================================================
   CHAT TAB (Mobile)
   ============================================================================= */

@media (max-width: 768px), (max-height: 768px) and (orientation: landscape) {
    .mobile-chat-tab {
        display: flex;
        flex-direction: column;
        height: 100%;
        position: relative;
    }
    
    #mobileChatTab {
        position: relative;
        height: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    /* Hide ALL tab contents by default */
    .mobile-tab-content {
        display: none !important;
    }
    
    /* Show ONLY the active tab content */
    .mobile-tab-content.active {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* ONLY show messages and input when Chat tab is specifically active */
    #mobileMessages,
    .mobile-chat-input {
        display: none !important;
    }

    /* Show messages ONLY when chat tab is active */
    #mobileChatTab.active #mobileMessages,
    #mobileChatTab.active .mobile-chat-input {
        display: flex !important;
    }
    
    /* Show agents tab content when active */
    #mobileAgentsTab.active .mobile-conversations-list,
    #mobileAgentsTab.active #mobileConversationsList {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Show traces tab content when active */
    #mobileTracesTab.active {
        display: flex !important;
        flex-direction: column !important;
    }
    
    #mobileTracesTab.active .mobile-trace-list,
    #mobileTracesTab.active #mobileTraceList {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Messages styling when visible */
    #mobileMessages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
        background: var(--bg-primary);
        box-sizing: border-box;
        flex-direction: column;
    }
    
    /* Only chat tab messages need space for input */
    #mobileChatTab.active #mobileMessages {
        padding-bottom: 100px; /* Space for input when chat tab is active */
        height: calc(100% - 80px); /* Account for input height */
    }

    /* Ensure other tabs use full height when active */
    #mobileAgentsTab.active,
    #mobileTracesTab.active {
        height: 100% !important;
        flex: 1 !important;
    }
    
    /* Ensure mobile messages inherit desktop message styles */
    .mobile-messages .message {
        max-width: 85%;
        margin-bottom: 1rem;
    }
    
    .mobile-messages .message.user-message {
        margin-left: auto;
    }
    
    .mobile-messages .message.ai-message {
        margin-right: auto;
    }
    
    /* Paragraph spacing for mobile messages */
    .mobile-messages .message-content p {
        margin: 0 0 0.75rem 0;
        line-height: 1.4;
    }
    
    .mobile-messages .message-content p:last-child {
        margin-bottom: 0;
    }
    
    .mobile-messages .message-content br {
        line-height: 1.6;
    }
    
    .mobile-messages .empty-state {
        text-align: center;
        padding: 2rem;
        color: var(--text-tertiary);
    }
    
    .message {
        max-width: 85%;
        margin-bottom: 1rem;
    }
    
    .message.user-message {
        margin-left: auto;
    }
    
    .message.ai-message {
        margin-right: auto;
    }
    
    /* Reasoning sections more compact on mobile */
    .ai-reasoning {
        font-size: 0.85rem;
    }
    
    .reasoning-header {
        padding: 0.5rem !important;
    }
    
    /* Mobile chat input positioning and styling */
    .mobile-chat-input {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-glass);
        padding: 0.75rem 1rem;
        gap: 0.75rem;
        align-items: flex-end;
        z-index: 1002;
        height: 80px;
        box-sizing: border-box;
        width: 100vw;
        width: 100dvw;
        pointer-events: auto;
        touch-action: manipulation;
        backdrop-filter: blur(20px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-file-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-secondary);
        cursor: pointer;
        flex-shrink: 0;
        font-size: 1.1rem;
        transition: all 0.2s ease;
        touch-action: manipulation;
    }
    
    .mobile-file-btn:hover, .mobile-file-btn:active {
        background: var(--glass-hover);
        color: var(--text-primary);
        transform: scale(1.05);
    }
    
    .mobile-input-wrapper {
        flex: 1;
        position: relative;
        display: flex;
        align-items: center;
    }
    
    #mobileUserInput {
        width: 100%;
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 24px;
        padding: 0.75rem 1rem;
        color: var(--text-primary);
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 48px;
        max-height: 120px;
        resize: none;
        outline: none;
        line-height: 1.4;
        font-family: inherit;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    #mobileUserInput:focus {
        border-color: var(--accent-electric);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(59, 130, 246, 0.1);
    }
    
    #mobileUserInput::placeholder {
        color: var(--text-tertiary);
        opacity: 0.8;
    }
    
    .mobile-send-btn {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--accent-electric);
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        cursor: pointer;
        flex-shrink: 0;
        position: relative;
        z-index: 1001;
        pointer-events: auto;
        touch-action: manipulation;
        font-size: 1.3rem;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    }
    
    .mobile-send-btn:hover, .mobile-send-btn:active {
        background: var(--accent-electric-hover);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    }
    
    .mobile-send-btn:disabled {
        opacity: 0.6;
        transform: none;
        cursor: not-allowed;
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
    }
}

/* =============================================================================
   TRACES TAB (Mobile)
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-traces-tab {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
    
    .mobile-trace-item {
        background: var(--glass-secondary);
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 0.75rem;
        cursor: pointer;
    }
    
    .mobile-trace-item:active {
        transform: scale(0.98);
        background: var(--glass-hover);
    }
    
    .mobile-trace-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.5rem;
    }
    
    .mobile-trace-id {
        font-family: monospace;
        font-size: 0.75rem;
        color: var(--text-tertiary);
    }
    
    .mobile-trace-quality {
        font-size: 0.75rem;
        color: var(--accent-electric);
    }
    
    .mobile-trace-input {
        color: var(--text-primary);
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .mobile-trace-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .mobile-trace-tag {
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 4px;
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        color: var(--text-secondary);
    }
}

/* =============================================================================
   MOBILE MODALS & DROPDOWNS
   ============================================================================= */

@media (max-width: 768px) {
    /* Agent dropdown menu */
    .mobile-agent-menu {
        position: fixed;
        top: var(--mobile-total-header);
        left: 0.75rem;
        right: 0.75rem;
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(16px);
        z-index: 1001;
        display: none;
        max-height: 50vh;
        overflow-y: auto;
    }
    
    .mobile-agent-menu.active {
        display: block;
    }
    
    /* Account dropdown */
    .mobile-account-menu {
        position: fixed;
        top: calc(var(--mobile-header-height) + 0.5rem);
        right: 1rem;
        background: var(--glass-primary);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(16px);
        z-index: 1001;
        display: none;
        min-width: 200px;
    }
    
    .mobile-account-menu.active {
        display: block;
    }
    
    /* Trace modal */
    .mobile-trace-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        z-index: 2000;
        display: none;
        flex-direction: column;
    }
    
    .mobile-trace-modal.active {
        display: flex;
    }
    
    .mobile-trace-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-glass);
    }
    
    .mobile-trace-modal-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }
}

/* =============================================================================
   RESPONSIVE UTILITIES
   ============================================================================= */

@media (max-width: 768px) {
    /* Hide desktop elements AND main nav bar */
    #sidebar,
    .header-main,
    .chat-header,
    .mode-selector-header,
    .model-dropdown,
    #usageCounter,
    #emptyState,
    .nav-links,
    .nav-item,
    .user-menu,
    .main-navigation,
    .workspace-container,
    #workspaceButton,
    .workspace-btn,
    .traces-sidebar,
    #tracesSidebar,
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile elements */
    .mobile-header,
    .mobile-tab-bar,
    .mobile-content {
        display: flex !important;
    }
}

/* Desktop styles - hide mobile elements */
@media (min-width: 769px) and (min-height: 769px) {
    .mobile-header,
    .mobile-tab-bar,
    .mobile-content,
    .mobile-chat-input,
    .mobile-agent-menu,
    .mobile-account-menu,
    .mobile-trace-modal {
        display: none !important;
    }
}

/* Force mobile layout on small screens regardless of orientation */
@media (max-width: 768px), (max-height: 768px) {
    .mobile-header,
    .mobile-agent-bar,
    .mobile-tab-bar,
    .mobile-content {
        display: flex !important;
    }
    
    /* Mobile chat input only shows when chat tab is active */
    #mobileChatTab.active .mobile-chat-input {
        display: flex !important;
    }
}

/* =============================================================================
   MOBILE MODAL FIXES - Full screen lock, no scroll
   ============================================================================= */

@media (max-width: 768px), (max-height: 768px) and (orientation: landscape) {
    /* AUTH MODAL - Complete full-screen fix */
    .auth-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        overflow: hidden !important;
        z-index: 10000 !important;
        background: var(--bg-primary) !important;
        padding: 0 !important;
    }
    
    .auth-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 2rem 1.5rem !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        border-radius: 0 !important;
        background: var(--bg-primary) !important;
    }
    
    /* Nicely spaced auth header for mobile */
    .auth-modal .auth-header {
        margin-bottom: 2rem !important;
        flex-shrink: 0 !important;
    }
    
    .auth-modal .auth-header h1 {
        font-size: 1.6rem !important;
        margin-bottom: 1rem !important;
    }
    
    .auth-modal .auth-header p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
    }
    
    .auth-modal .logo-container {
        margin-bottom: 1.5rem !important;
    }
    
    /* Nicely spaced auth form for mobile */
    .auth-modal .auth-form {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.25rem !important;
        margin-bottom: 2rem !important;
    }
    
    .auth-modal .form-group {
        margin-bottom: 0 !important;
    }
    
    .auth-modal .form-group label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .auth-modal .form-group input {
        padding: 1.2rem 1rem !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        border-radius: 12px !important;
    }
    
    .auth-modal .auth-button {
        padding: 1.2rem !important;
        font-size: 1.1rem !important;
        margin-top: 0.5rem !important;
        margin-bottom: 0 !important;
        border-radius: 12px !important;
        font-weight: 500 !important;
    }
    
    /* Nicely spaced auth switch for mobile - moved closer to button */
    .auth-modal .auth-switch {
        position: relative !important;
        margin-top: 0.75rem !important;
        margin-bottom: 1rem !important;
        font-size: 1rem !important;
        padding: 1rem !important;
        text-align: center !important;
        display: block !important;
    }
    
    /* Error/success messages with better spacing */
    .auth-modal .auth-error,
    .auth-modal .auth-success {
        padding: 1rem !important;
        font-size: 0.9rem !important;
        margin-bottom: 1rem !important;
        border-radius: 12px !important;
    }
    
    /* AGENT MODAL - Complete full-screen fix */
    .agent-modal-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        overflow: hidden !important;
        z-index: 10000 !important;
        background: var(--bg-primary) !important;
    }
    
    .agent-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 2rem 1rem !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        background: var(--bg-primary) !important;
    }
    
    /* Prompt Modal - Edit prompt - Full screen lock */
    .prompt-modal-overlay,
    .prompt-modal-overlay.show {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        width: 100dvw !important;
        height: 100vh !important;
        height: 100dvh !important;
        overflow: hidden !important;
        z-index: 10000 !important;
        background: var(--bg-primary) !important;
    }
    
    .prompt-modal-overlay .modal-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        background: var(--bg-primary) !important;
        padding: 2rem 1rem !important;
        box-sizing: border-box !important;
    }
    
    /* ACCOUNT MODAL - Complete full-screen fix */
    .account-modal-overlay,
    .account-modal-overlay.show {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        overflow: hidden !important;
        z-index: 10000 !important;
        background: var(--bg-primary) !important;
    }
    
    .account-modal-content {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 2rem 1rem !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        background: var(--bg-primary) !important;
    }
    
    /* Modal close buttons - make them prominent on mobile */
    .modal-close,
    .modal-header .modal-close {
        position: fixed !important;
        top: 1rem !important;
        right: 1rem !important;
        z-index: 10001 !important;
        width: 44px !important;
        height: 44px !important;
        background: var(--glass-secondary) !important;
        border: 1px solid var(--border-glass) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.5rem !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
    }
    
    /* Prevent body scroll when modal is open */
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}