/* =============================================
   Aitas — Дэшборд управления продажами
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    /* Color Palette — Light Beige */
    --bg-primary: #f5f0e8;
    --bg-secondary: #efe9df;
    --bg-card: #ffffff;
    --bg-card-hover: #faf7f2;
    --bg-sidebar: #faf6f0;
    --bg-input: #f0ebe3;

    --border: rgba(0, 0, 0, 0.07);
    --border-active: rgba(120, 80, 40, 0.25);

    --text-primary: #2c2418;
    --text-secondary: #7a6e5d;
    --text-muted: #a89c8a;
    --text-accent: #8b5e3c;

    /* Accent Colors */
    --accent: #a0714a;
    --accent-soft: rgba(160, 113, 74, 0.12);
    --accent-glow: rgba(160, 113, 74, 0.15);

    --green: #3a9a5c;
    --green-soft: rgba(58, 154, 92, 0.10);
    --red: #c94a3a;
    --red-soft: rgba(201, 74, 58, 0.10);
    --orange: #c88b2e;
    --orange-soft: rgba(200, 139, 46, 0.10);
    --blue: #4a7fc9;
    --blue-soft: rgba(74, 127, 201, 0.10);
    --purple: #8a5fb5;
    --purple-soft: rgba(138, 95, 181, 0.10);
    --cyan: #2a9aad;
    --cyan-soft: rgba(42, 154, 173, 0.10);

    /* Chart Colors */
    --chart-1: #a0714a;
    --chart-2: #3a9a5c;
    --chart-3: #c88b2e;
    --chart-4: #c94a3a;
    --chart-5: #4a7fc9;
    --chart-6: #8a5fb5;
    --chart-7: #2a9aad;

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-card: 0 4px 24px rgba(120, 100, 70, 0.08);
    --shadow-glow: 0 0 40px rgba(160, 113, 74, 0.06);
    --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.18);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    transition: width var(--transition-smooth), transform var(--transition-smooth);
}

.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #a0714a, #c9956a);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: white; flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(160, 113, 74, 0.25);
}
.logo-text { display: flex; flex-direction: column; }
.logo-title {
    font-weight: 800; font-size: 1.15rem; letter-spacing: -0.5px;
    color: #5a3e24; background: none; -webkit-text-fill-color: initial;
}
.logo-subtitle {
    font-size: 0.72rem; color: var(--text-muted);
    font-weight: 500; letter-spacing: 1px; text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section-label {
    font-size: 0.68rem; font-weight: 700; color: var(--text-muted);
    letter-spacing: 1.5px; text-transform: uppercase; padding: 16px 12px 8px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 0.92rem; font-weight: 500;
    transition: all var(--transition-fast); margin-bottom: 2px;
    position: relative;
}
.nav-item:hover { background: rgba(0, 0, 0, 0.03); color: var(--text-primary); }
.nav-item.active { background: var(--accent-soft); color: var(--text-accent); }
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%); width: 3px; height: 20px;
    background: var(--accent); border-radius: 0 4px 4px 0;
}
.nav-item i { font-size: 1.2rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #a0714a, #8a5fb5);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 700; color: white; flex-shrink: 0;
}
.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* Planning Period Buttons */
.plan-period-btn {
    padding: 5px 14px; border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-card); font-size: 0.75rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer; transition: all 0.15s;
    font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.5px;
}
.plan-period-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.plan-period-btn.active {
    background: var(--accent); color: white; border-color: var(--accent);
}

