:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --accent: #f59e0b;
    --accent-light: #fffbeb;
    --success: #10b981;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-header {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 100;
    flex-shrink: 0;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow);
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.top-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-link i { font-size: 18px; }

.nav-link:hover, .nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-link.active {
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.main-content {
    flex-grow: 1;
    overflow-y: auto;
    background-color: var(--bg-main);
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-main);
    padding: 8px 14px;
    border-radius: 10px;
    width: 250px;
    border: 1px solid var(--border);
}

.search-bar:focus-within {
    border-color: var(--primary);
}

.search-bar i {
    color: var(--text-muted);
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.dashboard-scroll {
    padding: 32px;
    overflow-y: auto;
    flex-grow: 1;
}

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

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.income { background-color: #ecfdf5; color: var(--success); }
.stat-icon.products { background-color: #eff6ff; color: var(--primary); }
.stat-icon.sales { background-color: #fff7ed; color: var(--accent); }
.stat-icon.expense { background-color: #fef2f2; color: var(--danger); }

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

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin: 4px 0;
}

.stat-change {
    font-size: 12px;
    font-weight: 600;
}

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

.full-row-chart {
    margin-bottom: 24px;
    width: 100%;
}

.rankings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.chart-container, .ranking-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.main-chart {
    height: 380px;
}

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

.chart-filters {
    display: flex;
    gap: 8px;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 8px;
}

.filter-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
}

.filter-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.ranking-card h3 {
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.ranking-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.ranking-info {
    flex-grow: 1;
}

.ranking-name {
    font-size: 14px;
    font-weight: 600;
}

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

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.inventory-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

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

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

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

th {
    text-align: left;
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

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

.prod-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: cover;
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: #ecfdf5; color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--accent); }
.badge-danger { background: #fef2f2; color: var(--danger); }

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 4px 12px rgba(37,99,235,0.2); }

.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: #d97706; box-shadow: 0 4px 12px rgba(245,158,11,0.2); }

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

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.mini-modal {
    max-width: 400px;
    text-align: center;
}

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

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
}

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

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.confirm-icon {
    width: 64px;
    height: 64px;
    background: #ecfdf5;
    color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
}

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

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

::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
