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

:root {
  --blue: #1d4ed8;
  --blue-dark: #1e3a8a;
  --blue-mid: #2563eb;
  --blue-light: #eff6ff;
  --blue-accent: #60a5fa;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red: #dc2626;
  --green: #16a34a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 10px 40px rgba(29,78,216,0.13);
  --radius: 8px;
  --radius-lg: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.5;
}

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

/* ── Loader overlay ── */
#loader-overlay {
  position: fixed; inset: 0;
  background: var(--white);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .3s;
}
#loader-overlay.hidden { opacity: 0; pointer-events: none; }
#loader-overlay img { width: 72px; height: 72px; }
#loader-overlay p { margin-top: 14px; color: var(--gray-500); font-size: .9rem; letter-spacing: .05em; }

/* ── Navbar ── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; gap: 20px; height: 60px;
}
.navbar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; color: var(--blue-dark);
  text-decoration: none;
}
.navbar-logo img { height: 28px; width: 28px; object-fit: contain; }
.navbar-spacer { flex: 1; }
.navbar-user {
  display: flex; align-items: center; gap: 12px; font-size: .875rem;
}
.navbar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-mid); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; overflow: hidden;
}
.navbar-user .avatar img { width: 100%; height: 100%; object-fit: cover; }
.btn-ghost {
  background: none; border: none; cursor: pointer; padding: 6px 12px;
  border-radius: var(--radius); color: var(--gray-700); font-size: .875rem;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--gray-100); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 20px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--blue-mid); color: #fff; }
.btn-primary:hover { background: var(--blue); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; color: var(--blue-mid); border: 1.5px solid var(--blue-mid); }
.btn-outline:hover { background: var(--blue-light); }
.btn-sm { padding: 5px 14px; font-size: .8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius); }

/* ── Badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
}
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }
.badge-green { background: #dcfce7; color: var(--green); }

/* ── Card ── */
.card {
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-body { padding: 20px 22px; }
.card-footer { padding: 14px 22px; background: var(--gray-50); border-top: 1px solid var(--gray-200); display: flex; align-items: center; gap: 10px; }

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  padding: 9px 14px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: .9rem; font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
  background: var(--white); color: var(--gray-800);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: .78rem; color: var(--gray-500); }
.form-error { font-size: .78rem; color: var(--red); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Sections / Layout ── */
.page-header {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 28px 0 0;
}
.page-header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
}
.page-header h1 { font-size: 1.55rem; font-weight: 800; color: var(--gray-900); }
.page-header p { margin-top: 4px; color: var(--gray-500); font-size: .9rem; }
.page-header-tabs { display: flex; gap: 0; margin-top: 20px; }
.tab-link {
  padding: 10px 20px; font-size: .875rem; font-weight: 600;
  color: var(--gray-500); border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tab-link.active { color: var(--blue-mid); border-color: var(--blue-mid); }
.tab-link:hover:not(.active) { color: var(--gray-700); }

.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* ── Empty state ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 24px; text-align: center; gap: 16px;
}
.empty-state svg { color: var(--gray-300); }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--gray-700); }
.empty-state p { color: var(--gray-500); font-size: .9rem; max-width: 340px; }

/* ── Alert ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: .875rem;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: var(--blue-light); color: var(--blue-dark); border: 1px solid #bfdbfe; }

/* ── Divider ── */
.divider {
  display: flex; align-items: center; gap: 12px; color: var(--gray-400);
  font-size: .8rem; font-weight: 500;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left; padding: 10px 16px; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200); font-weight: 600; color: var(--gray-500);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ── Utility ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-gray { color: var(--gray-500); }
.text-blue { color: var(--blue-mid); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }
