* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.85rem, 3vw, 1.5rem);
    font-weight: 700;
    flex: 1;
    min-width: 0;
}

.gold-icon {
    color: #FFD700;
    font-size: clamp(1.5rem, 5vw, 2rem);
    flex-shrink: 0;
}

.logo-image {
    height: clamp(50px, 12vw, 120px);
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.live-price {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #FFD700;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.price-value {
    font-size: clamp(0.9rem, 3vw, 1.25rem);
    font-weight: 600;
    color: #FFD700;
    white-space: nowrap;
}

.price-change {
    color: #4CAF50;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    white-space: nowrap;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 0 0 auto;
    min-width: 90px;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.75rem, 2.5vw, 0.95rem);
    color: #666;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(255, 215, 0, 0.1);
}

.tab-btn.active {
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.kpi-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.kpi-card:active {
    transform: scale(0.98);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-title {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    color: #666;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    color: #FFD700;
    flex-shrink: 0;
}

.kpi-value {
    font-size: clamp(2rem, 7vw, 2.5rem);
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    word-break: break-word;
}

.kpi-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    flex-wrap: wrap;
}

.positive { color: #4CAF50; }
.negative { color: #f44336; }

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.chart-title {
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a1a1a;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

.alerts-panel {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #FFC107;
}

.alert-icon {
    color: #FF9800;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    line-height: 1.5;
    min-width: 0;
}

.alert-text strong {
    display: block;
    margin-bottom: 0.25rem;
}

.ai-insights {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.ai-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.ai-recommendations {
    display: grid;
    gap: 1rem;
}

.recommendation {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    line-height: 1.6;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Price Calculator */
.price-calculator {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    margin-top: 1.5rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    color: #666;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
}

.input-group input {
    padding: 0.875rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: clamp(0.9rem, 3vw, 1rem);
    transition: border-color 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: #FFD700;
}

.result-display {
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.result-label {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 700;
    word-break: break-word;
}

/* Customer List */
.customer-list {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.customer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #f8f9fa;
    transition: transform 0.2s ease;
    gap: 1rem;
}

.customer-item:hover {
    transform: translateX(5px);
    background: #f0f0f0;
}

.customer-item:active {
    transform: scale(0.98);
}

.customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-weight: 600;
    font-size: clamp(0.9rem, 3vw, 1rem);
    margin-bottom: 0.25rem;
}

.customer-details {
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    color: #666;
}

.customer-status {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.customer-status.active {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.customer-status.risk {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.customer-status.warning {
    background: rgba(255, 193, 7, 0.1);
    color: #FFC107;
}

/* Insights Tab */
.insights-header {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.insights-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    color: #1a1a1a;
}

.insights-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    color: #666;
}

.loading-pulse {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.insights-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.insight-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.insight-header i {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    color: #FFD700;
}

.insight-header h3 {
    font-size: clamp(1rem, 3.5vw, 1.1rem);
    font-weight: 600;
}

.insight-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Predictions */
.prediction-item {
    padding: 1rem;
    background: rgba(255, 215, 0, 0.05);
    border-radius: 8px;
    border-left: 4px solid #FFD700;
}

.prediction-label {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    color: #666;
    margin-bottom: 0.5rem;
}

.prediction-value {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.prediction-confidence {
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    color: #4CAF50;
}

/* Optimizations */
.optimization-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    line-height: 1.6;
    font-size: clamp(0.85rem, 2.5vw, 0.9rem);
}

/* Risks */
.risk-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

.risk-item.high {
    background: rgba(244, 67, 54, 0.1);
    border-left: 4px solid #f44336;
}

.risk-item.medium {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #FFC107;
}

.risk-item.low {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4CAF50;
}

.risk-level {
    font-weight: 700;
    min-width: 60px;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.risk-item.high .risk-level {
    color: #f44336;
}

.risk-item.medium .risk-level {
    color: #FFC107;
}

.risk-item.low .risk-level {
    color: #4CAF50;
}

.risk-description {
    flex: 1;
    color: #333;
    font-size: clamp(0.85rem, 2.5vw, 0.9rem);
}

/* Opportunities */
.opportunity-item {
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(255, 160, 0, 0.05) 100%);
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.2);
}

.opportunity-title {
    font-size: clamp(0.95rem, 3vw, 1rem);
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.opportunity-item p {
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-size: clamp(0.85rem, 2.5vw, 0.9rem);
}

.opportunity-potential {
    font-size: clamp(1.15rem, 4vw, 1.25rem);
    font-weight: 700;
    color: #4CAF50;
}

/* Responsive */
@media (min-width: 640px) {
    .kpi-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .container {
        padding: 2rem 1rem;
    }
    
    .header {
        padding: 1.5rem 2rem;
    }
    
    .charts-grid {
        grid-template-columns: 2fr 1fr;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    
    .insights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kpi-cards {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .kpi-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}