/**
 * CapPilot Design System V2
 * Mobile-first, component-based design system
 * Based on ai-copilot-landing.css design tokens
 */

/* ==================== CSS Variables & Base ==================== */
:root {
    /* Colors - Light theme */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-bg-tertiary: #f1f3f5;
    --color-bg-card: rgba(255, 255, 255, 0.9);
    --color-bg-card-hover: rgba(255, 255, 255, 1);

    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-tertiary: #94a3b8;

    --color-accent-primary: #6366f1;
    --color-accent-secondary: #8b5cf6;
    --color-accent-hover: #4f46e5;
    --color-accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --color-border: rgba(15, 23, 42, 0.08);
    --color-border-hover: rgba(15, 23, 42, 0.15);

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;

    /* Spacing - mobile-first */
    --space-xs: 0.5rem;
    /* 8px */
    --space-sm: 0.75rem;
    /* 12px */
    --space-md: 1rem;
    /* 16px */
    --space-lg: 1.5rem;
    /* 24px */
    --space-xl: 2rem;
    /* 32px */
    --space-2xl: 2.5rem;
    /* 40px */
    --space-3xl: 3rem;
    /* 48px */

    /* Layout dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --right-sidebar-width: 320px;
    --mobile-header-height: 56px;
    --mobile-footer-height: 64px;
    --desktop-header-height: 0px;

    /* Border radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-index scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ==================== Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent iOS zoom on input focus - minimum font-size 16px */
@media screen and (max-width: 767px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

body {
    font-family: var(--font-primary);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ==================== Public Header (Firecrawl-style) ==================== */
.public-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.public-header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Logo */
.public-header-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 1.125rem;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.public-header-logo:hover {
    opacity: 0.8;
}

.public-header-logo-icon {
    width: 28px;
    height: 28px;
    color: var(--color-accent-primary);
    flex-shrink: 0;
}

.public-header-logo-text {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Navigation */
.public-header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.public-header-nav-link {
    padding: 0.5rem 1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.public-header-nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.public-header-nav-link.active {
    color: var(--color-accent-primary);
    background: rgba(99, 102, 241, 0.08);
}

/* Actions */
.public-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.public-header-link {
    padding: 0.5rem 1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.public-header-btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--color-accent-primary);
    color: white;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.public-header-btn-primary:hover {
    background: #5558e3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.public-header-btn-primary:active {
    transform: translateY(0);
}

/* Dark Theme Support */
[data-theme="dark"] .public-header {
    background: rgba(23, 23, 23, 0.8);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .public-header-logo {
    color: #f5f5f5;
}

[data-theme="dark"] .public-header-nav-link {
    color: #94a3b8;
}

[data-theme="dark"] .public-header-nav-link:hover {
    color: #f5f5f5;
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .public-header-nav-link.active {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] .public-header-link {
    color: #94a3b8;
}

[data-theme="dark"] .public-header-link:hover {
    color: #f5f5f5;
    background: rgba(255, 255, 255, 0.05);
}

/* Bank Theme Support */
[data-theme="bank"] .public-header-logo-icon,
[data-theme="bank"] .public-header-nav-link.active {
    color: #0066cc;
}

[data-theme="bank"] .public-header-btn-primary {
    background: #0066cc;
}

[data-theme="bank"] .public-header-btn-primary:hover {
    background: #0052a3;
}

[data-theme="bank"] .public-header-nav-link.active {
    background: rgba(0, 102, 204, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .public-header-container {
        padding: 1rem 1.5rem;
        gap: 1rem;
    }
    
    .public-header-nav {
        display: none;
    }
    
    .public-header-logo-text {
        display: none;
    }
    
    .public-header-link {
        display: none;
    }
    
    .public-header-btn-primary {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Hide public header for authenticated users on pages with sidebar */
body.is-authenticated .public-header {
    display: none;
}

/* ==================== Layout Structure ==================== */

/* App Container - Mobile First */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100vw;
    width: 100%;
    overflow-x: hidden;
    background: var(--color-bg-secondary);
}

/* Mobile Layout (default) */
.app-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-md);
    z-index: var(--z-sticky);
}

.app-mobile-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom, 0px));
    background: var(--color-bg-primary);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding: var(--space-xs) var(--space-md);
    padding-bottom: calc(var(--space-xs) + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-sticky);
}

.app-mobile-content {
    flex: 1;
    margin-top: var(--mobile-header-height);
    margin-bottom: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop Layout */
@media (min-width: 1024px) {

    .app-mobile-header,
    .app-mobile-footer {
        display: none;
    }

    .app-layout {
        flex-direction: row;
    }

    .app-mobile-content {
        margin-top: 0;
        margin-bottom: 0;
    }
}

/* ==================== Desktop Sidebar (Left Menu) ==================== */
.app-sidebar {
    display: none;
}

@media (min-width: 1024px) {
    .app-sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-width);
        height: 100vh;
        height: 100dvh;
        background: var(--color-bg-primary);
        border-right: 1px solid var(--color-border);
        position: fixed;
        left: 0;
        top: 0;
        z-index: var(--z-sticky);
        transition: width var(--transition-base);
    }

    .app-sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

    .app-sidebar-header {
        padding: var(--space-sm) var(--space-md);
        border-bottom: 1px solid var(--color-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .app-sidebar-logo {
        display: flex;
        align-items: center;
        gap: 4px;
        font-weight: 700;
        font-size: 1.25rem;
        color: var(--color-text-primary);
        text-decoration: none;
        transition: opacity var(--transition-fast);
    }

    .app-sidebar.collapsed .app-sidebar-logo-text {
        display: none;
    }

    .app-sidebar-toggle {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .app-sidebar-toggle:hover {
        background: var(--color-bg-secondary);
        border-color: var(--color-border-hover);
    }

    .app-sidebar-nav {
        flex: 1;
        overflow-y: auto;
        padding: var(--space-xs) var(--space-sm);
    }

    .app-sidebar-footer {
        padding: var(--space-sm);
        border-top: 1px solid var(--color-border);
    }
}

/* Sidebar Menu Items */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
}

/* New Button */
.sidebar-new-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 10px var(--space-sm);
    background: transparent;
    color: var(--color-accent-primary);
    border: 1.5px solid var(--color-accent-primary);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-md);
}

.sidebar-new-btn:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

.sidebar-new-btn i {
    font-size: 0.75rem;
}

.app-sidebar.collapsed .sidebar-new-btn span {
    display: none;
}

.app-sidebar.collapsed .sidebar-new-btn {
    justify-content: center;
    padding: 10px;
}

.sidebar-new-section {
    position: relative;
    margin-bottom: var(--space-sm);
}

.sidebar-new-section .sidebar-new-btn {
    margin-bottom: 0;
}

.sidebar-new-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.sidebar-new-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sidebar-new-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px var(--space-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
}

.sidebar-new-dropdown-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.sidebar-new-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 0.75rem;
}

/* Chats List */
.sidebar-chats-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-chat-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-chat-item:hover {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

.sidebar-chat-item.active {
    background: var(--color-accent-primary);
    color: white;
}

.sidebar-view-all {
    display: flex;
    justify-content: flex-start;
    padding: var(--space-xs) var(--space-sm);
    margin-top: var(--space-xxs);
    color: var(--color-text-tertiary);
    text-decoration: none;
    font-size: 0.6875rem;
    transition: var(--transition-base);
}

.sidebar-view-all:hover {
    color: var(--color-accent-primary);
}

.sidebar-menu-expandable {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-menu-expandable i {
    transition: transform var(--transition-fast);
}

.sidebar-menu-expandable.expanded i {
    transform: rotate(180deg);
}

.sidebar-menu-section {
    margin-top: var(--space-md);
}

.sidebar-menu-section:first-child {
    margin-top: 0;
}

.sidebar-menu-label {
    font-size: 0.6875rem; /* 11px - acceptable for uppercase labels */
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 var(--space-sm);
    margin-bottom: 4px;
}

.app-sidebar.collapsed .sidebar-menu-label {
    display: none;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.sidebar-menu-item:hover {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

.sidebar-menu-item.active {
    background: var(--color-accent-gradient);
    color: white;
}

.sidebar-menu-item-compact {
    font-size: 0.8125rem;
    padding: 6px var(--space-sm);
}

.sidebar-menu-item-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

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

.app-sidebar.collapsed .sidebar-menu-item-text {
    display: none;
}

.sidebar-menu-item-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.sidebar-menu-item.expanded .sidebar-menu-item-arrow {
    transform: rotate(90deg);
}

.app-sidebar.collapsed .sidebar-menu-item-arrow {
    display: none;
}

/* Submenu items */
.sidebar-submenu-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    padding-left: calc(var(--space-sm) + 20px);
}

.sidebar-submenu-item:hover {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

.sidebar-submenu-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-primary);
    font-weight: 600;
}

.app-sidebar.collapsed .sidebar-submenu-item {
    display: none;
}

/* Chats list in sidebar */
.sidebar-chats-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-chat-item {
    display: block;
    padding: 6px var(--space-sm);
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all var(--transition-fast);
}

.sidebar-chat-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.sidebar-chat-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-primary);
}

/* Spacer to push settings to bottom */
.sidebar-nav-spacer {
    flex: 1;
    min-height: var(--space-lg);
}

/* ==================== Desktop Right Sidebar ==================== */
.app-right-sidebar {
    display: none;
}

@media (min-width: 1280px) {
    .app-right-sidebar {
        display: flex;
        flex-direction: column;
        width: var(--right-sidebar-width);
        height: 100vh;
        height: 100dvh;
        background: var(--color-bg-primary);
        border-left: 1px solid var(--color-border);
        position: fixed;
        right: 0;
        top: 0;
        z-index: var(--z-sticky);
        transform: translateX(100%);
        transition: transform var(--transition-base);
    }

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

    .app-right-sidebar-header {
        padding: var(--space-lg);
        border-bottom: 1px solid var(--color-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .app-right-sidebar-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--color-text-primary);
    }

    .app-right-sidebar-close {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--color-text-secondary);
        cursor: pointer;
        border-radius: var(--radius-sm);
        transition: all var(--transition-fast);
    }

    .app-right-sidebar-close:hover {
        background: var(--color-bg-secondary);
        color: var(--color-text-primary);
    }

    .app-right-sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: var(--space-md);
    }
}

