/**
 * ============================================
 * BIZFLOW STUDIO v5.1 - BASE & VARIABLES
 * Mobile-First Design System
 * ============================================
 */

/* ==========================================
   CSS CUSTOM PROPERTIES
   ========================================== */
:root {
    /* === COLOR SYSTEM === */
    --color-white: #ffffff;
    --color-black: #000000;
    
    /* Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --gray-950: #030712;
    
    /* Brand Colors */
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    
    /* Semantic Colors */
    --success-500: #22c55e;
    --success-600: #16a34a;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --info-500: #3b82f6;
    --info-600: #2563eb;

    /* === THEME TOKENS (Dark Default) === */
    --bg-base: var(--gray-950);
    --bg-surface: var(--gray-900);
    --bg-elevated: var(--gray-800);
    --bg-muted: var(--gray-800);
    
    --text-primary: var(--gray-50);
    --text-secondary: var(--gray-300);
    --text-muted: var(--gray-500);
    --text-inverse: var(--gray-900);
    
    --border-default: var(--gray-700);
    --border-muted: var(--gray-800);
    
    --accent: var(--brand-500);
    --accent-hover: var(--brand-600);
    --accent-muted: rgba(99, 102, 241, 0.15);

    /* === TYPOGRAPHY === */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    
    /* Font Sizes - Mobile First (smaller base) */
    --text-xs: 0.6875rem;     /* 11px */
    --text-sm: 0.75rem;       /* 12px */
    --text-base: 0.8125rem;   /* 13px */
    --text-md: 0.875rem;      /* 14px */
    --text-lg: 1rem;          /* 16px */
    --text-xl: 1.125rem;      /* 18px */
    --text-2xl: 1.375rem;     /* 22px */
    --text-3xl: 1.75rem;      /* 28px */
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    
    /* Font Weights */
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* === SPACING === */
    --space-0: 0;
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */

    /* === BORDERS === */
    --radius-none: 0;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-2xl: 16px;
    --radius-full: 9999px;

    /* === SHADOWS === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

    /* === TRANSITIONS === */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
    --duration-fast: 100ms;
    --duration-normal: 150ms;
    --duration-slow: 250ms;

    /* === Z-INDEX === */
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-toast: 800;

    /* === LAYOUT DIMENSIONS === */
    /* Mobile First - These are mobile values */
    --header-height: 48px;
    --statusbar-height: 22px;
    --sidebar-width: 280px;
    --activity-bar-width: 48px;
    --tabs-height: 36px;
    
    /* Touch targets */
    --touch-min: 44px;
    --touch-comfortable: 48px;
}

/* === LIGHT THEME === */
[data-theme="light"] {
    --bg-base: var(--gray-50);
    --bg-surface: var(--color-white);
    --bg-elevated: var(--color-white);
    --bg-muted: var(--gray-100);
    
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-400);
    --text-inverse: var(--color-white);
    
    --border-default: var(--gray-200);
    --border-muted: var(--gray-100);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* === TABLET BREAKPOINT === */
@media (min-width: 768px) {
    :root {
        --header-height: 40px;
        --text-base: 0.875rem;
    }
}

/* === DESKTOP BREAKPOINT === */
@media (min-width: 1024px) {
    :root {
        --header-height: 38px;
        --sidebar-width: 260px;
    }
}

/* ==========================================
   RESET & BASE STYLES
   ========================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    height: -webkit-fill-available;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-base);
    min-height: 100%;
    min-height: -webkit-fill-available;
    overflow: hidden;
    overscroll-behavior: none;
}

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

/* Remove tap highlight on mobile */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Selection */
::selection {
    background: var(--accent-muted);
    color: var(--text-primary);
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

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

/* Hide on mobile, show on desktop */
.desktop-only {
    display: none !important;
}

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
/**
 * ============================================
 * BIZFLOW STUDIO v5.1 - LAYOUT
 * Mobile-First Grid System
 * ============================================
 */

/* ==========================================
   MAIN APP LAYOUT
   Mobile: Single column
   Tablet: Sidebar + Content
   Desktop: Activity Bar + Sidebar + Content
   ========================================== */

/* Botón flotante para expandir sidebar */
.bf-sidebar-expand {
    display: none;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 56px;
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 10;
    transition: all var(--duration-fast);
    align-items: center;
    justify-content: center;
}

.bf-sidebar-expand:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
    width: 28px;
}

