margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
            background: #f5f5f7;
            min-height: 100vh;
        }

        /* Sidebar Styles */
        .sidebar {
            width: 280px;
            background: rgba(255, 255, 255, 0.98);
            height: 100vh;
            position: fixed;
            left: 0;
            top: 0;
            overflow-y: auto;
            box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease;
            z-index: 100;
        }

        .sidebar.collapsed {
            transform: translateX(-280px);
        }

        .sidebar-header {
            padding: 20px;
            border-bottom: 2px solid #f0f0f0;
            position: sticky;
            top: 0;
            background: rgba(255, 255, 255, 0.98);
            z-index: 10;
        }

        .sidebar-title {
            font-size: 18px;
            font-weight: 700;
            color: #1d1d1f;
            margin-bottom: 5px;
        }

        .sidebar-subtitle {
            font-size: 12px;
            color: #6e6e73;
        }

        .category-section {
            border-bottom: 1px solid #f0f0f0;
        }

        .category-header {
            padding: 15px 20px;
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background 0.2s ease;
            user-select: none;
        }

        .category-header:hover {
            background: #f5f5f7;
        }

        .category-name {
            font-size: 14px;
            font-weight: 600;
            color: #1d1d1f;
        }

        .category-count {
            font-size: 11px;
            color: #6e6e73;
            background: #f0f0f0;
            padding: 3px 8px;
            border-radius: 10px;
        }

        .category-arrow {
            font-size: 12px;
            color: #6e6e73;
            transition: transform 0.2s ease;
        }

        .category-section.expanded .category-arrow {
            transform: rotate(90deg);
        }

        .stock-list {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .category-section.expanded .stock-list {
            max-height: 1000px;
        }

        .stock-item {
            padding: 10px 20px 10px 35px;
            cursor: pointer;
            transition: background 0.2s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .stock-item:hover {
            background: #f5f5f7;
        }

        .stock-item.active {
            background: #667eea;
            color: white;
        }

        .stock-ticker-sidebar {
            font-size: 13px;
            font-weight: 600;
        }

        .stock-name-sidebar {
            font-size: 11px;
            color: #6e6e73;
            margin-top: 2px;
        }

        .stock-item.active .stock-name-sidebar {
            color: rgba(255, 255, 255, 0.8);
        }

        .toggle-sidebar {
            position: fixed;
            left: 280px;
            top: 20px;
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.95);
            border: none;
            border-radius: 0 10px 10px 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
            box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            z-index: 99;
        }

        .sidebar.collapsed ~ .toggle-sidebar {
            left: 0;
            border-radius: 0 10px 10px 0;
        }

        .toggle-sidebar:hover {
            background: white;
            transform: scale(1.1);
        }

        /* Main Content Area */
        .main-content {
            margin-left: 280px;
            padding: 20px;
            transition: margin-left 0.3s ease;
        }

        .sidebar.collapsed ~ .main-content {
            margin-left: 0;
        }

        /* Header Section */
        .header {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            padding: 30px;
            margin-bottom: 20px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        }

        h1 {
            font-size: 36px;
            font-weight: 700;
            color: #1d1d1f;
            margin-bottom: 10px;
        }

        .subtitle {
            color: #6e6e73;
            font-size: 18px;
            margin-bottom: 25px;
        }

        .controls {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
            align-items: center;
        }

        .search-box {
            flex: 0 1 auto;
            min-width: 250px;
            max-width: 350px;
            position: relative;
        }

        .search-box input {
            width: 100%;
            padding: 12px 20px;
            border: 2px solid #e5e5e7;
            border-radius: 12px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .search-box input:focus {
            outline: none;
            border-color: #667eea;
        }

        .filter-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .filter-btn {
            padding: 10px 16px;
            border: 2px solid #e5e5e7;
            background: white;
            border-radius: 12px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .filter-btn:hover {
            border-color: #667eea;
        }

        .filter-btn.active {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        /* Two Column Layout */
        .two-column-layout {
            display: grid;
            grid-template-columns: minmax(400px, 1fr) minmax(500px, 1.5fr);
            gap: 20px;
            align-items: start;
        }

        /* Left Column: Stock Cards */
        .stock-cards-column {
            background: transparent;
        }

        .stock-grid {
            display: grid;
            gap: 15px;
        }

        .stock-card {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 16px;
            padding: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }

        .stock-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
        }

        .stock-card.selected {
            border: 2px solid #667eea;
            box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
        }

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

        .stock-ticker {
            font-size: 20px;
            font-weight: 700;
            color: #1d1d1f;
        }

        .stock-price {
            font-size: 18px;
            font-weight: 600;
            color: #1d1d1f;
        }

        .stock-name {
            font-size: 13px;
            color: #6e6e73;
            margin-bottom: 12px;
        }

        .stock-category {
            font-size: 11px;
            color: #667eea;
            background: rgba(102, 126, 234, 0.1);
            padding: 4px 8px;
            border-radius: 6px;
            display: inline-block;
            margin-bottom: 12px;
        }

        .stock-metrics {
            display: flex;
            gap: 15px;
            flex-wrap: wrap;
        }

        .metric {
            flex: 1;
            min-width: 80px;
        }

        .metric-label {
            font-size: 11px;
            color: #6e6e73;
            margin-bottom: 3px;
        }

        .metric-value {
            font-size: 14px;
            font-weight: 600;
        }

        .metric-value.positive {
            color: #34c759;
        }

        .metric-value.negative {
            color: #ff3b30;
        }

        /* Right Column: Chart Panel */
        .chart-column {
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
            position: sticky;
            top: 20px;
            max-height: calc(100vh - 40px);
            overflow-y: auto;
            display: none;
        }

        .chart-column.active {
            display: block;
        }

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

        .chart-ticker {
            font-size: 24px;
            font-weight: 700;
            color: #1d1d1f;
            margin-bottom: 5px;
        }

        .close-chart-btn {
            width: 36px;
            height: 36px;
            border: none;
            background: #f5f5f7;
            border-radius: 50%;
            font-size: 20px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .close-chart-btn:hover {
            background: #e5e5e7;
            transform: scale(1.1);
        }

        .time-range-buttons {
            display: flex;
            gap: 10px;
            margin-bottom: 20px;
            flex-wrap: wrap;
        }

        .time-btn {
            padding: 6px 12px;
            border: 2px solid #e5e5e7;
            background: white;
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .time-btn:hover {
            border-color: #667eea;
        }

        .time-btn.active {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .main-chart {
            height: 400px;
            margin-bottom: 20px;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 15px;
        }

        .stat-card {
            background: #f5f5f7;
            padding: 15px;
            border-radius: 12px;
        }

        .stat-label {
            font-size: 12px;
            color: #6e6e73;
            margin-bottom: 5px;
        }

        .stat-value {
            font-size: 20px;
            font-weight: 700;
            color: #1d1d1f;
        }

        /* Ecosystem Toggle Button */
        .ecosystem-toggle-btn {
            width: 100%;
            padding: 15px 20px;
            margin-top: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .ecosystem-toggle-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
        }

        .toggle-icon {
            font-size: 18px;
        }

        .toggle-arrow {
            font-size: 12px;
            transition: transform 0.3s ease;
        }

        .ecosystem-toggle-btn.active .toggle-arrow {
            transform: rotate(180deg);
        }

        /* Ecosystem Card */
        .ecosystem-card {
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            border-radius: 16px;
            padding: 25px;
            margin-top: 15px;
            display: none;
            animation: slideDown 0.3s ease;
        }

        .ecosystem-card.active {
            display: block;
        }

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

        .ecosystem-header h3 {
            font-size: 20px;
            font-weight: 700;
            color: #1d1d1f;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .detailed-analysis-btn {
            width: 100%;
            padding: 15px 20px;
            margin-bottom: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            font-size: 15px;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        .detailed-analysis-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
        }

        .btn-icon {
            font-size: 20px;
        }

        .btn-arrow {
            font-size: 18px;
            transition: transform 0.3s ease;
        }

        .detailed-analysis-btn:hover .btn-arrow {
            transform: translateX(5px);
        }
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        }

        .detailed-analysis-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .ecosystem-section {
            background: white;
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 15px;
        }

        .ecosystem-section:last-child {
            margin-bottom: 0;
        }

        .ecosystem-section h4 {
            font-size: 16px;
            font-weight: 600;
            color: #1d1d1f;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .ecosystem-text {
            font-size: 14px;
            line-height: 1.6;
            color: #4a4a4a;
        }

        .related-companies-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 10px;
        }

        .related-company-chip {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
        }

        .related-company-chip:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        .related-company-name {
            font-weight: 700;
            margin-bottom: 2px;
        }

        .related-company-relation {
            font-size: 10px;
            opacity: 0.9;
        }

        .ecosystem-flow {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .ecosystem-layer {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 12px;
            border-left: 4px solid #667eea;
        }

        .layer-title {
            font-size: 13px;
            font-weight: 600;
            color: #667eea;
            margin-bottom: 8px;
        }

        .layer-items {
            font-size: 12px;
            color: #4a4a4a;
            line-height: 1.5;
        }

        .loading {
            text-align: center;
            padding: 40px;
            color: #6e6e73;
            font-size: 18px;
        }

        .error {
            background: #ff3b30;
            color: white;
            padding: 15px;
            border-radius: 12px;
            margin-bottom: 20px;
        }

        /* Mobile Responsive */
        @media (max-width: 1200px) {
            .two-column-layout {
                display: block;
            }

            .stock-cards-column {
                width: 100%;
            }

            .stock-grid {
                display: block;
                /* Removed flex - using block so DOM order is preserved */
            }
            
            .stock-card {
                margin-bottom: 15px;
            }

            .chart-column {
                position: relative;
                top: 0;
                max-height: none;
                margin-bottom: 0;
                width: 100%;
                /* Removed order: 999 - let DOM position control it */
            }

            .chart-column.active {
                display: block;
                margin-bottom: 15px;
            }

            /* Mobile: Hide ecosystem card by default, show toggle button */
            .ecosystem-card {
                display: none;
            }

            .ecosystem-card.active {
                display: block;
            }

            .main-content {
                padding: 10px;
            }

            .header {
                padding: 20px;
            }

            h1 {
                font-size: 28px;
            }
        }

        /* Desktop: Show ecosystem card, hide toggle button */
        @media (min-width: 1201px) {
            .ecosystem-toggle-btn {
                display: none;
            }

            .ecosystem-card {
                display: block !important;
            }
        }

        @media (max-width: 768px) {
            .sidebar {
                transform: translateX(-280px);
            }

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

            .toggle-sidebar {
                left: 0;
            }

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

            .stock-metrics {
                flex-direction: column;
            }

            .controls {
                flex-direction: column;
            }

            .filter-buttons {
                width: 100%;
            }

            .filter-btn {
                flex: 1;
            }