/* Toggle button for right sidebar */
.right-sidebar-toggle {
    display: none;
}

@media (min-width: 1280px) {
    .right-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: var(--color-bg-primary);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        color: var(--color-text-secondary);
        cursor: pointer;
        transition: all var(--transition-fast);
        position: fixed;
        right: var(--space-md);
        top: var(--space-md);
        z-index: var(--z-fixed);
    }

    .right-sidebar-toggle:hover {
        background: var(--color-bg-secondary);
        border-color: var(--color-border-hover);
        color: var(--color-text-primary);
    }

    body.right-sidebar-open .right-sidebar-toggle {
        right: calc(var(--right-sidebar-width) + var(--space-md));
    }
}

/* ==================== Main Content Area ==================== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

@media (min-width: 1024px) {
    .app-main {
        margin-left: var(--sidebar-width);
        transition: margin-left var(--transition-base);
    }

    .app-sidebar.collapsed~.app-main {
        margin-left: var(--sidebar-collapsed-width);
    }
}

@media (min-width: 1280px) {
    .app-main {
        transition: margin-left var(--transition-base), margin-right var(--transition-base);
    }

    body.right-sidebar-open .app-main {
        margin-right: var(--right-sidebar-width);
    }
}

.app-content {
    flex: 1;
    padding: var(--space-sm);
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .app-content {
        padding: var(--space-md);
    }
}

@media (min-width: 1024px) {
    .app-content {
        padding: var(--space-lg);
    }
}

/* Chat page specific styles */
.chat-page .app-content {
    padding: var(--space-md) !important;
}

