/* =========================================
   QR Attendance System — Premium Dark UI
   Design: Dark SaaS Admin Panel
   ========================================= */

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

/* ── Design Tokens ──────────────────────── */
:root {
  /* Brand */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;

  /* Surface */
  --bg:        #0f1117;
  --bg-2:      #161b27;
  --bg-3:      #1e2534;
  --surface:   #1a2035;
  --surface-2: #212840;
  --border:    rgba(255,255,255,0.07);
  --border-hi: rgba(99,102,241,0.4);

  /* Text */
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;

  /* Semantic */
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --danger:  #ef4444;
  --danger-bg: rgba(239,68,68,0.12);
  --info:    #38bdf8;
  --info-bg: rgba(56,189,248,0.12);

  /* Gradients */
  --grad-brand:  linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --grad-teal:   linear-gradient(135deg, #06b6d4 0%, #6366f1 100%);
  --grad-glow:   linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.08) 100%);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Shadow */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(99,102,241,0.25);

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h:  64px;
  --transition: 0.2s ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── App Shell ──────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
  overflow: hidden;
}

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

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  margin-top: 1.25rem;
}
.sidebar-section-label:first-child { margin-top: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-link:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

.nav-link.active {
  background: rgba(99,102,241,0.15);
  color: var(--brand-400);
  font-weight: 600;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--brand-500);
}

.nav-link-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r-md);
  transition: background var(--transition);
}
.sidebar-user:hover { background: var(--bg-3); }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; font-weight: 600; color: var(--text-1); }
.sidebar-user-role { font-size: 0.7rem; color: var(--text-3); }

.sidebar-logout {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Main Content ───────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ─────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 400;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-full);
  background: var(--success-bg);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
}
.topbar-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.topbar-date {
  font-size: 0.8rem;
  color: var(--text-2);
  padding: 0.3rem 0.75rem;
  background: var(--bg-3);
  border-radius: var(--r-full);
  font-weight: 500;
}

/* ── Page Content ───────────────────────── */
.page-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Page Header ────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-header-left { flex: 1; }
.page-header-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-400);
  margin-bottom: 0.25rem;
}
.page-header-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.page-header-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-top: 0.25rem;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-glow);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover { border-color: var(--border-hi); box-shadow: var(--shadow-md); }
.stat-card:hover::after { opacity: 1; }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: rgba(99,102,241,0.12);
  color: var(--brand-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger  { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.info    { background: var(--info-bg);    color: var(--info); }

.stat-body { flex: 1; min-width: 0; }

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.stat-delta {
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 0.4rem;
  color: var(--success);
}

/* ── Cards ──────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

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

.card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-title i { color: var(--brand-400); }

.card-body { padding: 1.5rem; }

/* ── Nav Quick-Access Grid ──────────────── */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-1);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.nav-item:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-item:hover::after { transform: scaleX(1); }

.nav-item-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: rgba(99,102,241,0.12);
  color: var(--brand-400);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.nav-item:hover .nav-item-icon {
  background: var(--grad-brand);
  color: white;
  box-shadow: var(--shadow-glow);
}

.nav-item-content h3 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 0.2rem;
}

.nav-item-content p {
  font-size: 0.75rem;
  color: var(--text-3);
  margin: 0;
  line-height: 1.4;
}

/* ── Buttons ────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-brand);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,0.5);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-2);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text-1); border-color: var(--border-hi); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(34,197,94,0.2);
}
.btn-success:hover { background: var(--success); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); }

.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--r-md);
}

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

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

.form-label i { margin-right: 0.35rem; color: var(--brand-400); }

.form-input,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.875rem;
  transition: all var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder { color: var(--text-3); }

.form-input:hover, .form-select:hover { border-color: rgba(255,255,255,0.12); }

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: var(--surface-2);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
}

.form-select option {
  background: var(--bg-2);
  color: var(--text-1);
}

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

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

/* ── Tables ─────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-md);
}

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

.data-table thead { background: var(--bg-3); }

.data-table th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover { background: var(--bg-3); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Avatar ─────────────────────────────── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
}

/* ── Badges ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary { background: rgba(99,102,241,0.15); color: var(--brand-400); }
.badge-secondary { background: var(--bg-3); color: var(--text-2); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

/* ── Status Indicator ───────────────────── */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Search Box ─────────────────────────── */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 0.75rem;
  color: var(--text-3);
  font-size: 0.875rem;
}