/* SIDEBAR OVERLAY (mobile) */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px); z-index: 99;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-width); flex: 1;
    min-height: 100vh; transition: margin-left var(--transition-smooth);
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height); display: flex;
    align-items: center; justify-content: space-between;
    padding: 0 28px; border-bottom: 1px solid var(--border);
    background: rgba(245, 240, 232, 0.85);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1.3rem; cursor: pointer; padding: 6px; border-radius: 6px;
    transition: all var(--transition-fast);
}
.menu-toggle:hover { background: rgba(0,0,0,0.04); color: var(--text-primary); }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.breadcrumb-home { color: var(--text-muted); }
.breadcrumb i.ri-arrow-right-s-line { color: var(--text-muted); font-size: 1rem; }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 20px; }
.period-selector {
    display: flex; background: var(--bg-card);
    border-radius: var(--radius-sm); padding: 3px; border: 1px solid var(--border);
}
.period-btn {
    padding: 6px 14px; border: none; background: none;
    color: var(--text-secondary); font-family: inherit;
    font-size: 0.8rem; font-weight: 500; border-radius: 6px;
    cursor: pointer; transition: all var(--transition-fast);
}
.period-btn:hover { color: var(--text-primary); }
.period-btn.active {
    background: var(--accent); color: white;
    box-shadow: 0 2px 8px rgba(160, 113, 74, 0.3);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.action-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; transition: all var(--transition-fast);
}
.action-btn:hover {
    background: var(--bg-card-hover); color: var(--text-primary);
    border-color: var(--border-active);
}
.live-indicator {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.72rem; font-weight: 700; color: var(--green);
    letter-spacing: 1px; padding: 6px 12px;
    background: var(--green-soft); border-radius: 20px;
}
.live-dot {
    width: 7px; height: 7px; background: var(--green);
    border-radius: 50%; animation: pulse-live 2s ease-in-out infinite;
}
@keyframes pulse-live {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* =============================================
   MODULES
   ============================================= */
.module { display: none; padding: 24px 28px; animation: fadeInModule 0.4s ease; }
.module.active { display: block; }
@keyframes fadeInModule {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =============================================
   KPI CARDS
   ============================================= */
.kpi-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    transition: all var(--transition-normal); position: relative; overflow: hidden;
}
.kpi-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0; transition: opacity var(--transition-normal);
}
.kpi-card:hover {
    border-color: var(--border-active); transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.kpi-card:hover::before { opacity: 1; }
.kpi-card-accent {
    background: linear-gradient(135deg, rgba(160, 113, 74, 0.06), rgba(138, 95, 181, 0.04));
    border-color: rgba(160, 113, 74, 0.18);
}
.kpi-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.kpi-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.kpi-badge {
    font-size: 0.72rem; font-weight: 600; padding: 3px 8px;
    border-radius: 20px; display: flex; align-items: center; gap: 2px;
}
.badge-up-green { background: var(--green-soft); color: var(--green); }
.badge-up-red { background: var(--red-soft); color: var(--red); }
.badge-down-green { background: var(--green-soft); color: var(--green); }
.badge-down-red { background: var(--red-soft); color: var(--red); }
.badge-neutral { background: rgba(0, 0, 0, 0.04); color: var(--text-secondary); }
.badge-warn { background: var(--orange-soft); color: var(--orange); }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; line-height: 1.2; }
.kpi-unit { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.kpi-footer { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.kpi-fact, .kpi-forecast { font-size: 0.75rem; color: var(--text-muted); }
.kpi-progress { height: 4px; background: rgba(0, 0, 0, 0.06); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.kpi-progress-bar { height: 100%; border-radius: 2px; transition: width 1s ease; }
.bar-green { background: linear-gradient(90deg, #16a34a, var(--green)); }
.bar-blue { background: linear-gradient(90deg, #2563eb, var(--blue)); }
.bar-orange { background: linear-gradient(90deg, #d97706, var(--orange)); }
.bar-purple { background: linear-gradient(90deg, #7c3aed, var(--purple)); }
.kpi-share { font-size: 0.72rem; color: var(--text-muted); }

/* =============================================
   CHART CARDS
   ============================================= */
.charts-row {
    display: flex; flex-wrap: wrap;
    gap: 16px; margin-bottom: 20px;
}
.chart-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 14px 16px;
    transition: all var(--transition-normal);
    flex: 1; min-width: 0; min-height: 0;
    overflow: hidden;
    display: flex; flex-direction: column;
}
.chart-card:hover { border-color: var(--border-active); }
.chart-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
    flex-shrink: 0;
}
.chart-header h3 {
    font-size: 0.95rem; font-weight: 600; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.chart-header h3 i { color: var(--text-accent); font-size: 1.1rem; }
.chart-actions {
    display: flex; gap: 4px; background: var(--bg-secondary);
    border-radius: 6px; padding: 2px;
}
.chart-btn {
    padding: 5px 12px; border: none; background: none;
    color: var(--text-muted); font-family: inherit;
    font-size: 0.75rem; font-weight: 500; border-radius: 4px;
    cursor: pointer; transition: all var(--transition-fast);
}
.chart-btn:hover { color: var(--text-secondary); }
.chart-btn.active { background: var(--accent); color: white; }
.chart-body { position: relative; height: 280px; overflow: hidden; }
.chart-body canvas { display: block; }

/* =============================================
   DATA TABLE
   ============================================= */
.sku-table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.85rem; }
.data-table thead th {
    background: var(--bg-secondary); color: var(--text-secondary);
    font-weight: 600; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.5px; padding: 12px 14px; text-align: left;
    border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.data-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: rgba(0, 0, 0, 0.02); }
.data-table tbody td {
    padding: 12px 14px; border-bottom: 1px solid var(--border);
    color: var(--text-primary); vertical-align: middle;
}
.sku-code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem; color: var(--text-accent);
    background: var(--accent-soft); padding: 2px 6px;
    border-radius: 4px; margin-right: 6px; font-weight: 600;
}
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

/* =============================================
   ABC TAGS
   ============================================= */
.abc-tag {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 3px 10px; border-radius: 20px; letter-spacing: 0.5px;
}
.abc-a { background: var(--green-soft); color: var(--green); }
.abc-b { background: var(--blue-soft); color: var(--blue); }
.abc-c { background: var(--orange-soft); color: var(--orange); }

/* =============================================
   CM HEATMAP CELLS
   ============================================= */
.cm-cell { font-weight: 600; font-size: 0.82rem; }
.cm-high { color: var(--green); }
.cm-medium { color: var(--text-primary); }
.cm-low { color: var(--orange); }
.cm-danger { color: var(--red); background: var(--red-soft); border-radius: 4px; padding: 4px 8px; }

/* =============================================
   SIGNAL TAGS
   ============================================= */
.signal-tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.7rem; font-weight: 600; padding: 4px 10px;
    border-radius: 20px; white-space: nowrap;
}
.signal-ok { background: var(--green-soft); color: var(--green); }
.signal-warning { background: var(--orange-soft); color: var(--orange); }
.signal-critical { background: var(--red-soft); color: var(--red); }

/* =============================================
   THREAT TAGS
   ============================================= */
.threat-tag {
    display: inline-block; font-size: 0.7rem; font-weight: 700;
    padding: 4px 12px; border-radius: 20px; letter-spacing: 0.3px;
}
.threat-high { background: var(--red-soft); color: var(--red); }
.threat-medium { background: var(--orange-soft); color: var(--orange); }
.threat-low { background: var(--green-soft); color: var(--green); }

/* =============================================
   RECOMMENDATIONS
   ============================================= */
.recommendations-section { margin-bottom: 24px; }
.recommendations-section .chart-header { margin-bottom: 16px; }
.reco-cards { display: flex; flex-direction: column; gap: 16px; }
.reco-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
    transition: all var(--transition-normal); position: relative;
    overflow: hidden;
}
.reco-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px;
    height: 100%; border-radius: 4px 0 0 4px;
}
.reco-high::before { background: var(--red); }
.reco-medium::before { background: var(--orange); }
.reco-low::before { background: var(--blue); }
.reco-card:hover { border-color: var(--border-active); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.reco-priority { margin-bottom: 12px; }
.priority-tag {
    font-size: 0.68rem; font-weight: 700; padding: 3px 10px;
    border-radius: 20px; display: inline-block; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.priority-high { background: var(--red-soft); color: var(--red); }
.priority-medium { background: var(--orange-soft); color: var(--orange); }
.priority-low { background: var(--blue-soft); color: var(--blue); }
.reco-body h4 {
    font-size: 0.95rem; font-weight: 600; margin-bottom: 14px;
    color: var(--text-primary); display: flex; align-items: center; gap: 8px;
}
.reco-body h4 i { color: var(--text-accent); }
.reco-comparison {
    display: flex; align-items: stretch; gap: 16px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.reco-from, .reco-to {
    flex: 1; min-width: 200px; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px; display: flex; flex-direction: column; gap: 6px;
}
.reco-label { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.reco-metric {
    font-size: 0.88rem; font-weight: 700;
}
.reco-metric.positive { color: var(--green); }
.reco-metric.negative { color: var(--red); }
.reco-detail { font-size: 0.75rem; color: var(--text-muted); }
.reco-arrow {
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--accent); flex-shrink: 0;
}
.reco-impact {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; background: var(--green-soft);
    border-radius: var(--radius-sm); border: 1px solid rgba(58, 154, 92, 0.15);
}
.impact-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.impact-value { font-size: 0.92rem; font-weight: 700; }
.impact-value.positive { color: var(--green); }
.reco-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.reco-owner { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.reco-deadline { font-size: 0.75rem; color: var(--text-muted); }

/* =============================================
   ALERTS SYSTEM
   ============================================= */
.alert-bell { position: relative; }
.alert-badge-count {
    position: absolute; top: -2px; right: -2px;
    width: 18px; height: 18px; background: var(--red);
    color: white; font-size: 0.62rem; font-weight: 700;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-primary);
    animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.alerts-panel {
    position: absolute; top: calc(var(--topbar-height) - 4px);
    right: 20px; width: 380px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal); z-index: 200;
    display: none; animation: slideDown 0.25s ease; overflow: hidden;
}
.alerts-panel.open { display: block; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.alerts-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.alerts-header h4 {
    font-size: 0.88rem; font-weight: 600;
    display: flex; align-items: center; gap: 6px;
}
.alerts-header h4 i { color: var(--text-accent); }
.alerts-count { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.alerts-list { max-height: 320px; overflow-y: auto; }
.alert-item {
    display: flex; gap: 12px; padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast); cursor: pointer;
}
.alert-item:hover { background: rgba(0, 0, 0, 0.02); }
.alert-item:last-child { border-bottom: none; }
.alert-icon { font-size: 1.1rem; flex-shrink: 0; padding-top: 2px; }
.alert-critical .alert-icon { color: var(--red); }
.alert-warning .alert-icon { color: var(--orange); }
.alert-info .alert-icon { color: var(--blue); }
.alert-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.alert-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }

/* =============================================
   INFO TOOLTIP
   ============================================= */
.info-tip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; cursor: help;
    position: relative; vertical-align: middle; margin-left: 4px;
}
.info-tip i {
    font-size: 0.82rem; color: var(--text-muted);
    transition: color var(--transition-fast);
}
.info-tip:hover i { color: var(--accent); }
.info-tip::after {
    content: attr(data-tip);
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: calc(100% + 8px);
    background: var(--text-primary); color: #f5f0e8;
    font-size: 0.72rem; font-weight: 400; line-height: 1.5;
    padding: 10px 14px; border-radius: var(--radius-sm);
    width: 280px; white-space: normal;
    pointer-events: none; opacity: 0;
    transition: opacity var(--transition-fast);
    z-index: 999; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.info-tip:hover::after { opacity: 1; }
.info-tip.tip-down::after {
    bottom: auto; top: calc(100% + 8px);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
    .charts-row { grid-template-columns: 1fr; }
    .reco-comparison { flex-direction: column; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); z-index: 100; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.15); }
    .sidebar-overlay.open { display: block; }
    .topbar { z-index: 101; }
    .main-content { margin-left: 0; }
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .topbar { padding: 0 16px; }
    .module { padding: 16px; }
    .period-selector { display: none; }
}
@media (max-width: 480px) {
    .kpi-row { grid-template-columns: 1fr; }
}

/* =============================================
   ANIMATIONS
   ============================================= */
.kpi-card { animation: cardEnter 0.5s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.chart-card { animation: cardEnter 0.5s ease both; animation-delay: 0.3s; }

/* Background Gradient Orbs */
.main-content::before {
    content: ''; position: fixed; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(160, 113, 74, 0.04) 0%, transparent 70%);
    top: -200px; right: -200px; pointer-events: none; z-index: 0;
}
.main-content::after {
    content: ''; position: fixed; width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(138, 95, 181, 0.03) 0%, transparent 70%);
    bottom: -100px; left: 200px; pointer-events: none; z-index: 0;
}
.module { position: relative; z-index: 1; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
    padding: 9px 20px; background: var(--accent); color: white;
    border: none; border-radius: var(--radius-sm); font-family: inherit;
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
    transition: all var(--transition-fast);
}
.btn-primary:hover {
    background: #8b5e3c;
    box-shadow: 0 4px 16px rgba(160, 113, 74, 0.35);
}

/* =============================================
   KAZAKHSTAN MAP
   ============================================= */
#kz-svg-map path {
    stroke: #fff;
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.25s ease;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}
#kz-svg-map path:hover {
    stroke: #2c2418;
    stroke-width: 2.5;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
    transform-origin: center;
}
#kz-svg-map circle {
    stroke: #fff;
    stroke-width: 2.5;
    cursor: pointer;
    transition: all 0.25s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
#kz-svg-map circle:hover {
    stroke: #2c2418;
    r: 14;
}
.city-label {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    fill: #2c2418;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}

/* Region colors by share tier */
.reg-critical { fill: #c94a3a; }           /* <15% share — red */
.reg-warning  { fill: #e8943a; }           /* 15-20% — orange */
.reg-moderate { fill: #c88b2e; }           /* 20-25% — amber */
.reg-good     { fill: #3a9a5c; }           /* 25%+ — green */
.reg-city     { fill: #2C6B3F; }           /* cities — dark green */

#kz-svg-map path.reg-critical:hover { fill: #b53d2e; }
#kz-svg-map path.reg-warning:hover  { fill: #d47e2e; }
#kz-svg-map path.reg-moderate:hover { fill: #b87b22; }
#kz-svg-map path.reg-good:hover     { fill: #2e8a4c; }
#kz-svg-map circle:hover            { fill: #1e5530; }

/* Region loss table styling adjustments */
#region-loss-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
#region-loss-table thead th {
    background: var(--bg-secondary);
    font-size: 0.7rem;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#region-loss-table tbody td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
}
#region-loss-table tbody tr:hover {
    background: var(--bg-card-hover);
}
#region-loss-table tfoot td {
    padding: 10px;
    border-top: 2px solid var(--border);
}

/* Leaflet map overrides */
#kz-leaflet-map {
    background: #f5f0e8 !important;
}
.kz-map-popup .leaflet-popup-content-wrapper {
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    border: 1px solid #e0d5c5;
    padding: 0;
}
.kz-map-popup .leaflet-popup-content {
    margin: 12px 16px;
}
.kz-map-popup .leaflet-popup-tip {
    background: #fff;
    border: 1px solid #e0d5c5;
}
.city-tooltip {
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #2c2418 !important;
    background: rgba(255,255,255,0.92) !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 6px !important;
    padding: 2px 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}
.city-tooltip::before {
    border-top-color: rgba(255,255,255,0.92) !important;
}
.leaflet-control-zoom a {
    background: rgba(255,255,255,0.92) !important;
    color: #2c2418 !important;
    border-color: #e0d5c5 !important;
}
.leaflet-control-zoom a:hover {
    background: #fff !important;
}

/* ========== FILTER SIDEBAR ========== */
.filter-panel {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 20px 16px;
    border-radius: var(--radius-lg);
    margin: 0 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    flex-shrink: 0;
}
.filter-panel-header h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.filter-group {
    margin-bottom: 10px;
}
.filter-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.filter-select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-main);
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a6e5d'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

@media (max-width: 1100px) {
    .filter-panel {
        display: none;
    }
}

/* ===========================================
   COST MODULE STYLES (merged)
   ============================================= */
.badge-up {
    background: var(--red-soft);
    color: var(--red);
}

.badge-down {
    background: var(--green-soft);
    color: var(--green);
}

.badge-neutral {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    line-height: 1.2;
}

.kpi-unit {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.kpi-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.kpi-fact, .kpi-forecast {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.kpi-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.kpi-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #c9956a);
    border-radius: 2px;
    transition: width 1s ease;
}

.bar-green { background: linear-gradient(90deg, #16a34a, var(--green)); }
.bar-blue { background: linear-gradient(90deg, #2563eb, var(--blue)); }
.bar-orange { background: linear-gradient(90deg, #d97706, var(--orange)); }
.bar-purple { background: linear-gradient(90deg, #7c3aed, var(--purple)); }

.kpi-share {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* =============================================
   CHART CARDS
   ============================================= */
.charts-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.charts-row:has(.chart-card.wide:only-child) {
    grid-template-columns: 1fr;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.chart-card.wide {
    grid-column: span 1;
}

.charts-row:has(> .chart-card:only-child) .chart-card {
    grid-column: 1 / -1;
}

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

.chart-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i {
    color: var(--text-accent);
    font-size: 1.1rem;
}

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

.chart-btn {
    padding: 5px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.chart-btn.active {
    background: var(--accent);
    color: white;
}

.chart-body {
    position: relative;
    height: 280px;
    overflow: hidden;
}

.chart-body canvas {
    display: block;
}

.chart-legend-custom {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    justify-content: center;
}

/* =============================================
   SCENARIO SECTION
   ============================================= */
.scenario-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 4px 0;
}

.scenario-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    position: relative;
}

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

.scenario-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }

.scenario-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.scenario-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.scenario-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-value.warning { color: var(--orange); }

/* =============================================
   DATA TABLE
   ============================================= */
.sku-table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.data-table thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
}

.data-table thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.data-table thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.sku-code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: var(--text-accent);
    background: var(--accent-soft);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    font-weight: 600;
}

.recommendation {
    color: var(--blue);
    font-weight: 500;
}

.recommendation i {
    margin-right: 4px;
}

.savings {
    color: var(--green);
    font-weight: 700;
}

.savings.neutral {
    color: var(--text-muted);
}

.status-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.status-pending { background: var(--orange-soft); color: var(--orange); }
.status-approved { background: var(--green-soft); color: var(--green); }
.status-rejected { background: var(--red-soft); color: var(--red); }
.status-optimal { background: var(--blue-soft); color: var(--blue); }

/* =============================================
   TRACEABILITY TIMELINE
   ============================================= */
.traceability-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.batch-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
}

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

.batch-card.batch-warning {
    border-color: rgba(239, 68, 68, 0.2);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03), var(--bg-secondary));
}

.batch-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.batch-id {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-accent);
}

.batch-sku {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-flow {
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.timeline-node {
    flex: 1;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 12px;
    transition: all var(--transition-normal);
}

.timeline-node:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.timeline-node.node-final {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), var(--bg-card));
}

.node-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-accent);
    flex-shrink: 0;
}

.node-final .node-icon {
    background: var(--green-soft);
    color: var(--green);
}

.node-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.node-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.node-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.node-cost {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.timeline-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    color: var(--text-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.batch-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-item span {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.summary-item strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-item.highlight strong {
    color: var(--green);
}

.summary-item.highlight-warn strong {
    color: var(--red);
}

.search-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
}

.search-mini i {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-mini input {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    width: 140px;
}

.search-mini input::placeholder {
    color: var(--text-muted);
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 520px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 i {
    color: var(--text-accent);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--red-soft);
    color: var(--red);
}

.modal-body {
    padding: 24px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-group input[type="text"]:focus {
    border-color: var(--accent);
}

.slider-group {
    margin-bottom: 16px;
}

.slider-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.slider-value {
    font-weight: 700;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(160, 113, 74, 0.3);
    transition: transform 0.1s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-currency::-webkit-slider-thumb {
    background: var(--purple);
    box-shadow: 0 2px 8px rgba(138, 95, 181, 0.3);
}

.scenario-results {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 20px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.result-row:last-child {
    border-bottom: none;
}

.result-row span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-row strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.btn-primary {
    padding: 9px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: #5558e6;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

/* =============================================
   ACTION ITEMS / PRIORITY RECOMMENDATIONS
   ============================================= */
.action-items-section {
    margin-top: 20px;
}

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

.action-items-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-items-header h3 i {
    color: var(--accent);
    font-size: 18px;
}

.action-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 4px 10px;
    border-radius: 12px;
}

.action-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition-normal);
}

.action-card:hover {
    border-color: var(--border-active);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.action-card.action-urgent {
    border-left: 3px solid #c94a3a;
}

.action-card.action-medium {
    border-left: 3px solid #c88b2e;
}

.action-card.action-low {
    border-left: 3px solid #3a9a5c;
}

.action-priority {
    display: flex;
    align-items: center;
}

.priority-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 10px;
}

.priority-tag.priority-high {
    background: rgba(201, 74, 58, 0.12);
    color: #c94a3a;
}

.priority-tag.priority-medium {
    background: rgba(200, 139, 46, 0.12);
    color: #c88b2e;
}

.priority-tag.priority-low {
    background: rgba(58, 154, 92, 0.12);
    color: #3a9a5c;
}

.action-body h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.action-body h4 i {
    color: var(--accent);
    font-size: 16px;
}

.action-body p {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.action-impact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-hover);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 6px;
}

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

.impact-value {
    font-size: 13px;
    font-weight: 700;
}

.impact-value.positive {
    color: #3a9a5c;
}

.impact-value.negative {
    color: #c94a3a;
}

.action-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
}

.action-owner {
    color: var(--accent);
    font-weight: 600;
}

.action-deadline {
    color: var(--text-muted);
}

/* =============================================
   LOADING SCREEN
   ============================================= */
.loading-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 32px;
    animation: loaderPulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

@keyframes loaderPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.95); opacity: 0.7; }
}

.loader-icons-swap {
    position: relative;
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
}

.swap-icon {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(0.8);
    animation: iconSwap 3.2s infinite ease-in-out;
    filter: invert(1) brightness(0.2);
}

.swap-icon:nth-child(1) { animation-delay: 0s; }
.swap-icon:nth-child(2) { animation-delay: 0.8s; }
.swap-icon:nth-child(3) { animation-delay: 1.6s; }
.swap-icon:nth-child(4) { animation-delay: 2.4s; }

@keyframes iconSwap {
    0%  { opacity: 0; transform: scale(0.5) rotate(-30deg); }
    10% { opacity: 1; transform: scale(1.1) rotate(0deg); }
    15% { opacity: 1; transform: scale(1) rotate(0deg); }
    25% { opacity: 0; transform: scale(0.8) rotate(20deg); }
    100% { opacity: 0; transform: scale(0.8); }
}

.loader-text {
    margin-top: 24px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* =============================================
   BACKGROUND ORNAMENTS
   ============================================= */
.dash-bg-ornaments {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.dash-orn {
    position: absolute;
    opacity: 0.025;
    pointer-events: none;
    filter: invert(1) brightness(0.2);
    animation: dashFloatAnim 20s ease-in-out infinite alternate;
}

.dash-orn.orn-1 {
    width: 180px; height: 180px;
    top: 8%; right: 5%;
    animation-delay: 0s;
    animation-duration: 22s;
}

.dash-orn.orn-2 {
    width: 130px; height: 130px;
    bottom: 12%; left: 5%;
    animation-delay: 2s;
    animation-duration: 26s;
}

.dash-orn.orn-3 {
    width: 100px; height: 100px;
    top: 45%; left: 20%;
    animation-delay: 4s;
    animation-duration: 24s;
}

.dash-orn.orn-4 {
    width: 200px; height: 200px;
    bottom: -3%; right: 18%;
    animation-delay: 1s;
    animation-duration: 28s;
    opacity: 0.018;
}

.dash-orn.orn-5 {
    width: 110px; height: 110px;
    top: 22%; left: 50%;
    animation-delay: 5s;
    animation-duration: 20s;
}

.dash-orn.orn-6 {
    width: 70px; height: 70px;
    top: 65%; right: 8%;
    animation-delay: 3s;
    animation-duration: 18s;
}

.dash-orn.orn-7 {
    width: 160px; height: 160px;
    bottom: 25%; left: 40%;
    animation-delay: 6s;
    animation-duration: 30s;
    opacity: 0.015;
}

@keyframes dashFloatAnim {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(15px, -20px) rotate(8deg); }
    66% { transform: translate(-10px, 15px) rotate(-5deg); }
    100% { transform: translate(20px, 10px) rotate(12deg); }
}

/* =============================================
   HUB MENU SCREEN
   ============================================= */
.hub-screen {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.hub-screen.visible {
    opacity: 1;
    visibility: visible;
}

.hub-screen.exiting {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Hub ornaments */
.hub-ornaments {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.hub-orn {
    position: absolute;
    opacity: 0.035;
    pointer-events: none;
    filter: invert(1) brightness(0.2);
    animation: hubFloat 25s ease-in-out infinite alternate;
}

.hub-orn-1 { width: 200px; height: 200px; top: 5%; left: 5%; animation-delay: 0s; animation-duration: 28s; }
.hub-orn-2 { width: 140px; height: 140px; top: 60%; right: 8%; animation-delay: 3s; animation-duration: 22s; }
.hub-orn-3 { width: 100px; height: 100px; bottom: 10%; left: 15%; animation-delay: 5s; animation-duration: 30s; }
.hub-orn-4 { width: 180px; height: 180px; top: 20%; right: 20%; animation-delay: 1s; animation-duration: 26s; opacity: 0.025; }
.hub-orn-5 { width: 160px; height: 160px; bottom: 20%; right: 35%; animation-delay: 4s; animation-duration: 24s; opacity: 0.02; }
.hub-orn-6 { width: 90px; height: 90px; top: 40%; left: 60%; animation-delay: 2s; animation-duration: 20s; }

@keyframes hubFloat {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    25% { transform: translate(20px, -25px) rotate(15deg) scale(1.03); }
    50% { transform: translate(-15px, 10px) rotate(-8deg) scale(0.97); }
    75% { transform: translate(10px, 20px) rotate(5deg) scale(1.02); }
    100% { transform: translate(-20px, -10px) rotate(-12deg) scale(1); }
}

/* Hub content */
.hub-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: hubContentIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.1s;
}

@keyframes hubContentIn {
    from { opacity: 0; transform: translateY(30px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hub-logo {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    animation: loaderPulse 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.hub-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.hub-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: #3d2e1c;
    margin-bottom: 6px;
}

.hub-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 48px;
    letter-spacing: 0.3px;
}

/* Hub cards */
.hub-cards {
    display: flex;
    gap: 24px;
    width: 100%;
    max-width: 720px;
}

.hub-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(160, 113, 74, 0.12);
    border-radius: 20px;
    padding: 32px 28px 24px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.hub-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(160, 113, 74, 0.06) 0%, rgba(138, 95, 181, 0.04) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.hub-card:hover {
    transform: translateY(-6px);
    border-color: rgba(160, 113, 74, 0.25);
    box-shadow: 0 20px 60px rgba(160, 113, 74, 0.15), 0 8px 24px rgba(0, 0, 0, 0.06);
}

.hub-card:hover::before {
    opacity: 1;
}

.hub-card:active {
    transform: translateY(-2px) scale(0.98);
}

.hub-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #a0714a, #c9956a);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(160, 113, 74, 0.3);
    position: relative;
    z-index: 1;
}

.hub-card-icon i {
    font-size: 1.6rem;
    color: white;
}

.hub-card-icon-platform {
    background: linear-gradient(135deg, #8a5fb5, #b07fd6);
    box-shadow: 0 6px 20px rgba(138, 95, 181, 0.3);
}

.hub-card-body {
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
}

.hub-card-body h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #2c2418;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.hub-card-body p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.hub-card-arrow {
    position: absolute;
    top: 32px;
    right: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1;
}

.hub-card-arrow i {
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.hub-card:hover .hub-card-arrow {
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(160, 113, 74, 0.3);
}

.hub-card:hover .hub-card-arrow i {
    color: white;
    transform: translateX(2px);
}

.hub-card-soon:hover .hub-card-arrow {
    background: #8a5fb5;
    box-shadow: 0 4px 12px rgba(138, 95, 181, 0.3);
}

.hub-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    margin-top: auto;
}

.hub-tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(160, 113, 74, 0.08);
    color: var(--text-accent);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.hub-card-soon .hub-tag {
    background: rgba(138, 95, 181, 0.08);
    color: #8a5fb5;
}

.hub-footer {
    margin-top: 48px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-weight: 500;
}

/* Dashboard entrance animation */
.dashboard-entered .sidebar {
    animation: sidebarSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dashboard-entered .main-content {
    animation: mainFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0.1s;
}

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

@keyframes mainFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Disable sidebar entrance animation on mobile — conflicts with toggle */
@media (max-width: 768px) {
    .dashboard-entered .sidebar {
        animation: none !important;
        transform: translateX(-100%);
    }
    .dashboard-entered .sidebar.open {
        transform: translateX(0);
    }
}

/* Responsive hub */
@media (max-width: 768px) {
    .hub-cards { flex-direction: column; max-width: 400px; }
    .hub-title { font-size: 1.8rem; }
    .hub-subtitle { margin-bottom: 32px; }
    .charts-row { display: flex; flex-direction: column; }
    .charts-row > div { flex: 1 1 100% !important; min-width: 0 !important; }
    .chart-body { min-height: 180px; }
    .sku-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }
    .reco-comparison { flex-direction: column; }
    .reco-arrow { transform: rotate(90deg); }
    .back-link-hub:hover { color: var(--accent); }
}