@media (min-width: 768px) {
    .chat-page .app-content {
        padding: var(--space-lg) !important;
    }
}

@media (min-width: 1024px) {
    .chat-page .app-content {
        padding: var(--space-xl) !important;
    }
}

/* ==================== Mobile Header Components ==================== */
.mobile-header-left,
.mobile-header-center,
.mobile-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.mobile-header-center {
    flex: 1;
    justify-content: center;
}

.mobile-mode-toggle {
    display: flex;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-full);
    padding: 4px;
    gap: 4px;
}

.mobile-mode-toggle-btn {
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.mobile-mode-toggle-btn.active {
    background: white;
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm);
}

.mobile-icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.mobile-icon-btn.active {
    background: var(--color-accent-gradient);
    color: white;
}

/* ==================== Mobile Footer Navigation ==================== */
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    color: var(--color-text-tertiary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
    min-width: 0;
}

.mobile-nav-item:hover {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

.mobile-nav-item.active {
    color: var(--color-accent-primary);
}

.mobile-nav-item-icon {
    font-size: 1.25rem;
}

.mobile-nav-item-label {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ==================== Card Components ==================== */
.card {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    margin-bottom: var(--space-md);
}

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

.card-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.card-body {
    padding: var(--space-sm) var(--space-md);
}

.card-footer {
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

/* Card variants */
.card-compact .card-header,
.card-compact .card-body,
.card-compact .card-footer {
    padding: var(--space-md);
}

.card-hover {
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ==================== Button Components ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-primary);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-accent-hover) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-tertiary) !important;
    color: var(--color-text-primary) !important;
    border-color: var(--color-border-hover);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg-secondary) !important;
    color: var(--color-text-primary) !important;
}

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

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

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

