/* RetailIQ — E-Commerce Analytics Styles */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --accent: #3b82f6;
    --accent-light: #f1f5f9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 14px;
    --radius-sm: 10px;
}

[data-theme="dark"] {
    --bg-primary: #18181b;
    --bg-secondary: #27272a;
    --bg-card: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #d4d4d8;
    --text-muted: #71717a;
    --border-color: #3f3f46;
    --accent-light: #3f3f46;
    --sidebar-bg: #09090b;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.logo svg { width: 32px; height: 32px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    display: block;
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sidebar-text);
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--sidebar-active);
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: var(--sidebar-active);
    background: rgba(249, 115, 22, 0.2);
    border-right: 3px solid var(--accent);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.store-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.store-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.store-details {
    display: flex;
    flex-direction: column;
}

.store-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.store-plan {
    color: var(--sidebar-text);
    font-size: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
    stroke: var(--text-primary);
    stroke-width: 2;
}

.search-bar {
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    stroke-width: 2;
    fill: none;
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--accent);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-secondary);
    stroke-width: 2;
    fill: none;
}

.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.sync-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-btn:hover {
    background: #ea580c;
}

.sync-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Pages */
.page {
    display: none;
    padding: 24px;
}

.page.active { display: block; }

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

.page-title {
    font-size: 28px;
    font-weight: 700;
}

