:root {
    --bg-dark: #0a0e1a;
    --bg-card: rgba(15, 20, 40, 0.85);
    --bg-card-hover: rgba(20, 28, 55, 0.95);
    --border-glow: rgba(0, 200, 255, 0.15);
    --border-glow-strong: rgba(0, 200, 255, 0.4);
    --neon-blue: #00c8ff;
    --neon-cyan: #00e5cc;
    --neon-purple: #a855f7;
    --neon-orange: #f97316;
    --neon-green: #22c55e;
    --neon-red: #ef4444;
    --neon-yellow: #eab308;
    --neon-pink: #ec4899;
    --text-primary: #e8edf5;
    --text-secondary: #8899b4;
    --text-muted: #556680;
    --sidebar-width: 240px;
    --header-height: 72px;
    --sidebar-right-width: 260px;
    --radius: 12px;
    --radius-sm: 8px;
}

html[data-theme="light"] {
    --bg-dark: #f5f7fb;
    --bg-card: rgba(255, 255, 255, 0.88);
    --bg-card-hover: rgba(255, 255, 255, 0.98);
    --border-glow: rgba(15, 23, 42, 0.08);
    --border-glow-strong: rgba(14, 165, 233, 0.32);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
}

html[data-theme="light"] #particles-container {
    opacity: 0.28;
}

html[data-theme="light"] .header-badge,
html[data-theme="light"] .live-badge {
    background: rgba(14, 165, 233, 0.12);
    color: #0f766e;
    border-color: rgba(14, 165, 233, 0.35);
}

html[data-theme="light"] .sidebar-menu li a:hover {
    background: rgba(14, 165, 233, 0.08);
}

html[data-theme="light"] .sidebar-menu li a.active {
    background: rgba(14, 165, 233, 0.12);
}

html[data-theme="light"] .kpi-card:hover,
html[data-theme="light"] .chart-item:hover {
    box-shadow: 0 8px 28px rgba(14, 165, 233, 0.09);
}

html[data-theme="light"] footer {
    background: rgba(255, 255, 255, 0.92);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#ainna-promo-cards,
.ainna-promo-cards,
.ainna-promo-cards-slot {
    display: none !important;
}

/* Dashboard Layout */
.dpmm-dashboard {
    display: block;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding-top: 72px;
}

#dpmmThemeSlot {
    position: fixed !important;
    top: 12px !important;
    left: calc(50% + 90px) !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    z-index: 2147483646 !important;
}

/* Sidebar */
.dpmm-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-glow);
    display: flex;
    flex-direction: column;
    z-index: 10;
    backdrop-filter: blur(20px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border-glow);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-cyan));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon-blue);
}

.sidebar-brand p {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-menu {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover {
    color: var(--text-primary);
    background: rgba(0, 200, 255, 0.05);
}

.sidebar-menu li a.active {
    color: var(--neon-blue);
    background: rgba(0, 200, 255, 0.08);
    border-left-color: var(--neon-blue);
}

.sidebar-menu li a svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-menu li a.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glow);
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-version {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 10px;
}

/* Main Content */
.dpmm-main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 48px;
    min-width: 0;
}

/* Header */
.dpmm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-glow);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header-left p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

.live-clock {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--neon-cyan);
    font-weight: 600;
}

.header-badge {
    background: rgba(0, 200, 255, 0.1);
    border: 1px solid var(--neon-blue);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon-blue);
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    background: var(--neon-green);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* KPI Section */
.kpi-section {
    padding: 20px 28px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.kpi-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 200, 255, 0.1);
}

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

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-sme .kpi-icon { background: rgba(168, 85, 247, 0.15); color: var(--neon-purple); }
.kpi-procurement .kpi-icon { background: rgba(0, 200, 255, 0.15); color: var(--neon-blue); }
.kpi-savings .kpi-icon { background: rgba(34, 197, 94, 0.15); color: var(--neon-green); }
.kpi-export .kpi-icon { background: rgba(249, 115, 22, 0.15); color: var(--neon-orange); }

.kpi-content {
    flex: 1;
    min-width: 0;
}

.kpi-content h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.kpi-sparkline {
    width: 80px;
    height: 24px;
    margin-top: 6px;
    display: block;
}

/* Charts Section */
.charts-section {
    padding: 0 28px 20px;
}

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

.chart-item {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    padding: 18px;
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.chart-item:hover {
    border-color: var(--border-glow-strong);
    box-shadow: 0 4px 24px rgba(0, 200, 255, 0.06);
}

.chart-item.chart-wide {
    grid-column: span 2;
}

.chart-item h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.chart-item canvas {
    width: 100% !important;
    max-height: 220px;
}

.chart-item.chart-focused {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 24px rgba(0, 229, 204, 0.25);
    transition: all 0.4s ease;
}

.chart-item.chart-focused::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    pointer-events: none;
    animation: focusPulse 1.2s ease-out 1;
}

@keyframes focusPulse {
    0% { box-shadow: inset 0 0 0 0 rgba(0, 229, 204, 0.6); }
    100% { box-shadow: inset 0 0 0 40px rgba(0, 229, 204, 0); }
}

.chart-item {
    position: relative;
}

.kpi-section,
.chart-item {
    scroll-margin-top: 96px;
}

/* Right Sidebar */
.dpmm-sidebar-right {
    padding: 0 28px 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.live-feed-card,
.health-checklist {
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius);
    padding: 18px;
    backdrop-filter: blur(20px);
}

.live-feed-card h3,
.health-checklist h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--neon-red);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.live-feed-list {
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
}

.live-feed-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 200, 255, 0.06);
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

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

.live-feed-list li .feed-time {
    color: var(--neon-cyan);
    font-family: 'Courier New', monospace;
    font-size: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.health-list {
    list-style: none;
}

.health-list li {
    padding: 7px 0;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-icon {
    font-size: 10px;
}

.check-icon.green { color: var(--neon-green); }
.check-icon.yellow { color: var(--neon-yellow); }
.check-icon.red { color: var(--neon-red); }

/* Footer */
footer.dpmm-footer {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 40px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-glow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    font-size: 11px;
    color: var(--text-muted);
    z-index: 10;
    backdrop-filter: blur(20px);
}

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

/* Responsive */
@media (max-width: 1400px) {
    .dpmm-sidebar-right {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .chart-item.chart-wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .dpmm-dashboard {
        padding-top: 0;
    }

    #dpmmThemeSlot {
        position: static !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 12px 12px 0;
        box-sizing: border-box;
    }

    .dpmm-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-glow);
    }

    .sidebar-brand {
        justify-content: center;
    }

    .sidebar-menu ul {
        display: flex;
        overflow-x: auto;
        padding: 0 8px;
    }

    .sidebar-menu li a {
        padding: 10px 14px;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .sidebar-menu li a.active {
        border-left: none;
        border-bottom-color: var(--neon-blue);
    }

    .sidebar-footer {
        display: none;
    }

    .dpmm-main-content {
        margin-left: 0;
        width: 100%;
    }

    footer.dpmm-footer {
        left: 0;
    }

    .dpmm-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .header-right {
        flex-direction: column;
        gap: 8px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .dpmm-sidebar-right {
        grid-template-columns: 1fr;
    }
}