/* Button sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    padding: 0;
}

.btn-full {
    width: 100%;
}

/* ==================== Form Elements ==================== */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-family: var(--font-primary);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-tertiary);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-help {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-tertiary);
    margin-top: var(--space-xs);
}

.form-error {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-error);
    margin-top: var(--space-xs);
}

/* ==================== Badge Components ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--color-accent-primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.badge-neutral {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.badge-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

/* ==================== Alert Components ==================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    margin-bottom: var(--space-md);
}

.alert-success {
    background: rgba(16, 185, 129, 0.05);
    border-color: var(--color-success);
    color: #065f46;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.05);
    border-color: var(--color-warning);
    color: #92400e;
}

.alert-error,
.alert-danger {
    background: rgba(239, 68, 68, 0.05);
    border-color: var(--color-error);
    color: #991b1b;
}

.alert-info {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--color-accent-primary);
    color: #1e40af;
}

.alert-content {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    opacity: 0.5;
    padding: 0;
    transition: opacity var(--transition-fast);
}

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

/* ==================== Loading States ==================== */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

/* ==================== Utility Classes ==================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.items-end {
    align-items: flex-end;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-end {
    justify-content: flex-end;
}

.gap-xs {
    gap: var(--space-xs);
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.gap-lg {
    gap: var(--space-lg);
}

.flex-wrap {
    flex-wrap: wrap;
}

.hidden {
    display: none;
}

.block {
    display: block;
}

.inline-block {
    display: inline-block;
}

.m-0 {
    margin: 0;
}

.mt-xs {
    margin-top: var(--space-xs);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mb-xs {
    margin-bottom: var(--space-xs);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}

.mb-2xl {
    margin-bottom: var(--space-2xl);
}

.p-0 {
    padding: 0;
}

.p-xs {
    padding: var(--space-xs);
}

.p-sm {
    padding: var(--space-sm);
}

.p-md {
    padding: var(--space-md);
}

.p-lg {
    padding: var(--space-lg);
}

.p-xl {
    padding: var(--space-xl);
}

.p-2xl {
    padding: var(--space-2xl);
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-base {
    font-size: 0.9375rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-primary {
    color: var(--color-text-primary);
}

.text-secondary {
    color: var(--color-text-secondary);
}

.text-tertiary {
    color: var(--color-text-tertiary);
}

.text-accent {
    color: var(--color-accent-primary);
}

.text-success {
    color: var(--color-success);
}

.text-warning {
    color: var(--color-warning);
}

.text-error {
    color: var(--color-error);
}

.text-danger {
    color: var(--color-error);
}

/* Gray text utilities for compatibility */
.text-gray-500 {
    color: var(--color-text-tertiary);
}

.text-gray-600 {
    color: var(--color-text-secondary);
}