@media (min-width: 768px) {
    .bf-sidebar-expand.is-visible {
        display: flex;
    }
}

.bf-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    background: var(--bg-base);
}

/* ==========================================
   HEADER / TITLEBAR
   ========================================== */
.bf-header {
    display: flex;
    align-items: center;
    height: var(--header-height);
    min-height: var(--header-height);
    padding: 0 var(--space-3);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-muted);
    gap: var(--space-2);
    z-index: var(--z-sticky);
    flex-shrink: 0;
}

.bf-header__left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.bf-header__center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.bf-header__right {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* Menu Toggle Button (Mobile) */
.bf-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    height: var(--touch-min);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.bf-menu-toggle:hover {
    background: var(--bg-muted);
}

.bf-menu-toggle i {
    font-size: 1.25rem;
}

/* Logo */
.bf-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.bf-logo__icon {
    width: 28px;
    height: 28px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
}

.bf-logo__text {
    font-weight: var(--font-bold);
    font-size: var(--text-md);
    color: var(--text-primary);
    display: none;
}

@media (min-width: 480px) {
    .bf-logo__text {
        display: block;
    }
}

/* Search Bar */
.bf-search-trigger {
    display: none;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-muted);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: border-color var(--duration-fast);
    width: 100%;
    max-width: 400px;
}

.bf-search-trigger:hover {
    border-color: var(--border-default);
}

.bf-search-trigger kbd {
    margin-left: auto;
    padding: 2px 6px;
    font-size: var(--text-xs);
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
}

@media (min-width: 768px) {
    .bf-search-trigger {
        display: flex;
    }
}

/* Header Buttons */
.bf-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast);
    position: relative;
}

.bf-header-btn:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.bf-header-btn i {
    font-size: 1.125rem;
}

.bf-header-btn--primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    color: white;
}

.bf-header-btn--primary:hover {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
    color: white;
}

.bf-header-btn__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--error-500);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */
.bf-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.bf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-width), 85vw);
    background: var(--bg-surface);
    border-right: 1px solid var(--border-muted);
    display: flex;
    flex-direction: column;
    z-index: var(--z-modal);
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease-out);
    overflow: hidden;
}

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

/* Sidebar Header */
.bf-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-muted);
    min-height: var(--header-height);
    flex-shrink: 0;
}

.bf-sidebar__title {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.bf-sidebar__header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.bf-sidebar__close,
.bf-sidebar__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.bf-sidebar__close:hover,
.bf-sidebar__collapse:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.bf-sidebar__collapse {
    display: none;
}

@media (min-width: 1024px) {
    .bf-sidebar__collapse {
        display: flex;
    }
    
    .bf-sidebar__close {
        display: none;
    }
}

/* Sidebar Content */
.bf-sidebar__content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* Sidebar Footer */
.bf-sidebar__footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-muted);
    flex-shrink: 0;
}

/* ==========================================
   OVERLAY
   ========================================== */
.bf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-slow), visibility var(--duration-slow);
}

.bf-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   EDITOR / CONTENT AREA
   ========================================== */
.bf-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

/* Tabs Bar */
.bf-tabs {
    display: flex;
    align-items: center;
    height: var(--tabs-height);
    min-height: var(--tabs-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-muted);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex-shrink: 0;
}

.bf-tabs::-webkit-scrollbar {
    display: none;
}

.bf-tabs__list {
    display: flex;
    align-items: flex-end;
    height: 100%;
    padding: 0 var(--space-2);
    gap: 1px;
}

.bf-tabs__actions {
    display: flex;
    align-items: center;
    padding: 0 var(--space-2);
    margin-left: auto;
    flex-shrink: 0;
}

/* Tab Item */
.bf-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: calc(var(--tabs-height) - 4px);
    padding: 0 var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
    max-width: 160px;
}

