/*=============================================
   PMS - Panel Management System
   Professional Light Theme (ibigrs-style)
   Clean, Accessible, Corporate
=============================================*/

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-hover: rgba(255, 255, 255, 0.95);
  --border-glass: #e2e8f0;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --primary: #1a56db;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;
  --primary-dark: #1e3a8a;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --success: #059669;
  --success-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --info: #0284c7;
  --info-light: #e0f2fe;

  --gradient-hero: linear-gradient(135deg, #1a56db 0%, #3b82f6 50%, #06b6d4 100%);
  --gradient-card: linear-gradient(135deg, rgba(26,86,219,0.05) 0%, rgba(6,182,212,0.05) 100%);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 16px rgba(26,86,219,0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;

  --sidebar-width: 260px;
  --header-height: 60px;

  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-size: 14px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 15% 40%, rgba(26,86,219,0.03) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(6,182,212,0.03) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 85%, rgba(59,130,246,0.02) 0%, transparent 55%);
  pointer-events: none;
  z-index: -1;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0;
  color: var(--text-primary);
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary-hover); }

/* ---- Layout ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform var(--transition-normal), width var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 8px;
}

.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: var(--gradient-hero);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.sidebar-brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }

.sidebar-nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  padding: 16px 22px 8px;
  font-weight: 600;
}

.sidebar-nav-item { padding: 2px 12px; }

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.sidebar-nav-link.active {
  background: rgba(26,86,219,0.2);
  color: #93c5fd;
}

.sidebar-nav-link .nav-icon { display: flex; align-items: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 22px;
  border-top: 1px solid #1e293b;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 500;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  width: 320px;
  transition: border-color var(--transition-fast);
}

.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}

.header-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  color: var(--text-primary);
  width: 100%;
}

.header-search input::placeholder { color: #94a3b8; }

.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Page Content */
.app-content {
  flex: 1;
  padding: 24px;
  animation: fadeIn 0.3s ease;
}

/* Footer */
.app-footer {
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-glass);
  background: var(--bg-card);
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  transition: box-shadow var(--transition-normal);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 1.05rem; font-weight: 600; margin: 0; }

.card-body { padding: 22px; }

.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-glass);
  background: var(--bg-secondary);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border-color: var(--border-glass);
}

.btn-secondary:hover { background: var(--bg-secondary); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover { background: #047857; }

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover { background: #b45309; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-group { display: flex; gap: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-control::placeholder { color: #94a3b8; }

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

textarea.form-control { min-height: 90px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr;       /* Mobile: 1 column */
  gap: 16px;
}

@media (min-width: 577px) {
  .form-row {
    grid-template-columns: 1fr 1fr 1fr; /* Tablet & Desktop: 3 columns */
  }
}

.form-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-glass);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg-secondary); }