.text-primary-color {
    color: var(--color-accent-primary);
}

/* Typography utilities */
.font-mono {
    font-family: var(--font-mono);
}

.leading-relaxed {
    line-height: 1.625;
}

.bg-primary {
    background: var(--color-bg-primary);
}

.bg-secondary {
    background: var(--color-bg-secondary);
}

.bg-tertiary {
    background: var(--color-bg-tertiary);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.shadow-sm {
    box-shadow: var(--shadow-sm);
}

.shadow-md {
    box-shadow: var(--shadow-md);
}

.shadow-lg {
    box-shadow: var(--shadow-lg);
}

.border {
    border: 1px solid var(--color-border);
}

.border-b {
    border-bottom: 1px solid var(--color-border);
}

.border-t {
    border-top: 1px solid var(--color-border);
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.cursor-pointer {
    cursor: pointer;
}

/* ==================== Modal & Overlay ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    display: none;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-base);
    overflow-y: auto;
    padding: var(--space-md);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: var(--z-modal);
}

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

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg) var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ==================== Order Form Modals ==================== */
.buysell-modal,
.expiration-modal,
.order-success-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal-backdrop);
    display: none !important;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.buysell-modal.show,
.expiration-modal.show,
.order-success-modal.show {
    display: flex !important;
}

/* Buy/Sell Modal Content */
.buysell-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.buysell-modal-header {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.buysell-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.buysell-modal-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.buysell-modal-body {
    padding: 48px 24px 24px 24px;
}

/* Order Type Selector (Buy/Sell Toggle) */
.order-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.order-type-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.order-type-btn:hover {
    border-color: #cbd5e1;
}

.order-type-btn.active.order-type-buy {
    background: #059669;
    border-color: #059669;
    color: white;
}

.order-type-btn.active.order-type-sell {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Main Input Section */
.main-input-section {
    margin-bottom: 24px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.currency-symbol {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    font-weight: 600;
    color: #64748b;
    pointer-events: none;
}

.main-input {
    width: 100%;
    padding: 16px 16px 16px 40px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    background: white;
    transition: border-color 0.2s ease;
}

.main-input:focus {
    outline: none;
    border-color: #1d4ed8;
}

.input-toggle-btn {
    width: 100%;
    padding: 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.input-toggle-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.quantity-hint {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-size: 13px;
    color: #0c4a6e;
}

/* Order Summary */
.order-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.order-summary-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.execution-type-dropdown {
    padding: 6px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.execution-type-dropdown:focus {
    outline: none;
    border-color: #1d4ed8;
}

.order-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.order-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.order-summary-row:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.order-summary-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.order-summary-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 600;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.order-summary-price-input {
    width: 100px;
    padding: 4px 8px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.order-summary-price-input:focus {
    outline: none;
    border-color: #1d4ed8;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e1;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: help;
}

.tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.edit-expiration-btn {
    margin-left: 8px;
    color: #1d4ed8;
    cursor: pointer;
    font-size: 12px;
}

.edit-expiration-btn:hover {
    color: #1e40af;
}

/* Order Validation */
.order-validation {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.order-validation.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.order-validation.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* Order Actions */
.order-actions {
    display: flex;
    gap: 12px;
}

.order-btn-primary,
.order-btn-secondary {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.order-btn-primary {
    background: #1d4ed8;
    color: white;
}

.order-btn-primary:hover:not(:disabled) {
    background: #1e40af;
}

.order-btn-primary:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.order-btn-secondary {
    background: white;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
}

.order-btn-secondary:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

/* Expiration Modal */
.expiration-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.expiration-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expiration-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.expiration-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.expiration-modal-body {
    padding: 24px;
}

.expiration-options {
    margin-bottom: 20px;
}

.expiration-option {
    padding: 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expiration-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.expiration-option input[type="radio"] {
    margin-right: 8px;
}

.expiration-option label {
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
}

.expiration-description {
    margin: 4px 0 0 24px;
    font-size: 13px;
    color: #64748b;
}

.expiration-date-input {
    margin-bottom: 20px;
}

.expiration-actions {
    display: flex;
    gap: 12px;
}

/* Success Modal */
.order-success-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.order-success-modal-header {
    padding: 32px 24px 16px 24px;
}

.success-icon {
    font-size: 64px;
    color: #059669;
    margin-bottom: 16px;
}

.success-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.order-success-modal-body {
    padding: 0 24px 24px 24px;
}

.success-message {
    color: #64748b;
    margin-bottom: 24px;
    line-height: 1.5;
}

.order-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
}

.order-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.order-detail-row:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.detail-label {
    font-size: 14px;
    color: #64748b;
}

.detail-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 600;
    text-align: right;
}

.order-success-modal-actions {
    padding: 16px 24px 24px 24px;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .buysell-modal-content {
        max-width: calc(100vw - 32px);
    }

    .main-input {
        font-size: 24px;
        padding: 12px 12px 12px 36px;
    }

    .currency-symbol {
        font-size: 20px;
        left: 12px;
    }

    .order-summary-value {
        max-width: 55%;
        font-size: 13px;
    }
}

/* ==================== Responsive Utilities ==================== */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .show-mobile {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ==================== Mobile Typography (Apple HIG Compliance) ==================== */
/* Apple HIG recommends: Body 17pt, Footnote 13pt, Caption 11-12pt */
/* Minimum touch target: 44x44pt, minimum font for readability: 11pt */
@media (max-width: 767px) {
    /* Increase base font size on mobile for better readability */
    body {
        font-size: 1rem; /* 16px base */
    }
    
    /* Navigation items - increase for touch targets */
    .mobile-nav-item-label {
        font-size: 0.8125rem; /* 13px - up from 12px */
    }
    
    /* Form elements - ensure readable size */
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 1rem; /* 16px - prevents iOS zoom */
    }
    
    /* Buttons - ensure minimum touch-friendly text */
    .btn {
        font-size: 1rem; /* 16px */
        min-height: 44px; /* Apple HIG minimum touch target */
    }
    
    .btn-sm {
        font-size: 0.9375rem; /* 15px */
        min-height: 40px;
    }
    
    /* Card titles - slightly larger on mobile */
    .card-title {
        font-size: 1rem; /* 16px */
    }
    
    /* Badge - ensure minimum readability */
    .badge {
        font-size: 0.8125rem; /* 13px - up from 12px */
    }
    
    /* Sidebar menu items when visible */
    .sidebar-menu-item {
        font-size: 1rem; /* 16px */
        min-height: 44px;
    }
    
    /* Alert text */
    .alert {
        font-size: 0.9375rem; /* 15px */
    }
    
    /* Modal content */
    .modal-title {
        font-size: 1.25rem; /* 20px */
    }
    
    .modal-body {
        font-size: 1rem; /* 16px */
    }
}

/* ==================== Grid Layout System ==================== */
.grid {
    display: grid;
    gap: var(--space-lg);
}

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

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

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive grid - tablet */
@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Responsive grid - desktop */
@media (min-width: 1024px) {
    .lg\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive grid fallback for mobile */
@media (max-width: 767px) {
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .md\:grid-cols-2,
    .md\:grid-cols-3,
    .lg\:grid-cols-2,
    .lg\:grid-cols-3,
    .lg\:grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ==================== Additional Utility Classes ==================== */
/* Price/Change colors */
.price-positive,
.text-positive {
    color: #059669;
}

.price-negative,
.text-negative {
    color: #dc2626;
}

.price-neutral {
    color: var(--color-text-secondary);
}

/* Width utilities */
.w-full {
    width: 100%;
}

.max-w-sm {
    max-width: 24rem;
}

.max-w-md {
    max-width: 28rem;
}

.max-w-lg {
    max-width: 32rem;
}

.max-w-xl {
    max-width: 36rem;
}

.max-w-2xl {
    max-width: 42rem;
}

.max-w-3xl {
    max-width: 48rem;
}

.max-w-4xl {
    max-width: 56rem;
}

/* Static card variant (no hover effects) */
.card-static {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.card-static .card-header {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

.card-static .card-body {
    padding: var(--space-sm) var(--space-md);
}

/* Link styles */
.text-link {
    color: var(--color-accent-primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.text-link:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* ==================== Autocomplete Dropdown ==================== */
.autocomplete-dropdown {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    position: absolute;
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
}

.autocomplete-option {
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background-color var(--transition-fast);
}

.autocomplete-option:hover {
    background-color: var(--color-bg-secondary);
}

.autocomplete-option:last-child {
    border-bottom: none;
}

.autocomplete-option.highlighted {
    background-color: rgba(99, 102, 241, 0.1);
}

.autocomplete-ticker {
    font-weight: 600;
    color: var(--color-accent-primary);
    font-size: 0.875rem;
}

.autocomplete-name {
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    line-height: 1.3;
}

/* ==================== Ticker Tags ==================== */
.ticker-tag {
    display: flex;
    align-items: center;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    transition: all var(--transition-fast);
}

.ticker-tag.validating {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--color-warning);
}

.ticker-tag.valid {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--color-success);
}

.ticker-tag.invalid {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-error);
}

.ticker-tag-ticker {
    font-weight: 600;
    color: var(--color-accent-primary);
    margin-right: var(--space-xs);
}

.ticker-tag-name {
    color: var(--color-text-secondary);
    margin-right: var(--space-xs);
}

.ticker-tag-remove {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: auto;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.ticker-tag-remove:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--color-error);
}

.ticker-tag-status {
    font-size: 0.75rem;
    margin-left: var(--space-xs);
    font-weight: 500;
}

.ticker-tag.valid .ticker-tag-status {
    color: var(--color-success);
}

.ticker-tag.invalid .ticker-tag-status {
    color: var(--color-error);
}

.ticker-tag.validating .ticker-tag-status {
    color: var(--color-warning);
}

/* ==================== Dropdown Menu ==================== */
.dropdown-container {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-tertiary);
    transition: all var(--transition-fast);
}

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

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    min-width: 180px;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

.dropdown-item {
    width: 100%;
    padding: var(--space-xs) var(--space-sm);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    font-size: 0.875rem;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.dropdown-item:hover {
    background-color: var(--color-bg-secondary);
}

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dropdown-item i {
    width: 16px;
    color: var(--color-text-secondary);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* ==================== Chat Bottom Sheet (Mobile) ==================== */
/* Скрывает мобильный bottom sheet на десктопе */
.chat-bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-bottom-sheet-overlay.active {
    display: block;
    opacity: 1;
}

.chat-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.chat-bottom-sheet.active {
    transform: translateY(0);
}

.chat-bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    margin: var(--space-sm) auto;
}

.chat-bottom-sheet-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.chat-bottom-sheet-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.chat-bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* На десктопе bottom sheet вообще не нужен */
@media (min-width: 768px) {
    .chat-bottom-sheet,
    .chat-bottom-sheet-overlay {
        display: none !important;
    }
}

/* ==================== AI Disclaimer ==================== */
.ai-disclaimer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    position: relative;
}

.ai-disclaimer-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.ai-disclaimer-trigger:hover {
    color: var(--color-text-secondary);
    background: var(--color-bg-hover, var(--color-bg-secondary));
}

.ai-disclaimer-text {
    opacity: 0.8;
}

.ai-disclaimer-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 300px;
    padding: 12px 14px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
}

.ai-disclaimer-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 9px;
    border: 6px solid transparent;
    border-top-color: var(--color-border);
}

.ai-disclaimer.tooltip-open .ai-disclaimer-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ai-disclaimer-tooltip-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-disclaimer-tooltip-close:hover {
    background: var(--color-bg-hover, var(--color-bg-secondary));
    color: var(--color-text-secondary);
}

.ai-disclaimer-tooltip-content p {
    margin: 0 0 8px 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.ai-disclaimer-tooltip-content p:last-child {
    margin-bottom: 0;
    color: var(--color-text-tertiary);
    font-size: 0.75rem;
}

@media (max-width: 480px) {
    .ai-disclaimer-tooltip {
        width: 260px;
    }
}

/* ==================== Financial Disclaimer ==================== */
.financial-disclaimer {
    padding: 12px 16px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

.financial-disclaimer p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--color-text-tertiary);
}

.financial-disclaimer strong {
    color: var(--color-text-secondary);
}