@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0052a3;
    --primary-dark: #003d7a;
    --primary-light: #0068d1;
    --primary-gradient: linear-gradient(135deg, #003d7a 0%, #0068d1 100%);
    --accent: #00b4d8;
    --accent-light: #48cae4;
    --bg: #f0f4f8;
    --bg-card: #ffffff;
    --text: #1a2332;
    --text-muted: #5a6776;
    --text-light: #8896a6;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* ====== DARK MODE ====== */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --primary-gradient: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    --accent: #22d3ee;
    --accent-light: #67e8f9;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    --border: #334155;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Dark mode specific overrides */
[data-theme="dark"] .form-control {
    background: #1e293b;
    color: #e2e8f0;
    border-color: #475569;
}

[data-theme="dark"] .form-control:focus {
    background: #1e293b;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .login-card {
    background: #1e293b;
}

[data-theme="dark"] .login-logo h1 {
    color: #e2e8f0;
}

[data-theme="dark"] .data-table tbody tr:hover,
[data-theme="dark"] .product-row:hover {
    background: rgba(59, 130, 246, 0.08);
}

[data-theme="dark"] .product-row:nth-child(1) .product-rank {
    background: #422006;
    color: #fbbf24;
}

[data-theme="dark"] .product-row:nth-child(2) .product-rank {
    background: #1e293b;
    color: #94a3b8;
}

[data-theme="dark"] .product-row:nth-child(3) .product-rank {
    background: #431407;
    color: #fb923c;
}

[data-theme="dark"] .product-thumb {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .product-thumb-placeholder,
[data-theme="dark"] .product-thumb-empty {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .product-thumb-empty svg {
    color: #64748b;
}

[data-theme="dark"] .mpc-rank {
    background: linear-gradient(135deg, #1e3a5f, #1e40af);
    color: #60a5fa;
}

[data-theme="dark"] .preset-btn {
    background: #1e293b;
    color: #94a3b8;
    border-color: #475569;
}

[data-theme="dark"] .preset-btn:hover {
    background: #334155;
    border-color: #64748b;
}

[data-theme="dark"] .preset-btn.active {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    border-color: transparent;
}

[data-theme="dark"] .search-box {
    background: #1e293b;
    border-color: #475569;
}

[data-theme="dark"] .search-box input {
    color: #e2e8f0;
}

[data-theme="dark"] .search-box input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .lok-product {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
    border-right: 1px solid #334155;
}

[data-theme="dark"] .sidebar-brand {
    border-bottom-color: #334155;
}

[data-theme="dark"] .sidebar-footer {
    border-top-color: #334155;
}

[data-theme="dark"] .nav-link:hover {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .nav-link.active {
    background: rgba(59, 130, 246, 0.2);
    box-shadow: inset 3px 0 0 #3b82f6;
}

[data-theme="dark"] .mpc-code {
    color: #64748b;
}

[data-theme="dark"] .badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

[data-theme="dark"] .badge-danger {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

[data-theme="dark"] .badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .badge-info {
    background: rgba(34, 211, 238, 0.15);
    color: #22d3ee;
}

/* Dark mode toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    color: var(--text-muted);
}

.theme-toggle:hover {
    border-color: var(--primary);
    transform: scale(1.1);
    background: rgba(59, 130, 246, 0.1);
}

/* Comparison badges on dashboard */
.compare-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 4px;
}

.compare-badge.up {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.compare-badge.down {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.compare-badge.neutral {
    background: rgba(148, 163, 184, 0.12);
    color: #64748b;
}

[data-theme="dark"] .compare-badge.up {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

[data-theme="dark"] .compare-badge.down {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

[data-theme="dark"] .compare-badge.neutral {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
}

.compare-prev {
    display: block;
    font-size: 10px;
    color: var(--text-light);
    margin-top: 2px;
    font-weight: 400;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ====== SIDEBAR ====== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--primary-gradient);
    color: #fff;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    backdrop-filter: blur(4px);
}

.sidebar-brand .brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-brand .brand-sub {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    padding: 12px 16px 6px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(4px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    opacity: 0.7;
}

.sidebar-footer .sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ====== HEADER ====== */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--bg);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 500;
}

.header-user .user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ====== MAIN CONTENT ====== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 28px;
    min-height: calc(100vh - var(--header-height));
}

/* ====== CARDS ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.stat-card.blue::before {
    background: var(--primary-gradient);
}

.stat-card.green::before {
    background: linear-gradient(135deg, #059669, #10b981);
}

.stat-card.orange::before {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

.stat-card.cyan::before {
    background: linear-gradient(135deg, #0891b2, #06b6d4);
}

.stat-card.purple::before {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

.stat-card.red::before {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card.blue .stat-icon {
    background: rgba(0, 82, 163, 0.1);
    color: var(--primary);
}

.stat-card.green .stat-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-card.orange .stat-icon {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-card.cyan .stat-icon {
    background: rgba(0, 180, 216, 0.1);
    color: var(--accent);
}

.stat-card.purple .stat-icon {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
}

.stat-card.red .stat-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ====== PANELS ====== */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.panel-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-body {
    padding: 24px;
}

/* ====== TABLES ====== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(0, 82, 163, 0.03);
}

.data-table .text-right {
    text-align: right;
}

.data-table .text-center {
    text-align: center;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.badge-info {
    background: rgba(0, 180, 216, 0.12);
    color: #0891b2;
}

/* ====== CHART CONTAINER ====== */
.chart-container {
    position: relative;
    height: 350px;
    width: 100%;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

/* ====== FILTERS ====== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-input,
.filter-select {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text);
    transition: border-color 0.2s;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 163, 0.1);
}

.btn {
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(0, 82, 163, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ====== LOGIN PAGE ====== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: url('/images/login-bg.png') center/cover no-repeat;
    background-color: #0f172a;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    top: -200px;
    right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1;
    animation: slideUp 0.6s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(67, 56, 202, 0.35);
}

.login-logo .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* ====== DASHBOARD - MOBILE FIRST ====== */
.preset-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.preset-chip {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.2s;
    white-space: nowrap;
}

.preset-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.preset-chip.active {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(0, 82, 163, 0.3);
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.summary-item {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.summary-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.summary-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.summary-value.blue {
    color: var(--primary);
}

.summary-value.green {
    color: var(--success);
}

.summary-value.muted {
    color: var(--text-muted);
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title small {
    font-weight: 400;
    color: var(--text-light);
    font-size: 13px;
}

.empty-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
    border: 1px solid var(--border);
}

.lok-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.lok-card:hover {
    box-shadow: var(--shadow-md);
}

.lok-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.lok-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.lok-tutar {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.lok-bar-wrap {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.lok-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.lok-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}

.lok-card {
    cursor: pointer;
}

.lok-chevron {
    font-size: 10px;
    color: var(--text-light);
    margin-left: 6px;
    transition: transform 0.2s;
}

.lok-detail {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.lok-detail-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.lok-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.lok-product:last-child {
    border-bottom: none;
}

.lok-product-info {
    flex: 1;
    min-width: 0;
}

.lok-product-name {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lok-product-code {
    display: block;
    font-size: 10px;
    color: var(--text-light);
}

.lok-product-stats {
    text-align: right;
    flex-shrink: 0;
    margin-left: 10px;
}

.lok-product-qty {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.lok-product-amount {
    display: block;
    font-size: 10px;
    color: var(--primary);
}

.top-products {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.product-row:last-child {
    border-bottom: none;
}

.product-row:hover {
    background: rgba(0, 82, 163, 0.03);
}

.product-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.product-row:nth-child(1) .product-rank {
    background: #fef3c7;
    color: #d97706;
}

.product-row:nth-child(2) .product-rank {
    background: #e5e7eb;
    color: #6b7280;
}

.product-row:nth-child(3) .product-rank {
    background: #fde8d8;
    color: #c2410c;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-code {
    font-size: 11px;
    color: var(--text-light);
}

.product-stats {
    text-align: right;
    flex-shrink: 0;
}

.product-qty {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.product-amount {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
}

.product-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: #f8f8f8;
}

.product-thumb-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--bg);
    border: 1px solid var(--border);
}

/* Mobile adjustments for dashboard */
@media (max-width: 576px) {
    .summary-strip {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .summary-value {
        font-size: 14px;
    }

    .preset-bar {
        gap: 5px;
    }

    .preset-chip {
        padding: 7px 11px;
        font-size: 12px;
    }

    .section-title {
        font-size: 15px;
    }

    .lok-name {
        font-size: 13px;
    }

    .lok-tutar {
        font-size: 14px;
    }
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: var(--bg);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 82, 163, 0.1);
    background: #fff;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-login:hover {
    box-shadow: 0 6px 20px rgba(0, 82, 163, 0.4);
    transform: translateY(-2px);
}

.validation-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
}

/* ====== PAGINATION ====== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ====== EMPTY STATE ====== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ====== REPORT PAGES ====== */
.report-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 24px;
}

.report-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.report-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.report-header h2 small {
    font-weight: 400;
}

.report-total {
    font-size: 15px;
    color: var(--text-muted);
}

.report-total strong {
    color: var(--primary);
    font-size: 18px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 9px 20px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-filter:hover {
    box-shadow: 0 4px 12px rgba(0, 82, 163, 0.3);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.report-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.report-table tbody tr {
    transition: background 0.15s;
}

.report-table tbody tr:hover {
    background: rgba(0, 82, 163, 0.03);
}

.report-table tfoot td {
    border-top: 2px solid var(--border);
}

/* Dark mode: report-table overrides */
[data-theme="dark"] .report-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

[data-theme="dark"] .report-table tfoot tr {
    background: rgba(30, 58, 95, 0.5) !important;
}

[data-theme="dark"] .report-table tfoot td {
    color: var(--text);
}

/* Dark mode: skeleton shimmer */
[data-theme="dark"] .skeleton-text {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

[data-theme="dark"] .skeleton-block {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
    background-size: 200% 100%;
}

/* Dark mode: code element */
[data-theme="dark"] code {
    background: #334155;
    color: #94a3b8;
}

/* Dark mode: health stats */
[data-theme="dark"] .health-stats {
    color: #94a3b8;
}

/* ====== RESPONSIVE ====== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px;
}

/* Tablet */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .main-header {
        left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 576px) {
    :root {
        --header-height: 56px;
    }

    .login-card {
        width: 95%;
        padding: 32px 20px;
    }

    .main-content {
        padding: 12px;
    }

    .main-header {
        padding: 0 12px;
    }

    .header-title {
        font-size: 15px;
    }

    .header-user span {
        display: none;
    }

    .header-user {
        padding: 6px;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Stat cards: 2 columns compact */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 16px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-sub {
        font-size: 11px;
    }

    /* Charts */
    .chart-container {
        height: 250px;
    }

    /* Panels */
    .panel-header {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .panel-body {
        padding: 16px;
    }

    .panel-title {
        font-size: 14px;
    }

    /* Report cards */
    .report-card {
        padding: 14px;
        border-radius: var(--radius-sm);
    }

    .report-header {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .report-header h2 {
        font-size: 16px;
        line-height: 1.3;
    }

    .report-total {
        font-size: 13px;
    }

    .report-total strong {
        font-size: 16px;
    }

    /* Filter form: stack vertically */
    .filter-form {
        width: 100%;
        gap: 6px;
    }

    .filter-form .filter-input {
        flex: 1;
        min-width: 0;
        padding: 8px 10px;
        font-size: 13px;
    }

    .filter-form .filter-select {
        padding: 8px 10px;
        font-size: 13px;
    }

    .filter-form span {
        display: none;
    }

    .btn-filter {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    /* Tables: horizontal scroll wrapper */
    .report-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .report-table th {
        padding: 10px 12px;
        font-size: 11px;
    }

    .report-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th {
        padding: 10px 12px;
        font-size: 11px;
    }

    .data-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Filter bar */
    .filter-bar {
        gap: 8px;
    }

    .filter-bar .filter-input,
    .filter-bar .filter-select {
        padding: 8px 10px;
        font-size: 13px;
    }

    /* Touch-friendly: larger tap targets */
    .nav-link {
        padding: 14px 16px;
        font-size: 15px;
    }

    .sidebar-nav {
        padding: 12px 8px;
    }

    .nav-section-title {
        padding: 14px 16px 6px;
    }
}

/* Extra small phones */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 12px 14px;
    }

    .stat-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 18px;
    }

    .report-header h2 {
        font-size: 15px;
    }

    .header-title {
        font-size: 13px;
    }
}

/* ====== RESPONSIVE VISIBILITY ====== */
.mobile-only {
    display: none;
}

.desktop-only {
    display: table;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }

    .desktop-only {
        display: none !important;
    }
}

/* ====== MOBILE PRODUCT CARDS ====== */
.mobile-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.mobile-product-card:last-child {
    border-bottom: none;
}

.mpc-rank {
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8f0fe, #c2d8f7);
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mpc-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mpc-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mpc-code {
    font-size: 11px;
    color: #999;
}

.mpc-stats {
    text-align: right;
    flex-shrink: 0;
}

.mpc-qty {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.mpc-amount {
    font-size: 11px;
    color: var(--primary);
    font-weight: 500;
}

/* Mobile report table fallback */
@media (max-width: 768px) {
    .report-table {
        font-size: 12px;
    }

    .report-table th,
    .report-table td {
        padding: 8px 6px;
    }

    .filter-form {
        flex-direction: column;
        gap: 6px;
    }

    .filter-input,
    .filter-select {
        width: 100% !important;
    }
}

/* ─── Date Preset Buttons ─── */
.date-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.preset-btn {
    padding: 5px 12px;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    background: #fff;
    color: #495057;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.preset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.preset-btn.active {
    background: linear-gradient(135deg, #0d6efd, #6f42c1);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

/* ─── Search Box ─── */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 12px;
    max-width: 350px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    width: 100%;
    color: #333;
}

.search-box input::placeholder {
    color: #aaa;
}

/* ─── Placeholder image for missing product images ─── */
.product-thumb-empty {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f0f2f5;
    border: 1px solid #dee2e6;
    position: relative;
}

.product-thumb-empty svg {
    width: 20px;
    height: 20px;
    color: #b0bec5;
}