.table tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-new { background: #e0f2fe; color: #0369a1; }
.badge-verified { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-pendingverification { background: #fef3c7; color: #92400e; }
.badge-contacted { background: #e0f2fe; color: #0369a1; }
.badge-qualified { background: #c7d2fe; color: #3730a3; }
.badge-invited { background: #ede9fe; color: #5b21b6; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-blacklisted { background: #1e293b; color: #f1f5f9; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-installed { background: #d1fae5; color: #065f46; }
.badge-installed { background: #d1fae5; color: #065f46; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  margin-bottom: 16px;
}

.alert-danger {
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-success {
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.alert-info {
  background: var(--info-light);
  color: #075985;
  border: 1px solid #7dd3fc;
}

.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* ---- Utility Classes ---- */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.w-100 { width: 100%; }
.flex-wrap { flex-wrap: wrap; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ---- Detail List ---- */
.detail-list { margin: 0; }

.detail-list dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 600;
}

.detail-list dd {
  margin: 0 0 14px 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.detail-list dd:last-child { margin-bottom: 0; }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state-text {
  color: var(--text-muted);
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ---- Stats Cards ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-glass);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-bottom: -2px;
}

.tab-item:hover { color: var(--text-primary); }

.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body { padding: 22px; }

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Timeline ---- */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border-glass);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-text {
  font-size: 0.88rem;
  color: var(--text-primary);
}

/* ---- Search Results ---- */
.search-bar-large {
  position: relative;
  max-width: 680px;
  margin: 0 auto 24px;
}

.search-bar-large input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  border: 2px solid var(--border-glass);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-bar-large input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26,86,219,0.08);
}

.search-bar-large svg.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ---- Autocomplete Dropdown ---- */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-glass);
  font-size: 0.88rem;
}

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item:hover { background: var(--primary-light); }

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar select,
.filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26,86,219,0.08);
}

/* ---- Score Badge ---- */
.score-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.score-high { background: #d1fae5; color: #065f46; }
.score-medium { background: #fef3c7; color: #92400e; }
.score-low { background: #f1f5f9; color: #64748b; }

/* ---- Progress Bar ---- */
.progress-bar {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-hero);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ---- Avatar ---- */
.avatar {
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* ---- Upload Area ---- */
.upload-area {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  transition: all var(--transition-fast);
  background: var(--bg-secondary);
  cursor: pointer;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-area-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.upload-area-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-area-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.pagination a:hover { background: var(--bg-secondary); }

.pagination .active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ---- Sidebar Bottom User ---- */
.sidebar-footer-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid #1e293b;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sidebar-footer-user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  transition: box-shadow 0.2s ease;
}

.sidebar-footer-user:hover .sidebar-user-avatar {
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Crystal Login Button */
.sidebar-login-btn {
  text-decoration: none;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.20) 0%, rgba(139, 92, 246, 0.25) 50%, rgba(167, 139, 250, 0.20) 100%);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 0;
  margin: auto 0 0 0;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(139, 92, 246, 0.35);
  border-bottom: none;
  border-left: none;
  border-right: none;
}

.sidebar-login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  transform: skewX(-25deg);
  animation: sidebarLoginShine 3s ease-in-out infinite;
}

@keyframes sidebarLoginShine {
  0% { left: -75%; }
  50% { left: 120%; }
  100% { left: 120%; }
}

.sidebar-login-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(139, 92, 246, 0.40) 50%, rgba(167, 139, 250, 0.35) 100%);
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transform: translateY(-1px);
}

.sidebar-login-btn:active {
  transform: translateY(0) scale(0.98);
}

.sidebar-login-btn .sidebar-user-avatar {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
  transition: box-shadow 0.3s ease;
}

.sidebar-login-btn:hover .sidebar-user-avatar {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.6);
}

.sidebar-login-btn .sidebar-user-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #c4b5fd;
  letter-spacing: 0.3px;
}

/* ---- User Profile Popup ---- */
.user-profile-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.35);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.user-profile-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.user-profile-popup {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 320px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.06);
  z-index: 3001;
  transform: translateY(-8px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.22s ease;
  overflow: visible;
}

.user-profile-popup::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 30px;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 14px solid #ffffff;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.08));
}

.user-profile-popup.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.user-popup-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 18px;
  text-align: center;
}

.user-popup-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.user-popup-greeting {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.user-popup-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0;
}

.user-popup-body {
  padding: 16px 20px;
}

.user-popup-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.user-popup-detail-row:last-child {
  margin-bottom: 0;
}

.user-popup-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

.user-popup-value {
  font-size: 0.88rem;
  font-weight: 500;
  color: #334155;
  word-break: break-all;
}

.user-popup-footer {
  padding: 16px 20px;
}

.btn-popup-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 20px;
  background: #fef2f2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-popup-signout:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn-popup-signout:active {
  transform: scale(0.97);
}

/* ---- Auth Pages ---- */
.auth-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 30%, #312e81 60%, #1e3a8a 100%);
  position: relative;
  overflow: hidden;
}

/* Animated floating orbs */
.auth-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
  top: -120px; left: -100px;
  animation: authOrbFloat 8s ease-in-out infinite alternate;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
  bottom: -100px; right: -80px;
  animation: authOrbFloat 10s ease-in-out infinite alternate-reverse;
}

@keyframes authOrbFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, 30px) scale(1.15); }
}

/* Particle grid overlay */
.auth-particles {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.04) 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.03) 1px, transparent 1px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 100px 100px, 150px 150px, 120px 120px;
  pointer-events: none;
}

/* Crystal Glass Card */
.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 44px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 60px rgba(99, 102, 241, 0.1);
  animation: cardSlideIn 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Brand logo area */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.auth-logo svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.auth-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin: 0 0 32px;
  font-weight: 400;
}

/* Glass input fields */
.auth-card .form-group {
  margin-bottom: 20px;
}

