/* ============================================================
   WMS Gudang — Modern Minimalist
   ============================================================ */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d21;
  --text-2: #6b7280;
  --border: #e8eaed;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: #111827;
  color: #d1d5db;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform .25s ease;
}
.sidebar .brand {
  padding: 20px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 11px; color: #9ca3af; margin-top: 2px; }
.nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d1d5db;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav-ico { width: 20px; text-align: center; }
.nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6b7280; padding: 14px 12px 6px; }
.sidebar .userbox { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .userbox b { color: #fff; display: block; }
.sidebar .userbox a { color: #9ca3af; font-size: 12px; }

.main { flex: 1; margin-left: 240px; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 28px; max-width: 1200px; }

.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }

/* ---------- Cards & stats ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

.stat .num { font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.stat .lbl { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.stat.accent .num { color: var(--accent); }
.stat.green .num { color: var(--green); }
.stat.red .num { color: var(--red); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control, select.form-control, textarea.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-masuk { background: var(--green-soft); color: var(--green); }
.badge-keluar { background: var(--red-soft); color: var(--red); }
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-manager { background: #fef3c7; color: #92400e; }
.badge-staff, .badge-gray { background: #f3f4f6; color: var(--text-2); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--green-soft); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--red-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--accent-soft); color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #111827 0%, #1e3a8a 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); }
.login-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 4px; }
.login-card p.sub { color: var(--text-2); font-size: 14px; margin-bottom: 24px; }

/* ---------- Misc ---------- */
.img-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.img-prev { max-width: 200px; border-radius: 8px; border: 1px solid var(--border); }
.sig-pad { border: 2px dashed var(--border); border-radius: 8px; background: #fafbfc; touch-action: none; }
.sig-pad canvas { display: block; width: 100%; height: 160px; }
.qr-box { text-align: center; padding: 16px; }
.qr-box img { max-width: 220px; }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.toolbar .spacer { flex: 1; }
.search { max-width: 280px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 16px; }
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; display: none; }
  .overlay.show { display: block; }
}

/* ERP additions */
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.timeline { border-left: 2px solid #e5e7eb; margin: 8px 0 8px 8px; padding-left: 16px; }
.timeline .t-item { margin-bottom: 14px; position: relative; }
.timeline .t-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #9ca3af; }
.timeline .t-item.t-approve::before { background: #16a34a; }
.timeline .t-item.t-reject::before { background: #dc2626; }
.timeline .t-item.t-submit::before { background: #2563eb; }
