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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
}

/* ===== Login Page ===== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  font-size: 24px;
  margin-bottom: 8px;
  text-align: center;
}

.login-box p {
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}

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

.sidebar {
  width: 220px;
  background: white;
  border-right: 1px solid var(--gray-200);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--gray-100);
  color: var(--primary);
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
}

.sidebar-footer .user-info {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 8px;
}

.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1000px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 24px;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-700);
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover { background: var(--danger-hover); }

.btn-outline {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-outline:hover { background: var(--gray-100); }

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Card ===== */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
}

tr:hover td { background: var(--gray-50); }

/* ===== Badge ===== */
.badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  font-size: 18px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  font-size: 14px;
}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 40px;
  color: var(--gray-500);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo, .sidebar-nav a span, .sidebar-footer .user-info { display: none; }
  .sidebar-nav a { justify-content: center; padding: 12px; }
  .main-content { padding: 20px; }
}