.auth-card .form-label {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.auth-card .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #ffffff;
  transition: all 0.25s ease;
}

.auth-card .form-control::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.auth-card .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(129, 140, 248, 0.5);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
}

.auth-card .text-danger {
  color: #fca5a5 !important;
  font-size: 0.78rem;
}

.auth-card .alert-danger {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.82rem;
  margin-bottom: 20px;
}

/* Crystal Sign In Button */
.btn-auth-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  background-size: 200% 200%;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-sans);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5), 0 0 0 1px rgba(255,255,255,0.1) inset;
  animation: shimmer 3s ease-in-out infinite;
}

.btn-auth-signin::before {
  content: '';
  position: absolute;
  top: 0; left: -75%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  transform: skewX(-25deg);
  animation: buttonShine 3s ease-in-out infinite;
}

@keyframes buttonShine {
  0% { left: -75%; }
  50% { left: 120%; }
  100% { left: 120%; }
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.btn-auth-signin:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.7), 0 0 0 1px rgba(255,255,255,0.15) inset;
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #c4b5fd 100%);
}

.btn-auth-signin:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.4);
}

/* Bottom link */
.auth-card .auth-footer-link {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

.auth-card .auth-footer-link a {
  color: #a78bfa;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-card .auth-footer-link a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

.auth-card-header {
}

.user-menu-detail-value {
  font-size: 0.84rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* Footer: sign out button */
.user-menu-footer {
  padding: 8px 12px 12px;
}

.btn-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.btn-signout:hover {
  background: var(--danger-light);
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-signout svg {
  flex-shrink: 0;
}

/* ---- Crystal Glass Login Popup ---- */
.login-popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.login-popup-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.login-popup-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: 
    linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.10) 40%, rgba(255,255,255,0.18) 100%);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 24px;
  padding: 40px 36px 32px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset,
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 0 80px rgba(139, 92, 246, 0.12);
  overflow: hidden;
  z-index: 4001;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease;
  overflow-y: auto;
}

.login-popup-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.login-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.login-popup-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.login-popup-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.login-popup-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.login-popup-subtitle {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin: 0 0 28px;
}

.login-popup-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-popup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-popup-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

.login-popup-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  color: #ffffff;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.25s ease;
}

.login-popup-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.login-popup-input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.login-popup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  background-size: 200% 200%;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  letter-spacing: 0.2px;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: loginPopupShimmer 3s ease-in-out infinite;
  margin-top: 4px;
}

.login-popup-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -75%;
  width: 55%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-25deg);
  animation: loginPopupShine 3s ease-in-out infinite;
}

@keyframes loginPopupShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes loginPopupShine {
  0% { left: -75%; }
  50% { left: 120%; }
  100% { left: 120%; }
}

.login-popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.login-popup-btn:active {
  transform: translateY(0) scale(0.98);
}

.login-popup-register {
  text-align: center;
  margin: 24px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

.login-popup-register a {
  color: #a78bfa;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.login-popup-register a:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .header-search { width: 200px; }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-header { flex-direction: column; }

  .table th, .table td { padding: 8px 10px; font-size: 0.8rem; }
}

/* ================================================================
   IMPORT / DRAG-AND-DROP UPLOAD
   ================================================================ */

/* ---- Drop Zone ---- */
.upload-dropzone {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.upload-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light, #EEF2FF);
}

.upload-dropzone-active {
  border-color: var(--primary);
  background: var(--primary-light, #EEF2FF);
  box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.12);
}

.upload-dropzone-content {
  pointer-events: none;
}

.upload-dropzone-icon {
  color: var(--primary);
  margin-bottom: 12px;
}

.upload-dropzone-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.upload-dropzone-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-dropzone-formats {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ---- File Preview Card ---- */
.file-preview {
  margin-top: 16px;
}

.file-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
}

.file-preview-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.file-preview-info {
  flex: 1;
  min-width: 0;
}

.file-preview-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-size {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---- Upload Progress Bar ---- */
.upload-progress {
  margin-top: 16px;
}

.upload-progress .progress-bar {
  width: 100%;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress .progress-bar-fill {
  height: 100%;
  background: var(--gradient-hero, linear-gradient(135deg, #1a56db, #1e40af));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ---- Mapping Table ---- */
.mapping-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-card);
  color: var(--text-primary);
}

.mapping-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}