.bf-tab:hover {
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.bf-tab.is-active {
    background: var(--bg-base);
    color: var(--text-primary);
}

.bf-tab__title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.bf-tab__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    opacity: 0;
    transition: opacity var(--duration-fast);
    flex-shrink: 0;
}

.bf-tab:hover .bf-tab__close,
.bf-tab.is-active .bf-tab__close {
    opacity: 1;
}

.bf-tab__close:hover {
    background: var(--error-500);
    color: white;
}

/* Editor Content */
.bf-editor__content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.bf-editor__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none;
    background: var(--bg-base);
}

.bf-editor__frame.is-active {
    display: block;
}

/* ==========================================
   STATUS BAR
   ========================================== */
.bf-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--statusbar-height);
    min-height: var(--statusbar-height);
    padding: 0 var(--space-2);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-muted);
    font-size: var(--text-xs);
    color: var(--text-muted);
    flex-shrink: 0;
    overflow: hidden;
}

.bf-statusbar__left,
.bf-statusbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-width: 0;
}

.bf-statusbar__item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 var(--space-2);
    height: 100%;
    white-space: nowrap;
    cursor: default;
    transition: background var(--duration-fast);
}

.bf-statusbar__item:hover {
    background: var(--bg-muted);
}

.bf-statusbar__item i {
    font-size: 12px;
}

.bf-statusbar__item--accent {
    background: var(--accent);
    color: white;
}

.bf-statusbar__item--accent:hover {
    background: var(--accent-hover);
}

/* Hide some status items on very small screens */
@media (max-width: 480px) {
    .bf-statusbar__item--hideable {
        display: none;
    }
}

/* ==========================================
   TABLET+ LAYOUT (768px)
   ========================================== */
@media (min-width: 768px) {
    .bf-menu-toggle {
        display: none;
    }
    
    .bf-sidebar {
        position: relative;
        transform: translateX(0);
        width: var(--sidebar-width);
        flex-shrink: 0;
        transition: width var(--duration-slow) var(--ease-out), 
                    margin var(--duration-slow) var(--ease-out);
    }
    
    .bf-sidebar__close {
        display: none;
    }
    
    .bf-overlay {
        display: none !important;
    }
    
    /* Collapsed state for desktop */
    .bf-sidebar.is-collapsed {
        width: 0;
        min-width: 0;
        overflow: hidden;
        border-right: none;
    }
    
    .bf-sidebar.is-collapsed * {
        opacity: 0;
        visibility: hidden;
    }
}

/* ==========================================
   DESKTOP LAYOUT (1024px)
   Activity Bar + Sidebar + Content
   ========================================== */
@media (min-width: 1024px) {
    .bf-main {
        flex-direction: row;
    }
    
    /* Activity Bar - Only on desktop */
    .bf-activity-bar {
        display: flex;
        flex-direction: column;
        width: var(--activity-bar-width);
        background: var(--bg-surface);
        border-right: 1px solid var(--border-muted);
        flex-shrink: 0;
    }
    
    .bf-tab {
        max-width: 200px;
    }
    
    /* Toggle icon rotation when collapsed */
    .bf-sidebar.is-collapsed + .bf-editor .bf-activity-item[data-action="toggle-sidebar"] i,
    .bf-app[data-sidebar="collapsed"] .bf-activity-item[data-action="toggle-sidebar"] i {
        transform: rotate(180deg);
    }
    
    .bf-activity-item[data-action="toggle-sidebar"] i {
        transition: transform var(--duration-slow) var(--ease-out);
    }
}

/* ==========================================
   ACTIVITY BAR (Desktop Only)
   ========================================== */
.bf-activity-bar {
    display: none;
    padding: var(--space-2) 0;
}

.bf-activity-bar__top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
}