.search-box input {
  padding: 0.5rem 0.875rem 0.5rem 2.25rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 0.875rem;
  min-width: 220px;
  transition: all var(--transition);
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* ── Action Button Row ──────────────────── */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.btn-view   { background: rgba(56,189,248,0.1); color: var(--info);    border: 1px solid rgba(56,189,248,0.2); }
.btn-edit   { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.btn-delete { background: var(--danger-bg);     color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }

.btn-view:hover   { background: var(--info);    color: white; }
.btn-edit:hover   { background: var(--warning); color: white; }
.btn-delete:hover { background: var(--danger);  color: white; }

/* ── Student Row Cell ───────────────────── */
.student-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-cell-info .name { font-weight: 600; color: var(--text-1); margin-bottom: 0.1rem; }
.student-cell-info .sub  { font-size: 0.75rem; color: var(--text-3); }

/* ── QR Thumbnail ───────────────────────── */
.qr-thumb {
  width: 48px; height: 48px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  background: white;
}
.qr-thumb:hover { transform: scale(1.15); border-color: var(--brand-500); }

/* ── Empty State ────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-3);
}

.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-3);
  margin: 0 auto 1.5rem;
}

.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-2); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.875rem; max-width: 360px; margin: 0 auto 1.5rem; }

/* ── Toast Notifications ────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-1);
  max-width: 360px;
  pointer-events: auto;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.show { transform: translateX(0); }
.toast i { flex-shrink: 0; font-size: 1rem; }
.toast-success i { color: var(--success); }
.toast-error i   { color: var(--danger); }
.toast-info i    { color: var(--info); }

/* ── Scanner ────────────────────────────── */
.scanner-wrapper {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
  max-width: 640px;
  margin: 0 auto;
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-corners {
  width: 200px; height: 200px;
  position: relative;
}

.scanner-corners::before,
.scanner-corners::after,
.scanner-corners span::before,
.scanner-corners span::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: var(--brand-500);
  border-style: solid;
}

.scanner-corners::before     { top: 0;    left: 0;   border-width: 3px 0 0 3px; border-radius: var(--r-sm) 0 0 0; }
.scanner-corners::after      { top: 0;    right: 0;  border-width: 3px 3px 0 0; border-radius: 0 var(--r-sm) 0 0; }
.scanner-corners span::before { bottom: 0; left: 0;   border-width: 0 0 3px 3px; border-radius: 0 0 0 var(--r-sm); }
.scanner-corners span::after  { bottom: 0; right: 0;  border-width: 0 3px 3px 0; border-radius: 0 0 var(--r-sm) 0; }

.scanner-scanline {
  position: absolute;
  left: 4%;
  right: 4%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-500), transparent);
  animation: scan 2.5s ease-in-out infinite;
  top: 10%;
}

@keyframes scan {
  0%, 100% { top: 10%; }
  50% { top: 85%; }
}

.scanner-status {
  margin-top: 1rem;
  text-align: center;
}

.scan-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--r-full);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.scan-status-pill.ready   { background: var(--success-bg); border-color: rgba(34,197,94,0.2); color: var(--success); }
.scan-status-pill.error   { background: var(--danger-bg);  border-color: rgba(239,68,68,0.2); color: var(--danger); }
.scan-status-pill.success { background: var(--success-bg); border-color: rgba(34,197,94,0.2); color: var(--success); }

/* ── QR Code Viewer ─────────────────────── */
.qr-code-display {
  text-align: center;
  padding: 2.5rem;
}

.qr-code-img {
  max-width: 260px;
  margin: 0 auto 1.5rem;
  border-radius: var(--r-lg);
  border: 3px solid var(--border);
  background: white;
  padding: 1rem;
  transition: all var(--transition);
  display: block;
}
.qr-code-img:hover { border-color: var(--brand-500); box-shadow: var(--shadow-glow); }

/* ── Profile Hero ───────────────────────── */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--bg-3);
  border-radius: var(--r-lg);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.profile-hero .avatar-lg { flex-shrink: 0; }

.profile-hero-info .name { font-size: 1.25rem; font-weight: 800; color: var(--text-1); margin-bottom: 0.5rem; }

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-2);
}
.profile-meta-item i { color: var(--brand-400); }

/* ── Info Steps (How to use) ────────────── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.step-num {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.step-item h3 { font-size: 0.875rem; font-weight: 700; color: var(--text-1); margin-bottom: 0.25rem; }
.step-item p  { font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }

/* ── Preview Card ───────────────────────── */
.preview-card {
  background: var(--grad-brand);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  text-align: center;
  color: white;
}
.preview-card .name { font-size: 1.25rem; font-weight: 800; margin-bottom: 0.5rem; }
.preview-card .details { font-size: 0.875rem; opacity: 0.85; }

/* ── Recent List ────────────────────────── */
.recent-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem;
  border-radius: var(--r-md);
  transition: background var(--transition);
}
.recent-item:hover { background: var(--bg-3); }
.recent-item .info { flex: 1; min-width: 0; }
.recent-item .info .name { font-size: 0.875rem; font-weight: 600; color: var(--text-1); }
.recent-item .info .sub  { font-size: 0.75rem; color: var(--text-3); }

/* ── Filter Form ────────────────────────── */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ── Animations ─────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in  { animation: fadeIn 0.45s ease both; }
.fade-in-1 { animation: fadeIn 0.45s ease 0.1s both; }
.fade-in-2 { animation: fadeIn 0.45s ease 0.2s both; }
.fade-in-3 { animation: fadeIn 0.45s ease 0.3s both; }
.fade-in-4 { animation: fadeIn 0.45s ease 0.4s both; }

/* ── Mobile Overlay ─────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 90;
  backdrop-filter: blur(4px);
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 240px; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 56px; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.visible { display: block; }

  .main-area { margin-left: 0; }

  .topbar { padding: 0 1rem; }

  .page-content { padding: 1rem; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .nav-grid { grid-template-columns: 1fr 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .filter-grid { grid-template-columns: 1fr 1fr; }

  .page-header { flex-direction: column; }

  .card-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .nav-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
}

/* ── Menu Toggle Button ─────────────────── */
.menu-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--text-2);
  transition: all var(--transition);
  flex-shrink: 0;
}
.menu-toggle:hover { background: var(--bg-3); color: var(--text-1); }

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
}

/* ── Scanned Result ─────────────────────── */
.scanned-result {
  display: none;
  background: rgba(99,102,241,0.1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-weight: 600;
  color: var(--brand-400);
  text-align: center;
  font-size: 0.9rem;
}

/* ── Utility ────────────────────────────── */
.text-muted  { color: var(--text-3); }
.text-sm     { font-size: 0.8125rem; }
.font-bold   { font-weight: 700; }
.mb-0        { margin-bottom: 0 !important; }
.mb-1        { margin-bottom: 0.5rem; }
.mt-auto     { margin-top: auto; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1       { gap: 0.5rem; }
.gap-2       { gap: 1rem; }
.w-full      { width: 100%; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
