/* =========================================
   CenterYou Management - main.css
   ========================================= */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #14b8a6;
  --primary-bg: #f0fdfa;
  --secondary: #6366f1;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --sidebar-bg: #0f172a;
  --sidebar-text: #e2e8f0;
  --sidebar-active: #0d9488;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --sidebar-width: 260px;
  --transition: 0.2s ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---- TYPOGRAPHY ---- */
h1 { font-size: 1.875rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; }
p { margin-bottom: 0; }
small { font-size: 0.875rem; }

/* ---- LAYOUT UTILITIES ---- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.grid { display: grid; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 50%, #0f172a 100%);
  padding: 1.5rem;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  box-shadow: 0 8px 16px rgba(13, 148, 136, 0.3);
}

.login-logo h1 {
  font-size: 1.75rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-form h2 {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 0.875rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.input-wrapper .toggle-pw {
  position: absolute;
  right: 0.875rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem;
  cursor: pointer;
  transition: color var(--transition);
}
.input-wrapper .toggle-pw:hover { color: var(--text); }

.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
}
.error-message.visible { display: flex; }

.btn-login {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 148, 136, 0.45); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ── OTP step ── */
.otp-step h2 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}
.otp-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.otp-description strong { color: var(--text); }
.otp-input {
  letter-spacing: 0.3em;
  font-size: 1.25rem;
  text-align: center;
  font-weight: 600;
}
.otp-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.resend-timer { font-size: 0.8rem; color: var(--text-muted); }
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }
.btn-link:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }

.login-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.5;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: #cbd5e1; }

.btn-danger {
  background: var(--error);
  color: white;
  border-color: var(--error);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; border-color: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--text); }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}
.btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

/* ============================================================
   FORM INPUTS (general)
   ============================================================ */