.bf-activity-bar__bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.bf-activity-item {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.bf-activity-item:hover {
    color: var(--text-primary);
    background: var(--bg-muted);
}

.bf-activity-item.is-active {
    color: var(--text-primary);
    background: var(--accent-muted);
}

.bf-activity-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 24px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.bf-activity-item i {
    font-size: 1.25rem;
}

.bf-activity-item__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: var(--font-semibold);
    line-height: 16px;
    text-align: center;
    color: white;
    background: var(--accent);
    border-radius: var(--radius-full);
}

/* Tooltip */
.bf-activity-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    white-space: nowrap;
    z-index: var(--z-tooltip);
    box-shadow: var(--shadow-lg);
}
/**
 * ============================================
 * BIZFLOW STUDIO v5.1 - COMPONENTS
 * UI Components & Navigation
 * ============================================
 */

/* ==========================================
   USER PROFILE
   ========================================== */
.bf-user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-muted);
}

.bf-user-profile__avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--radius-lg);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    color: white;
}

.bf-user-profile__info {
    flex: 1;
    min-width: 0;
}

.bf-user-profile__name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bf-user-profile__email {
    font-size: var(--text-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================
   WORKSPACE CONTEXT
   ========================================== */
.bf-workspace {
    padding: var(--space-3) var(--space-4);
    background: var(--accent-muted);
    border-bottom: 1px solid var(--border-muted);
}

.bf-workspace__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 10px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: var(--space-2);
}

.bf-workspace__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.bf-workspace__icon {
    width: 20px;
    color: var(--text-muted);
    text-align: center;
}

.bf-workspace__text {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bf-workspace__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    margin-top: var(--space-2);
    padding: var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.bf-workspace__btn:hover {
    background: var(--accent);
    color: white;
}

/* ==========================================
   MODE TOGGLE
   ========================================== */
.bf-mode-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-muted);
}

.bf-mode-toggle__label {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.bf-mode-toggle__switch {
    position: relative;
    width: 40px;
    height: 20px;
    background: var(--border-default);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--duration-normal);
}

.bf-mode-toggle__switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration-normal) var(--ease-out);
}

.bf-mode-toggle__switch.is-active {
    background: var(--accent);
}

.bf-mode-toggle__switch.is-active::after {
    transform: translateX(20px);
}

.bf-mode-toggle__text {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
}

/* ==========================================
   NAVIGATION
   ========================================== */
.bf-nav {
    padding: var(--space-2) 0;
}

.bf-nav__section {
    padding: var(--space-3) var(--space-4) var(--space-1);
}

.bf-nav__title {
    font-size: 10px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.bf-nav__list {
    list-style: none;
}

/* Nav Item */
.bf-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    min-height: var(--touch-min);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--duration-fast);
    border-left: 2px solid transparent;
}

.bf-nav-item:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.bf-nav-item.is-active {
    background: var(--accent-muted);
    color: var(--text-primary);
    border-left-color: var(--accent);
}

.bf-nav-item__icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--bg-muted);
    color: var(--text-muted);
}

.bf-nav-item:hover .bf-nav-item__icon {
    color: var(--text-secondary);
}

/* Icon gradient variants */
.bf-nav-item__icon--blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}
.bf-nav-item__icon--green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}
.bf-nav-item__icon--purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}
.bf-nav-item__icon--amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}
.bf-nav-item__icon--rose {
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: white;
}
.bf-nav-item__icon--ai {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: white;
}

.bf-nav-item__text {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bf-nav-item__badge {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: var(--font-bold);
    color: white;
    background: var(--accent);
    border-radius: var(--radius-full);
}

.bf-nav-item__tag {
    padding: 2px 6px;
    font-size: 9px;
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    color: white;
}

.bf-nav-item__tag--pro {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}
.bf-nav-item__tag--new {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}
.bf-nav-item__tag--live {
    background: var(--error-500);
    animation: pulse 2s infinite;
}
.bf-nav-item__tag--ai {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ==========================================
   SIDEBAR FOOTER
   ========================================== */
.bf-logout-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--error-500);
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--duration-fast);
}

.bf-logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.bf-version {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================
   WELCOME SCREEN
   ========================================== */
.bf-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--space-6);
    text-align: center;
    overflow-y: auto;
}

