/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --completed: #8b5cf6;
  --completed-bg: #f5f3ff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* === Navbar === */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.nav-brand:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { color: var(--text-muted); font-size: 14px; }

/* === Container === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; background: var(--bg); }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger-text { color: var(--danger); }

/* === Stats === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s;
}
.stat-card:hover { text-decoration: none; border-color: var(--primary); }
.stat-card.active { border-color: var(--primary); background: #eff6ff; }
.stat-pending.active { border-color: var(--warning); background: var(--warning-bg); }
.stat-approved.active { border-color: var(--success); background: var(--success-bg); }
.stat-rejected.active { border-color: var(--danger); background: var(--danger-bg); }
.stat-completed.active { border-color: var(--completed); background: var(--completed-bg); }
.stat-number { display: block; font-size: 28px; font-weight: 700; }
.stat-label { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* === Search === */
.search-bar { margin-bottom: 24px; }
.search-bar form { display: flex; gap: 8px; }
.search-bar input[type="text"] {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
}
.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

/* === Table === */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg); }
th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 14px; }
tr:hover td { background: #fafbfc; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.text-muted { color: var(--text-muted); font-size: 13px; }

/* === Badges === */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-pending { background: var(--warning-bg); color: #92400e; }
.badge-approved { background: var(--success-bg); color: #065f46; }
.badge-rejected { background: var(--danger-bg); color: #991b1b; }
.badge-completed { background: var(--completed-bg); color: #5b21b6; }
.badge-lg { padding: 6px 16px; font-size: 14px; }
.badge-sm { padding: 2px 8px; font-size: 11px; }

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
}
.page-info { font-size: 14px; color: var(--text-muted); }

/* === Login === */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--surface);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-card h1 { margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 24px; }
.login-card form { text-align: left; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* === Alerts === */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* === Card === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* === Detail page === */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; color: var(--text-muted); }
.back-link:hover { color: var(--primary); }
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.detail-header h1 { font-size: 24px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.info-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.product-list { list-style: none; font-size: 14px; }
.product-list li { padding: 4px 0; }
.product-list li::before { content: "• "; color: var(--text-muted); }

/* === Photos === */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item:hover { border-color: var(--primary); }

/* === Actions === */
.actions-card { background: #fafbfc; }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* === Timeline === */
.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-note { flex: 1; font-size: 14px; }
.timeline-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* === Empty state === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 768px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .search-bar form { flex-wrap: wrap; }
  .search-bar input[type="text"] { width: 100%; }
  td, th { padding: 8px 10px; font-size: 13px; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .container { padding: 16px; }
}