.form-control {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.form-control::placeholder { color: #94a3b8; }
.form-control:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.25rem; padding-right: 2.5rem; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.8rem; color: var(--error); margin-top: 0.3rem; }
.form-group { margin-bottom: 1.125rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-admin { background: #eef2ff; color: #4338ca; }
.badge-moderator { background: #fffbeb; color: #b45309; }
.badge-user { background: #f1f5f9; color: #475569; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #fef2f2; color: #b91c1c; }
.badge-fitness { background: #ecfdf5; color: #047857; }
.badge-wellness { background: #fdf4ff; color: #7e22ce; }
.badge-health { background: #eff6ff; color: #1d4ed8; }
.badge-facilities { background: #fff7ed; color: #c2410c; }
.badge-general { background: #f8fafc; color: #475569; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-error { background: #fef2f2; color: #b91c1c; }
.badge-info { background: #eff6ff; color: #1d4ed8; }

/* Audit action badges */
.badge-create { background: #dcfce7; color: #15803d; }
.badge-update { background: #dbeafe; color: #1d4ed8; }
.badge-delete { background: #fee2e2; color: #b91c1c; }
.badge-assign { background: #e0f2fe; color: #0369a1; }
.badge-unassign { background: #fff7ed; color: #c2410c; }
.badge-auth { background: #f3f4f6; color: #374151; }


/* ============================================================
   TABLES
   ============================================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

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

thead tr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid #f8fafc;
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-bg); }

tbody td {
  padding: 0.75rem 1rem;
  color: var(--text);
  vertical-align: middle;
}

.table-actions {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-panel {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition);
}
.modal-overlay.open .modal-panel { transform: translateY(0) scale(1); }
.modal-panel.modal-lg { max-width: 680px; }
.modal-panel.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--bg); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 12px 12px;
}


/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-sm { width: 1rem; height: 1rem; border-width: 2px; }
.spinner-lg { width: 2.5rem; height: 2.5rem; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  gap: 1rem;
  color: var(--text-muted);
}


/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.04);
  font-size: 0.875rem;
  animation: toastIn 0.25s ease;
  border-left: 4px solid var(--primary);
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--error); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--secondary); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}


/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-card-icon.teal { background: #ccfbf1; }
.stat-card-icon.indigo { background: #e0e7ff; }
.stat-card-icon.green { background: #dcfce7; }
.stat-card-icon.amber { background: #fef9c3; }
.stat-card-info { flex: 1; min-width: 0; }
.stat-card-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-card-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }


/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; max-width: 340px; margin: 0 auto 1.25rem; }


/* ============================================================
   SEARCH INPUT
   ============================================================ */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrapper .search-icon {
  position: absolute;
  left: 0.875rem;
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.search-wrapper input {
  padding-left: 2.625rem;
}


/* ============================================================
   DASHBOARD (member)
   ============================================================ */
.dashboard-layout {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.top-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.top-navbar .nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.nav-brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
}
.top-navbar .nav-spacer { flex: 1; }
.top-navbar .nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.nav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.dashboard-content {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.welcome-section {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 16px;
  padding: 2rem;
  color: white;
  margin-bottom: 2rem;
}
.welcome-section h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.welcome-section p { opacity: 0.85; font-size: 0.95rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}
.section-subtitle { font-size: 0.875rem; color: var(--text-muted); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.feature-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.feature-card-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.625rem;
}
.feature-card-name { font-weight: 600; font-size: 0.975rem; color: var(--text); }
.feature-card-desc { font-size: 0.825rem; color: var(--text-muted); line-height: 1.5; }

/* Dashboard tabs */
.dashboard-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }


/* ============================================================
   ADMIN PANEL LAYOUT
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: transform var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}
.sidebar-logo-text { font-size: 1.2rem; font-weight: 700; color: #f1f5f9; letter-spacing: -0.02em; }
.sidebar-logo-sub { font-size: 0.7rem; color: #64748b; margin-top: 1px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #475569;
  padding: 0.75rem 0.75rem 0.375rem;
  margin-top: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.875rem;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.nav-item.active { background: rgba(13, 148, 136, 0.2); color: #2dd4bf; }
.nav-item.active .nav-item-icon { color: var(--primary-light); }
.nav-item-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-item-label { flex: 1; }
.nav-item-badge {
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; color: #e2e8f0; }
.sidebar-user-role { font-size: 0.75rem; color: #64748b; }
.sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.875rem;
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-logout:hover { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* MAIN CONTENT */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.admin-topbar .topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.375rem;
  cursor: pointer;
  color: var(--text);
  padding: 0.25rem;
}

.admin-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Section heading */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header h2 { font-size: 1.375rem; }
.page-header p { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.2rem; }

/* Content card */
.content-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.content-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}
.content-card-title { font-size: 0.95rem; font-weight: 600; }
.content-card-body { padding: 1.25rem; }

/* Toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* User initials avatar in table */
.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.user-info-cell { display: flex; align-items: center; gap: 0.625rem; }
.user-info-name { font-weight: 500; font-size: 0.875rem; }
.user-info-username { font-size: 0.75rem; color: var(--text-muted); }

/* Right slide panel */
.side-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(1px);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.side-panel-overlay.open { opacity: 1; pointer-events: all; }

.side-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  background: var(--surface);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  z-index: 510;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}
.side-panel.open { transform: translateX(0); }

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.side-panel-header h3 { font-size: 1rem; }
.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}
.side-panel-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bg);
}

/* User detail in panel */
.user-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.user-detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.user-detail-name { font-size: 1.1rem; font-weight: 600; }
.user-detail-meta { font-size: 0.8rem; color: var(--text-muted); }

.detail-section { margin-bottom: 1.5rem; }
.detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.detail-row { display: flex; gap: 0.5rem; padding: 0.4rem 0; font-size: 0.875rem; }
.detail-row .detail-label { color: var(--text-muted); min-width: 110px; flex-shrink: 0; }
.detail-row .detail-value { color: var(--text); font-weight: 500; }

/* Feature toggle cards in assignment panel */
.feature-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem;
}
.feature-toggle-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface);
  user-select: none;
}
.feature-toggle-card:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.feature-toggle-card.assigned {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.feature-toggle-card.assigned .feature-toggle-check { opacity: 1; }
.feature-toggle-icon { font-size: 1.25rem; flex-shrink: 0; }
.feature-toggle-name { font-size: 0.8rem; font-weight: 500; flex: 1; }
.feature-toggle-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  justify-content: center;
  margin-top: 1.25rem;
}
.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
}
.page-btn:hover { background: var(--bg); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Overview recent log */
.recent-log {
  list-style: none;
  padding: 0;
}
.recent-log-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f8fafc;
  font-size: 0.85rem;
}
.recent-log-item:last-child { border-bottom: none; }
.recent-log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}
.recent-log-text { flex: 1; color: var(--text); line-height: 1.4; }
.recent-log-time { color: var(--text-muted); white-space: nowrap; font-size: 0.75rem; }

/* Confirm dialog */
.confirm-dialog {
  max-width: 380px !important;
}
.confirm-dialog .modal-body {
  text-align: center;
  padding: 2rem 1.5rem 1rem;
}
.confirm-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.confirm-message { font-size: 0.95rem; color: var(--text); }
.confirm-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Feature icon in table */
.feature-icon-cell {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Audit log table */
.audit-actor { font-weight: 500; }
.audit-target { font-size: 0.8rem; color: var(--text-muted); }
.audit-payload {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile hamburger overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}
.sidebar-overlay.open { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .admin-main {
    margin-left: 0;
  }
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
  .feature-toggles {
    grid-template-columns: 1fr;
  }
  .side-panel {
    width: 100vw;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-content {
    padding: 1rem;
  }
  .admin-body {
    padding: 1rem;
  }
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (max-width: 480px) {
  .stat-cards {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 1.75rem 1.25rem;
  }
}

/* scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