.bf-welcome__icon {
    width: auto;
    height: auto;
    margin-bottom: var(--space-6);
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@media (min-width: 768px) {
    .bf-welcome__icon {
    width: auto;
    height: auto;
    margin-bottom: var(--space-6);
    background: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    animation: float 3s ease-in-out infinite;
}
}

.bf-welcome__title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

@media (min-width: 768px) {
    .bf-welcome__title {
        font-size: var(--text-3xl);
    }
}

.bf-welcome__title span {
    background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bf-welcome__subtitle {
    font-size: var(--text-md);
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 450px;
}

.bf-welcome__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    width: 100%;
    max-width: 500px;
}

@media (min-width: 480px) {
    .bf-welcome__actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .bf-welcome__actions {
        max-width: 600px;
    }
}

.bf-welcome__action {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    text-align: left;
}

.bf-welcome__action:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.bf-welcome__action:active {
    transform: translateY(0);
}

.bf-welcome__action-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    color: white;
}

.bf-welcome__action-info {
    flex: 1;
    min-width: 0;
}

.bf-welcome__action-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.bf-welcome__action-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.bf-toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

@media (min-width: 480px) {
    .bf-toast-container {
        left: auto;
        width: 360px;
    }
}

.bf-toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
    animation: slideIn 0.3s var(--ease-out);
}

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

.bf-toast--success { border-left: 3px solid var(--success-500); }
.bf-toast--error { border-left: 3px solid var(--error-500); }
.bf-toast--warning { border-left: 3px solid var(--warning-500); }
.bf-toast--info { border-left: 3px solid var(--info-500); }

.bf-toast__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.bf-toast--success .bf-toast__icon { color: var(--success-500); }
.bf-toast--error .bf-toast__icon { color: var(--error-500); }
.bf-toast--warning .bf-toast__icon { color: var(--warning-500); }
.bf-toast--info .bf-toast__icon { color: var(--info-500); }

.bf-toast__message {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.bf-toast__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.bf-toast__close:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* ==========================================
   COMMAND PALETTE
   ========================================== */
.bf-command-palette {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 15vh var(--space-4) var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

.bf-command-palette.is-open {
    opacity: 1;
    visibility: visible;
}

.bf-command-palette__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.bf-command-palette__modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--duration-normal) var(--ease-out);
}

.bf-command-palette.is-open .bf-command-palette__modal {
    transform: scale(1);
}

.bf-command-palette__search {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-muted);
}

.bf-command-palette__search i {
    font-size: 1.125rem;
    color: var(--text-muted);
}

.bf-command-palette__search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: var(--text-lg);
    font-family: var(--font-sans);
    color: var(--text-primary);
}

.bf-command-palette__search input::placeholder {
    color: var(--text-muted);
}

.bf-command-palette__search kbd {
    padding: 4px 8px;
    font-size: var(--text-xs);
    color: var(--text-muted);
    background: var(--bg-muted);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-sm);
}

.bf-command-palette__results {
    max-height: 50vh;
    overflow-y: auto;
    padding: var(--space-2);
}

/* ==========================================
   BUTTONS
   ========================================== */
.bf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    min-height: var(--touch-min);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

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

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

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

.bf-btn--secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
}

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

.bf-btn--ghost:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.bf-btn--icon {
    width: var(--touch-min);
    padding: 0;
}

@media (min-width: 768px) {
    .bf-btn {
        min-height: 36px;
    }
    
    .bf-btn--icon {
        width: 36px;
    }
}

/* ==========================================
   SAFE AREA INSETS (iOS)
   ========================================== */
@supports (padding: max(0px)) {
    .bf-header {
        padding-left: max(var(--space-3), env(safe-area-inset-left));
        padding-right: max(var(--space-3), env(safe-area-inset-right));
    }
    
    .bf-statusbar {
        padding-left: max(var(--space-2), env(safe-area-inset-left));
        padding-right: max(var(--space-2), env(safe-area-inset-right));
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .bf-toast-container {
        top: max(var(--space-4), env(safe-area-inset-top));
        right: max(var(--space-4), env(safe-area-inset-right));
    }
}


