:root {
    --bg-app: #f8fafc;
    --bg-panel: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- LOGIN PAGE --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    background-color: var(--bg-app);
}

.login-box {
    background: var(--bg-panel);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
    gap: 10px;
    justify-content: space-between;
}

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 6px;
    border-radius: 8px;
    display: flex;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.nav-menu {
    flex: 1;
    padding: 24px 16px;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 12px;
    padding-left: 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: #f1f5f9;
    color: var(--text-main);
}

.nav-link.active {
    background-color: #eff6ff;
    color: var(--primary);
}

.nav-link i {
    font-size: 1.2rem;
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    height: 64px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
    border-left: 1px solid var(--border);
}

.avatar {
    width: 36px;
    height: 36px;
    background-color: #dbeafe;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* --- CARDS & GRIDS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    padding: 12px;
    border-radius: 12px;
    font-size: 1.5rem;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-info h3 {
    font-size: 1.25rem;
    margin-top: 4px;
}

/* --- TABLES --- */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    background-color: #f8fafc;
}

/* --- BUTTONS & BADGES --- */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #047857;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* --- INVENTARIS --- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.item-card {
    display: flex;
    flex-direction: column;
}

/* Perbaikan Auto Square Gambar Inventaris */
.item-img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Memaksa proporsi kotak */
    object-fit: cover;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 16px;
}

.img-preview {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1; /* Memaksa proporsi kotak */
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
}

.scanner-box {
    width: 250px;
    height: 250px;
    border: 2px dashed #cbd5e1;
    border-radius: 20px;
    margin: 0 auto 24px auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
    }

    .sidebar.active {
        left: 0;
        box-shadow: var(--shadow-md);
    }

    .topbar {
        padding: 0 16px;
    }

    .content-area {
        padding: 16px;
    }

    .mobile-menu-btn, .close-sidebar {
        display: block;
    }
}