/* Date Filter */
.date-filter select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-card.revenue .kpi-icon { background: #dcfce7; }
.kpi-card.revenue .kpi-icon svg { stroke: #16a34a; }
.kpi-card.orders .kpi-icon { background: #dbeafe; }
.kpi-card.orders .kpi-icon svg { stroke: #2563eb; }
.kpi-card.conversion .kpi-icon { background: #fef3c7; }
.kpi-card.conversion .kpi-icon svg { stroke: #d97706; }
.kpi-card.aov .kpi-icon { background: #f3e8ff; }
.kpi-card.aov .kpi-icon svg { stroke: #9333ea; }

.kpi-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    fill: none;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.kpi-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.kpi-change {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

.kpi-chart {
    width: 80px;
    height: 40px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
}

.kpi-chart .bar {
    flex: 1;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.6;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.chart-tab {
    padding: 6px 12px;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.chart-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
}

.chart-container {
    height: 280px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 20px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(to top, var(--accent), #fb923c);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

.chart-bar-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Channel Stats */
.channel-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.channel-info { flex: 1; }

.channel-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.channel-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.channel-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.channel-value {
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
}

/* Data Row */
.data-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.data-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.view-all {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.view-all:hover { text-decoration: underline; }

/* Product List */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.product-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.product-info { flex: 1; }

.product-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.product-sku {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

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

.product-units {
    font-size: 14px;
    font-weight: 600;
}

.product-revenue {
    font-size: 12px;
    color: var(--text-muted);
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.order-id {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    min-width: 90px;
}

.order-info { flex: 1; }

.order-customer {
    font-size: 14px;
    margin-bottom: 2px;
}

.order-items {
    font-size: 12px;
    color: var(--text-muted);
}

.order-amount {
    font-family: var(--font-mono);
    font-weight: 600;
}

.order-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.order-status.pending { background: #fef3c7; color: #92400e; }
.order-status.processing { background: #dbeafe; color: #1e40af; }
.order-status.shipped { background: #e0e7ff; color: #4338ca; }
.order-status.delivered { background: #dcfce7; color: #166534; }

/* AI Insights Banner */
.ai-insights-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-radius: var(--radius);
    color: #fff;
}

.ai-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-icon svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

.ai-content { flex: 1; }

.ai-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-content p {
    font-size: 14px;
    opacity: 0.9;
}

.ai-action-btn {
    padding: 10px 20px;
    background: #fff;
    color: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-action-btn:hover {
    transform: translateY(-2px);
}

/* Buttons */
.primary-btn, .secondary-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.primary-btn:hover { background: #ea580c; }

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

.secondary-btn:hover { border-color: var(--accent); }

.primary-btn svg, .secondary-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

.filters-bar select, .filters-bar input[type="date"] {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

/* Data Table */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
}

.data-table td {
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

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

.action-btn:hover svg { stroke: #fff; }

.action-btn svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-muted);
    stroke-width: 2;
    fill: none;
}

/* Stock Status */
.stock-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.stock-status.in-stock { background: #dcfce7; color: #166534; }
.stock-status.low-stock { background: #fef3c7; color: #92400e; }
.stock-status.out-of-stock { background: #fee2e2; color: #991b1b; }

/* Order Stats */
.order-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.order-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.pending { background: #fef3c7; }
.stat-icon.pending svg { stroke: #d97706; }
.stat-icon.processing { background: #dbeafe; }
.stat-icon.processing svg { stroke: #2563eb; }
.stat-icon.shipped { background: #e0e7ff; }
.stat-icon.shipped svg { stroke: #4338ca; }
.stat-icon.delivered { background: #dcfce7; }
.stat-icon.delivered svg { stroke: #16a34a; }

.stat-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    fill: none;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* Inventory */
.inventory-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.inv-card {
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.inv-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.inv-value {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.inv-card.low-stock .inv-value { color: var(--warning); }
.inv-card.out-of-stock .inv-value { color: var(--danger); }

.inventory-alerts {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow: hidden;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fef3c7;
    border-bottom: 1px solid #fde68a;
}

.alert-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
}

.alert-count {
    font-size: 13px;
    color: #92400e;
}

.alert-list {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.alert-item .product-name {
    flex: 1;
}

.alert-item .stock-qty {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--danger);
}

.alert-item .reorder-btn {
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* Customers */
.customer-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.cust-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.cust-stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.cust-stat-label {
    font-size: 14px;
    color: var(--text-muted);
}

.customers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.customer-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.customer-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.customer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 18px;
}

.customer-name {
    font-size: 16px;
    font-weight: 600;
}

.customer-email {
    font-size: 13px;
    color: var(--text-muted);
}

.customer-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.customer-metric {
    text-align: center;
}

.customer-metric-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.customer-metric-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Analytics */
.analytics-controls {
    display: flex;
    gap: 12px;
}

.analytics-controls select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.summary-label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.summary-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.summary-change {
    font-size: 12px;
}

.summary-change.positive { color: var(--success); }
.summary-change.negative { color: var(--danger); }

.analytics-chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

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

.chart-legend {
    display: flex;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.analytics-chart {
    height: 300px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding-top: 20px;
}

.breakdown-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.breakdown-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.breakdown-card h4 {
    font-size: 14px;
    margin-bottom: 16px;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.breakdown-item .source {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakdown-item .value {
    font-weight: 600;
    font-family: var(--font-mono);
}

.device-chart {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* Predictions */
.ai-badge {
    padding: 6px 12px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.prediction-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pred-tab {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.pred-tab:hover { border-color: var(--accent); }

.pred-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.prediction-panel {
    display: none;
}

.prediction-panel.active { display: block; }

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

.confidence-badge {
    padding: 6px 12px;
    background: #dcfce7;
    color: #166534;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.forecast-chart {
    height: 300px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.forecast-insights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.insight-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.insight-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.insight-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Revenue Forecast */
.revenue-forecast {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.forecast-number {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.forecast-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.forecast-value {
    display: block;
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
    margin-bottom: 8px;
}

.forecast-range {
    font-size: 13px;
    color: var(--text-muted);
}

.forecast-breakdown {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.forecast-breakdown h4 {
    margin-bottom: 16px;
}

.driver-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.driver-item:last-child { border-bottom: none; }

/* Churn */
.churn-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.churn-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.churn-count {
    display: block;
    font-size: 48px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.churn-stat.high .churn-count { color: var(--danger); }
.churn-stat.medium .churn-count { color: var(--warning); }
.churn-stat.low .churn-count { color: var(--success); }

.churn-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

.at-risk-customers {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.at-risk-customers h4 { margin-bottom: 16px; }

.at-risk-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.at-risk-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* Trends */
.trends-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.trend-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.trend-icon { font-size: 32px; }

.trend-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.trend-change {
    font-size: 13px;
}

.trend-card.rising .trend-change { color: var(--success); }
.trend-card.stable .trend-change { color: var(--info); }
.trend-card.falling .trend-change { color: var(--danger); }

/* Recommendations */
.rec-categories {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.rec-category {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.rec-category:hover { border-color: var(--accent); }

.rec-category.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

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

.rec-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommendation-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.rec-priority {
    width: 4px;
    border-radius: 2px;
}

.rec-priority.high { background: var(--danger); }
.rec-priority.medium { background: var(--warning); }
.rec-priority.low { background: var(--success); }

.rec-content { flex: 1; }

.rec-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.rec-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.rec-impact {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

.rec-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rec-actions button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Segmentation */
.segmentation-visual {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-bottom: 24px;
}

.segment-chart {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.segment-legend {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 20px;
}

.legend-item-full {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.legend-item-full:last-child { border-bottom: none; }

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.segments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.segment-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.segment-name {
    font-size: 16px;
    font-weight: 600;
}

.segment-count {
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 13px;
}

.segment-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.segment-metric {
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* Campaigns */
.campaign-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.camp-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.camp-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 4px;
}

.camp-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.campaign-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.campaign-status.active { background: #dcfce7; color: #166534; }
.campaign-status.paused { background: #fef3c7; color: #92400e; }
.campaign-status.ended { background: #e2e8f0; color: #475569; }

/* Promotions */
.promotions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.promo-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.promo-badge {
    padding: 4px 12px;
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.promo-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.promo-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.promo-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.promo-stat {
    text-align: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.coupons-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border-color);
}

.coupons-section h3 { margin-bottom: 16px; }

.coupon-code {
    font-family: var(--font-mono);
    font-weight: 600;
    background: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.coupon-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.coupon-status.active { background: #dcfce7; color: #166534; }
.coupon-status.expired { background: #fee2e2; color: #991b1b; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 200;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

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

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.modal-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--text-muted);
    stroke-width: 2;
}

.modal-body { padding: 20px; }

/* Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--success);
    animation: toastIn 0.3s ease;
}

.toast.error { border-left-color: var(--danger); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open { transform: translateX(0); }
    
    .main-content { margin-left: 0; }
    
    .menu-toggle { display: block; }
    
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    
    .charts-row, .data-row { grid-template-columns: 1fr; }
    
    .order-stats, .inventory-summary { grid-template-columns: repeat(2, 1fr); }
    
    .analytics-summary, .customer-stats { grid-template-columns: repeat(2, 1fr); }
    
    .breakdown-row { grid-template-columns: 1fr; }
    
    .revenue-forecast { grid-template-columns: 1fr; }
    
    .segmentation-visual { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .page { padding: 16px; }
    
    .page-header { flex-direction: column; gap: 16px; align-items: flex-start; }
    
    .kpi-grid, .order-stats, .inventory-summary { grid-template-columns: 1fr; }
    
    .churn-overview { grid-template-columns: 1fr; }
    
    .forecast-insights { grid-template-columns: 1fr; }
    
    .trends-grid { grid-template-columns: 1fr; }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 99;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}
