/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', sans-serif; background: #f0f2f5; color: #1a2332; min-height: 100vh; }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1a2332 60%, #1e3a5f 100%);
  padding: 2rem;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 2rem; }
.login-brand-name { font-family: 'Rajdhani', sans-serif; font-size: 1.8rem; font-weight: 700; color: #fff; letter-spacing: 1px; }
.login-card { background: #fff; border-radius: 16px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card h1 { font-family: 'Rajdhani', sans-serif; font-size: 1.7rem; font-weight: 700; color: #1a2332; margin-bottom: 0.3rem; }
.login-sub { color: #64748b; font-size: 0.9rem; margin-bottom: 1.8rem; }
.login-card .form-group { margin-bottom: 1.1rem; }
.login-card label { display: block; font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 0.7rem 1rem; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 0.93rem; color: #1a2332; transition: border-color 0.2s; outline: none; }
.login-card input:focus { border-color: #f97316; }
.login-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; border-radius: 8px; padding: 0.6rem 1rem; font-size: 0.85rem; margin-bottom: 1rem; }
.login-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; border-radius: 8px; padding: 0.6rem 1rem; font-size: 0.85rem; margin-bottom: 1rem; }
.btn-login { width: 100%; padding: 0.8rem; background: #f97316; color: #fff; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; margin-top: 0.3rem; }
.btn-login:hover { background: #ea6c05; }
.login-hint { font-size: 0.78rem; color: #94a3b8; text-align: center; margin-top: 1rem; }
.login-hint strong { color: #f97316; }

/* ===== APP LAYOUT ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar { width: 230px; background: #1a2332; display: flex; flex-direction: column; z-index: 100; }
.sidebar.collapsed { display: none; }
.sidebar-header { padding: 1.2rem; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.sidebar-brand { font-family: 'Rajdhani', sans-serif; font-size: 1.2rem; font-weight: 700; color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 0.62rem 0.9rem; border-radius: 8px; color: #94a3b8; font-size: 0.88rem; font-weight: 500; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #e2e8f0; }
.nav-item.active { background: #f97316; color: #fff; }
.nav-icon { width: 18px; height: 18px; }
.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.07); display: flex; gap: 8px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: #f97316; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.user-name { font-size: 0.85rem; font-weight: 600; color: #e2e8f0; }
.user-role { font-size: 0.72rem; color: #64748b; }
.btn-logout { background: transparent; border: none; cursor: pointer; color: #64748b; }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ===== TOPBAR ===== */
.topbar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; gap: 1rem; }
.btn-toggle-sidebar { background: transparent; border: none; cursor: pointer; color: #64748b; }
.topbar-title { font-family: 'Rajdhani', sans-serif; font-size: 1.1rem; font-weight: 700; color: #1a2332; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-date { font-size: 0.8rem; color: #94a3b8; }

/* ===== PAGES ===== */
.pages { flex: 1; overflow-y: auto; padding: 1.5rem; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.page-header h2 { font-family: 'Rajdhani', sans-serif; font-size: 1.5rem; font-weight: 700; color: #1a2332; }
.page-header p { color: #64748b; font-size: 0.85rem; margin-top: 2px; }

/* ===== STATS GRID ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; border-radius: 12px; padding: 1.1rem; border: 1px solid #e2e8f0; display: flex; gap: 1rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.red { background: #fef2f2; color: #ef4444; }
.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-label { font-size: 0.75rem; color: #64748b; font-weight: 500; }
.stat-value { font-family: 'Rajdhani', sans-serif; font-size: 1.5rem; font-weight: 700; color: #1a2332; }
.stat-sub { font-size: 0.72rem; color: #94a3b8; margin-top: 1px; }

/* ===== DASHBOARD GRID ===== */
.dashboard-grid { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; }
@media (max-width: 900px) { .dashboard-grid { grid-template-columns: 1fr; } }

/* ===== CARDS ===== */
.card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid #f1f5f9; }
.card-header h3 { font-size: 0.92rem; font-weight: 600; color: #1a2332; }
.card-link { font-size: 0.8rem; color: #f97316; text-decoration: none; }

/* ===== TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th { text-align: left; padding: 0.7rem 1rem; font-size: 0.75rem; font-weight: 600; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.data-table tbody tr:hover { background: #f8fafc; }
.empty-row td { text-align: center; color: #94a3b8; padding: 2rem; }

/* ===== BADGES ===== */
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; display: inline-block; }
.badge-success { background: #f0fdf4; color: #15803d; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-masuk { background: #f0fdf4; color: #15803d; }
.badge-keluar { background: #fef2f2; color: #dc2626; }

/* ===== BUTTONS ===== */
.btn-primary { padding: 0.6rem 1.2rem; background: #f97316; color: #fff; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #ea6c05; }
.btn-sm { padding: 0.35rem 0.8rem; border: none; border-radius: 6px; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.btn-edit { background: #e0f2fe; color: #0369a1; }
.btn-edit:hover { background: #cffafe; }
.btn-delete { background: #fef2f2; color: #dc2626; }
.btn-delete:hover { background: #fee2e2; }

/* ===== LOW STOCK ===== */
.low-stock-item { padding: 0.8rem 1.2rem; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; }
.low-stock-item:last-child { border-bottom: none; }
.low-stock-name { font-size: 0.85rem; font-weight: 600; color: #1a2332; }
.low-stock-stok { font-size: 0.9rem; font-weight: 700; color: #f97316; }

/* ===== FORMS & MODALS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; display: block; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.6rem 0.9rem; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 0.9rem; color: #1a2332; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #f97316; outline: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.modal { display: none; position: fixed; z-index: 200; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); }
.modal-content { background: #fff; margin: 5% auto; padding: 2rem; border-radius: 12px; width: 90%; max-width: 500px; }
.modal-content h3 { font-family: 'Rajdhani', sans-serif; font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; }
.close { float: right; font-size: 1.5rem; font-weight: 700; cursor: pointer; color: #64748b; }
.close:hover { color: #1a2332; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 1.5rem; left: 1.5rem; padding: 1rem 1.5rem; background: #1a2332; color: #fff; border-radius: 8px; opacity: 0; z-index: 500; }
.toast.show { opacity: 1; }
.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }

@media print { .topbar, .sidebar { display: none !important; } }
