@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --green: #16a34a;
  --green-light: #22c55e;
  --green-dark: #15803d;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red: #dc2626;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px 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);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ─── LOGIN ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 50%, var(--green-light) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -100px; left: -100px;
}
.login-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  bottom: -80px; right: -80px;
}

.login-brand {
  text-align: center;
  color: white;
  position: relative; z-index: 1;
}

.login-brand .logo-icon {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.3);
}

.login-brand h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.5px; }
.login-brand p { opacity: 0.85; margin-top: 0.5rem; font-size: 1rem; }

.login-features {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative; z-index: 1;
  width: 100%;
  max-width: 320px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  color: white;
  backdrop-filter: blur(10px);
}

.login-feature .fi { font-size: 1.2rem; }
.login-feature span { font-size: 0.875rem; font-weight: 500; }

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background: white;
}

.login-form-wrap {
  width: 100%;
  max-width: 400px;
}

.login-form-wrap h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.login-form-wrap p.subtitle {
  color: var(--gray-500);
  margin-bottom: 2rem;
}

/* ─── LAYOUT ─────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--green), var(--green-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand span { font-weight: 700; font-size: 1rem; color: var(--gray-900); }

.sidebar-user {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}

.user-avatar {
  width: 38px; height: 38px;
  background: var(--green-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--green-dark);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-info-wrap { display: flex; align-items: center; gap: 0.75rem; }
.user-info-wrap .name { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); line-height: 1.3; }
.user-info-wrap .role { font-size: 0.75rem; color: var(--gray-500); text-transform: capitalize; }

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.picker { background: var(--blue-light); color: var(--blue); }
.role-badge.user { background: var(--green-100); color: var(--green-dark); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 0.5rem 0.5rem 0.25rem;
  margin-top: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: all 0.15s;
}

.nav-link:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-link.active { background: var(--green-50); color: var(--green-dark); font-weight: 600; }
.nav-link .ni { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--gray-100);
}

/* ─── MAIN CONTENT ─────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.75rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title { font-size: 1rem; font-weight: 600; color: var(--gray-800); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }

.page-content { padding: 1.75rem; flex: 1; }

/* ─── CARDS & STATS ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 var(--radius-lg) 0 80px;
  opacity: 0.08;
}

.stat-card.green::before { background: var(--green); }
.stat-card.amber::before { background: var(--amber); }
.stat-card.blue::before { background: var(--blue); }
.stat-card.red::before { background: var(--red); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.stat-icon.green { background: var(--green-100); color: var(--green-dark); }
.stat-icon.amber { background: var(--amber-light); color: var(--amber); }
.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.red { background: var(--red-light); color: var(--red); }

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--gray-900); }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.25rem; font-weight: 500; }

/* ─── CARD ──────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 0.95rem; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 1.5rem; }

/* ─── FORMS ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
  letter-spacing: 0.2px;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-control:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

.form-control::placeholder { color: var(--gray-400); }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-amber { background: var(--amber); color: white; }
.btn-amber:hover { background: #b45309; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── TABLE ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--gray-100); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 0.875rem 1rem; color: var(--gray-700); vertical-align: middle; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: var(--amber-light); color: var(--amber); }
.badge-completed { background: var(--green-100); color: var(--green-dark); }
.badge-active { background: var(--green-100); color: var(--green-dark); }
.badge-disabled { background: var(--gray-100); color: var(--gray-500); }
.badge-blocked { background: var(--red-light); color: var(--red); }

/* ─── FILTERS ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}

.filter-bar .form-control { max-width: 200px; }
.search-input { max-width: 260px !important; }

/* ─── PAGINATION ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
  border: 1.5px solid var(--gray-200);
  transition: all 0.15s;
  background: white;
}

.page-btn:hover { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); color: white; border-color: var(--green); }

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-success { background: var(--green-50); color: var(--green-dark); border: 1px solid var(--green-200); }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #fecaca; }
.alert-info { background: var(--blue-light); color: var(--blue); border: 1px solid #bfdbfe; }

/* ─── TABS ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-100); margin-bottom: 1.5rem; }
.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  font-family: inherit;
}
.tab-btn:hover { color: var(--gray-800); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-400);
}

.empty-state .ei { font-size: 3rem; margin-bottom: 1rem; display: block; }
.empty-state p { font-size: 0.875rem; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: scale(0.95) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 1.25rem; transition: color 0.15s; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 1.5rem; }

/* ─── MISCELLANEOUS ──────────────────────────────────────── */
.text-mono { font-family: 'DM Mono', monospace; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--gray-500); }
.text-green { color: var(--green); }
.fw-600 { font-weight: 600; }

.actions-cell { display: flex; gap: 0.375rem; }

.divider { height: 1px; background: var(--gray-100); margin: 1.25rem 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); }
.section-header p { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.2rem; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .app-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
