@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

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

:root {
  --font-main: 'Inter', sans-serif;
  --font-heading: 'Outfit', sans-serif;
  
  /* Light Theme */
  --bg-color: #fcfcfc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-main: #1a1a1a;
  --text-muted: #64748b;
  --primary: #003366;
  --primary-hover: #002244;
  --accent: #2563eb;
  --border-color: #e2e8f0;
  --table-header: #f8fafc;
  --table-row-hover: #f1f5f9;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --input-bg: #ffffff;
  --success: #22c55e;
}

[data-theme='dark'] {
  --bg-color: #0b0e14;
  --bg-sidebar: #10141d;
  --bg-card: #161b22;
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #79c0ff;
  --accent: #1f6feb;
  --border-color: #30363d;
  --table-header: #161b22;
  --table-row-hover: #21262d;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --input-bg: #0d1117;
  --danger: #f85149;
  --danger-hover: #da3633;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
}

/* Layout Utilities */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  .navbar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-brand p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  .nav-controls {
    justify-content: space-between;
  }
}

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav-user-role {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn-primary {
  background-color: var(--primary);
  color: white !important;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: var(--table-row-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-danger:hover {
  background-color: var(--danger-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-ghost:hover {
  background-color: var(--table-row-hover);
  color: var(--text-main);
}

/* Theme Toggle */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--table-row-hover);
}

/* ────────────────────────────────────────────────────────
   LOGIN PAGE STYLING (Replicado de LoginPage.css)
   ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  overflow: hidden;
  font-family: var(--font-main);
}

.login-bg-overlay {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 70% 70% at 10% 20%, rgba(37,99,235,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 90% 80%, rgba(99,102,241,0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(14,165,233,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 
    0 25px 60px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.05) inset;
  box-sizing: border-box;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-logo {
  flex-shrink: 0;
  background: var(--accent);
  padding: 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.login-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.login-brand p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  margin-bottom: 1.75rem;
}

.login-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.4rem 0;
}

.login-subtitle {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.5);
  margin: 0 0 1.75rem 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.login-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.input-wrapper input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.65rem;
  color: #fff;
  font-size: 0.95rem;
  transition: border-color 0.2s, background 0.2s;
  box-sizing: border-box;
}

.input-wrapper input::placeholder {
  color: rgba(255,255,255,0.25);
}

.input-wrapper input:focus {
  outline: none;
  border-color: rgba(96,165,250,0.6);
  background: rgba(255,255,255,0.1);
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
}

.toggle-pw {
  position: absolute;
  right: 0.9rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.toggle-pw:hover { color: rgba(255,255,255,0.7); }

.login-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 0.6rem;
  color: #fca5a5;
  font-size: 0.88rem;
}

.btn-login {
  margin-top: 0.5rem;
  padding: 0.85rem;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: opacity 0.2s, transform 0.15s;
  box-shadow: 0 4px 20px rgba(37,99,235,0.4);
}

.btn-login:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Animations */
.animate-scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ────────────────────────────────────────────────────────
   TABLE CONTAINER / DIRECTORY STYLING (De DirectoryTable.css)
   ──────────────────────────────────────────────────────── */
.table-container {
  background-color: var(--bg-card);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.table-header-box {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

.items-per-page {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.items-per-page select {
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  outline: none;
}

.table-filters {
  display: flex;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
}

.table-filters select, 
.table-filters input {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  min-width: 140px;
  flex: 1;
}

.table-filters input:focus, 
.table-filters select:focus {
  border-color: var(--primary);
}

.export-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.entry-count {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 38px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.count-label { font-weight: 500; }
.count-value { color: var(--accent); font-weight: 700; }
.count-total { font-weight: 500; }

.table-responsive {
  overflow-x: auto;
}

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

thead tr {
  border-bottom: 2px solid var(--border-color);
}

th {
  background-color: var(--table-header);
  padding: 1rem 1.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: none;
  white-space: nowrap;
  transition: all 0.2s;
}

th.sortable-th {
  cursor: pointer;
}

th.sortable-th:hover {
  color: var(--primary);
  background-color: var(--table-row-hover);
}

td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

tr:hover td {
  background-color: var(--table-row-hover);
}

.font-semibold { font-weight: 600; }

/* Badges (Recintos) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ponce { background-color: rgba(34, 197, 94, 0.1); color: #16a34a; }
.badge-arecibo { background-color: rgba(37, 99, 235, 0.1); color: #2563eb; }
.badge-mayagüez { background-color: rgba(245, 158, 11, 0.1); color: #b45309; }

[data-theme='dark'] .badge-ponce { background-color: rgba(34, 197, 94, 0.15); color: #4ade80; }
[data-theme='dark'] .badge-arecibo { background-color: rgba(59, 130, 246, 0.15); color: #60a5fa; }
[data-theme='dark'] .badge-mayagüez { background-color: rgba(251, 191, 36, 0.15); color: #fbbf24; }

/* Copy Field */
.copy-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-field button {
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.2s;
  cursor: pointer;
}

.copy-field button:hover {
  opacity: 1;
  color: var(--primary);
}

.email-link {
  color: var(--accent);
  text-decoration: none;
}

.email-link:hover {
  text-decoration: underline;
}

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

.action-btn {
  padding: 0.35rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: none;
  transition: all 0.2s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-btn.view { color: var(--primary); }
.action-btn.view:hover { background-color: rgba(37, 99, 235, 0.1); border-color: rgba(37, 99, 235, 0.2); }

.action-btn.edit { color: var(--accent); }
.action-btn.edit:hover { background-color: rgba(37, 99, 235, 0.08); border-color: rgba(37, 99, 235, 0.2); }

.action-btn.delete { color: #ef4444; }
.action-btn.delete:hover { background-color: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.2); }

/* Pagination */
.table-footer {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pagination .page-arrow,
.pagination .page-num {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
}

.pagination .page-num.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 700;
}

.pagination .page-num:hover:not(.active),
.pagination .page-arrow:hover:not(:disabled) {
  background-color: var(--table-row-hover);
}

.pagination .page-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination .page-dots {
  color: var(--text-muted);
  padding: 0 0.25rem;
  user-select: none;
}

/* ────────────────────────────────────────────────────────
   FORM AND EDITING VIEW STYLING (Para edit.php y admin.php)
   ──────────────────────────────────────────────────────── */
.form-card {
  background-color: var(--bg-card);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 0 auto;
}

.form-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.form-header h2 {
  font-size: 1.5rem;
  color: var(--text-main);
}

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

.form-section {
  margin-bottom: 2rem;
}

.form-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Col spans */
.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }
.col-2 { grid-column: span 2; }

@media (max-width: 768px) {
  .col-12, .col-8, .col-6, .col-4, .col-3, .col-2 {
    grid-column: span 12;
  }
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #16a34a;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Modals & Detail Drawers */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 500px;
  border-radius: 1rem;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-content.danger {
  border-color: rgba(239, 68, 68, 0.25);
  max-width: 400px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.25rem;
  margin: 0;
  color: var(--text-main);
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 0.5rem;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.animate-scale-in {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}


.drawer-content {
  background-color: var(--bg-card);
  width: 100%;
  max-width: 450px;
  height: 100%;
  box-shadow: -4px 0 25px rgba(0,0,0,0.15);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  animation: slideInRight 0.3s ease;
  overflow-y: auto;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.drawer-section {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
}

.drawer-section h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-val {
  font-weight: 600;
}

/* ── Admin Dashboard Styling ── */
.admin-container {
  max-width: 1100px;
  margin: 0 auto;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 2rem;
  padding-bottom: 0;
  flex-wrap: wrap;
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0.5rem 0.5rem 0 0;
  transition: all 0.2s ease;
}

.admin-tab:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.admin-tab.danger-tab:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.admin-tab.danger-tab.active {
  color: #ef4444;
  border-bottom-color: #ef4444;
  background: rgba(239, 68, 68, 0.06);
}

.admin-tab-content {
  animation: fadeInTab 0.25s ease;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-header h3 {
  font-size: 1.4rem;
  color: var(--text-main);
  margin: 0 0 0.25rem 0;
}

.panel-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.users-list-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  background: var(--bg-card);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--table-header);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover {
  background: var(--table-row-hover);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.role-badge.admin {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

.role-badge.viewer {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.status-toggle.active {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.status-toggle.inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
}

.data-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.admin-card {
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-header h4 {
  font-size: 1rem;
  margin: 0;
  color: var(--text-main);
}

.card-icon {
  width: 40px;
  height: 40px;
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon.danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.admin-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

.danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(135deg, var(--bg-card), rgba(239,68,68,0.03));
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  flex-wrap: wrap;
}

.danger-card-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.danger-card-left h4 {
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.danger-card-left p {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 500px;
}

.wipe-input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 2px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-main);
  text-align: center;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 1rem;
}

.wipe-input:focus {
  border-color: #ef4444;
  outline: none;
}

.danger-alert-icon {
  color: #ef4444;
  margin-bottom: 1rem;
}

.btn-small-primary {
  background-color: var(--primary);
  color: white !important;
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.btn-small-primary:hover { opacity: 0.85; }

.btn-icon-danger {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon-danger:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

.btn-icon-edit {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 5px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon-edit:hover {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
}

.loading-state {
  display: flex;
  justify-content: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* ── Column Picker Styles ── */
.column-picker-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 100;
  box-shadow: var(--shadow);
  width: 280px;
  max-height: 650px;
  overflow-y: auto;
  box-sizing: border-box;
}

.contact-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.contact-link:hover {
  text-decoration: underline;
}

.column-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

.column-picker-item:hover {
  background-color: var(--table-row-hover);
}

.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem 0.75rem 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reset-picker {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.reset-picker:hover {
  background-color: rgba(37, 99, 235, 0.1);
}

.order-btns {
  display: flex;
  gap: 0.25rem;
}

.order-btns button {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.2rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.order-btns button:hover:not(:disabled) {
  color: var(--primary);
  border-color: var(--primary);
}

.order-btns button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.column-label-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  cursor: pointer;
}

.column-name {
  font-size: 0.85rem;
  color: var(--text-main);
}

/* Switch Toggle Styles */
.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

input:disabled + .slider {
  opacity: 0.5;
  cursor: not-allowed;
}
