:root {
    --bg-dark: #ffffff;
    --bg-darker: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-blue: #2563eb;
    --accent-purple: #7c3aed;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-hover: rgba(255, 255, 255, 1);
    --sidebar-width: 260px;
    --header-height: 80px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-darker);
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.05), transparent 25%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism utility modified for Light UI */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    background: var(--glass-hover);
    border-color: rgba(0,0,0,0.15);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-area ion-icon {
    font-size: 28px;
    color: var(--accent-blue);
}

.logo-area h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 8px;
    font-weight: 600;
}

.channel-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.channel-nav li {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.channel-nav li:hover {
    background: rgba(0,0,0,0.03);
    color: var(--text-primary);
}

.channel-nav li.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.05));
    color: var(--accent-blue);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.channel-nav li ion-icon {
    font-size: 20px;
}

.data-source-info {
    margin-top: auto;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-md);
    border: 1px dashed var(--glass-border);
}

.data-source-info p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.settings-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 13px;
    background-color: #fff;
}

.settings-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 40px;
    position: relative;
    max-width: calc(100vw - var(--sidebar-width));
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    margin-bottom: 24px;
}

.top-header h1 {
    font-size: 26px;
    font-weight: 600;
}

.last-updated {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.user-profile img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent-blue);
    padding: 2px;
    background: #fff;
}

/* Layout Sections */
.dashboard-section {
    margin-bottom: 48px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 12px;
}

.section-title ion-icon {
    color: var(--accent-blue);
    font-size: 24px;
}

.mb-section {
    margin-bottom: 0px !important;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.kpi-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.kpi-value .unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.animate-value {
    animation: slideUpFade 0.5s ease forwards;
}

/* Charts Area */
.charts-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-wrapper-flex {
    display: flex;
    gap: 24px;
}

.chart-card {
    padding: 24px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.wide-chart {
    width: 100%;
}

.half-chart {
    flex: 1;
    min-width: 0;
}

.canvas-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.pie-wrapper {
    display: flex;
    justify-content: center;
}

/* Table Search Filters */
.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 20;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 160px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group input, 
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: 0.2s border;
}

.filter-group input:focus, 
.filter-group select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Tables Section */
.tables-container {
    display: flex;
    gap: 24px;
    flex-direction: column;
}

.table-card {
    padding: 24px;
    width: 100%;
}

.table-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.table-responsive {
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.data-table th {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8fafc;
}
.data-table th:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}
.data-table th:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.data-table td {
    font-size: 14px;
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background 0.2s;
}

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

/* Multi-select Dropdown UI */
.multi-select {
    position: relative;
    width: 100%;
}

.ms-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 180px;
    user-select: none;
}

.ms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 260px;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    z-index: 100;
    display: none;
    flex-direction: column;
}

.ms-dropdown.active {
    display: flex;
}

.ms-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.ms-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.ms-record-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ms-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
}

.ms-search ion-icon {
    color: var(--text-secondary);
    font-size: 16px;
}

.ms-search-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 13px;
}

.ms-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.ms-option-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
}

.ms-option-item:hover {
    background: #f8fafc;
}

.ms-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    flex: 1;
}

.ms-option-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Status Tags */
.cat-tag {
    background: #e2e8f0;
    color: #334155;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.text-green { color: #059669; }
.text-red { color: #dc2626; }

.footer-spacer {
    height: 60px;
}

/* Responsive constraints */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-wrapper-flex {
        flex-direction: column;
    }
}

/* Category Detail UI */
.category-insight-block {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.category-insight-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.insight-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    list-style: none;
    padding: 0;
}

.insight-tag {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    border: 1px solid #e2e8f0;
}

.insight-tag span {
    font-weight: 600;
    margin-left: 6px;
    color: var(--accent-blue);
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

/* Stats Text List */
.stats-text-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

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

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

.stats-item-label .color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.stats-item-value {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stats-qty {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    min-width: 50px;
    text-align: right;
}

.stats-amount {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-blue);
    min-width: 85px;
    text-align: right;
}
