/* =============================================================
   Biometric Attendance Management System — Design System
   Premium Dark Mode Admin Dashboard
   ============================================================= */

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

/* ─────────────────────────────────────────────────────────────
   CSS Custom Properties (Design Tokens)
───────────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base:         #0b0f1a;
  --bg-surface:      #111827;
  --bg-elevated:     #1a2235;
  --bg-card:         #1e293b;
  --bg-hover:        #243047;

  --border:          rgba(255,255,255,0.07);
  --border-active:   rgba(99,102,241,0.5);

  --accent:          #6366f1;
  --accent-hover:    #818cf8;
  --accent-glow:     rgba(99,102,241,0.25);
  --accent-dim:      rgba(99,102,241,0.15);

  --success:         #10b981;
  --success-dim:     rgba(16,185,129,0.15);
  --warning:         #f59e0b;
  --warning-dim:     rgba(245,158,11,0.15);
  --danger:          #ef4444;
  --danger-dim:      rgba(239,68,68,0.15);
  --info:            #3b82f6;
  --info-dim:        rgba(59,130,246,0.15);
  --purple:          #a855f7;
  --purple-dim:      rgba(168,85,247,0.15);

  --text-primary:    #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #64748b;

  /* Sidebar */
  --sidebar-w:       260px;
  --sidebar-bg:      #0d1321;

  /* Spacing */
  --sp-1:  4px;   --sp-2:  8px;
  --sp-3: 12px;   --sp-4: 16px;
  --sp-5: 20px;   --sp-6: 24px;
  --sp-8: 32px;   --sp-10:40px;

  /* Radius */
  --r-sm:  6px;  --r-md: 10px;
  --r-lg: 16px;  --r-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.5);
  --shadow-accent: 0 0 24px var(--accent-glow);

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-normal: 0.25s ease;
  --t-slow:   0.4s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────
   Layout — Admin Shell
───────────────────────────────────────────────────────────── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}

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

.sidebar-brand .brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-item.active .nav-icon { opacity: 1; }

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

.user-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-elevated);
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--sp-1);
  border-radius: var(--r-sm);
  transition: color var(--t-fast);
  display: flex;
}

.logout-btn:hover { color: var(--danger); }

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

/* Topbar */
.topbar {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

.topbar-left { display: flex; flex-direction: column; }
.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.live-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-dim);
  padding: 6px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-active);
  font-variant-numeric: tabular-nums;
}

/* Page Body */
.page-body {
  flex: 1;
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* ─────────────────────────────────────────────────────────────
   Login Page
───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
}

.login-bg-orb-1 {
  width: 500px; height: 500px;
  background: var(--accent);
  top: -150px; left: -150px;
}

.login-bg-orb-2 {
  width: 400px; height: 400px;
  background: #a855f7;
  bottom: -100px; right: -100px;
}

.login-card {
  width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-10);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: slideUp 0.5s ease;
}

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

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-8);
}

.login-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 40px var(--accent-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 24px var(--accent-glow); }
  50%       { box-shadow: 0 0 48px var(--accent-glow); }
}

.login-logo-title {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent-hover), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.login-logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ─────────────────────────────────────────────────────────────
   Form Elements
───────────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-control {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 11px var(--sp-4);
  font-size: 14px;
  width: 100%;
  transition: all var(--t-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-muted); }

.input-icon-wrapper {
  position: relative;
}

.input-icon-wrapper .form-control {
  padding-left: 42px;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px; height: 16px;
  pointer-events: none;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
}

/* ─────────────────────────────────────────────────────────────
   Buttons
───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-5);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all var(--t-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #818cf8);
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hover), #a5b4fc);
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-active); }

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-warning {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}
.btn-warning:hover { background: var(--warning); color: white; }

.btn-info {
  background: var(--info-dim);
  color: var(--info);
  border: 1px solid rgba(59,130,246,0.3);
}
.btn-info:hover { background: var(--info); color: white; }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 14px var(--sp-6); font-size: 15px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 15px; height: 15px; }

/* ─────────────────────────────────────────────────────────────
   Cards
───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  transition: border-color var(--t-fast);
}

.card:hover { border-color: rgba(255,255,255,0.1); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  transition: all var(--t-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t-normal);
}

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

.stat-card.purple::before { background: linear-gradient(135deg, rgba(168,85,247,0.05), transparent); }
.stat-card.green::before  { background: linear-gradient(135deg, rgba(16,185,129,0.05), transparent); }
.stat-card.red::before    { background: linear-gradient(135deg, rgba(239,68,68,0.05), transparent); }
.stat-card.amber::before  { background: linear-gradient(135deg, rgba(245,158,11,0.05), transparent); }
.stat-card.blue::before   { background: linear-gradient(135deg, rgba(59,130,246,0.05), transparent); }
.stat-card.indigo::before { background: linear-gradient(135deg, rgba(99,102,241,0.05), transparent); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.purple { background: var(--purple-dim); color: var(--purple); }
.stat-icon.green  { background: var(--success-dim); color: var(--success); }
.stat-icon.red    { background: var(--danger-dim); color: var(--danger); }
.stat-icon.amber  { background: var(--warning-dim); color: var(--warning); }
.stat-icon.blue   { background: var(--info-dim); color: var(--info); }
.stat-icon.indigo { background: var(--accent-dim); color: var(--accent-hover); }

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

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--sp-1);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

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

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color var(--t-fast);
}

.data-table th:hover { color: var(--text-secondary); }
.data-table th.sorted { color: var(--accent-hover); }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}

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

.data-table td {
  padding: 14px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* Table Controls */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}

.table-filters {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  flex: 1;
}

.search-box {
  position: relative;
  min-width: 240px;
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px; height: 15px;
  pointer-events: none;
}

.search-box input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 9px 14px 9px 36px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: all var(--t-fast);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-box input::placeholder { color: var(--text-muted); }

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 9px 36px 9px 14px;
  font-size: 13px;
  outline: none;
  transition: all var(--t-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
}

.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* ─────────────────────────────────────────────────────────────
   Badges / Status Pills
───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}

.badge-present   { background: var(--success-dim); color: var(--success); }
.badge-present::before { background: var(--success); }

.badge-late      { background: var(--warning-dim); color: var(--warning); }
.badge-late::before { background: var(--warning); }

.badge-absent    { background: var(--danger-dim); color: var(--danger); }
.badge-absent::before { background: var(--danger); }

.badge-halfday   { background: var(--info-dim); color: var(--info); }
.badge-halfday::before { background: var(--info); }

.badge-missing   { background: var(--purple-dim); color: var(--purple); }
.badge-missing::before { background: var(--purple); }

.badge-active    { background: var(--success-dim); color: var(--success); }
.badge-active::before { background: var(--success); }

.badge-inactive  { background: var(--danger-dim); color: var(--danger); }
.badge-inactive::before { background: var(--danger); }

.badge-connected { background: var(--success-dim); color: var(--success); }
.badge-connected::before { background: var(--success); animation: blink 1.5s infinite; }

.badge-disconnected { background: var(--bg-elevated); color: var(--text-muted); }
.badge-disconnected::before { background: var(--text-muted); }

.badge-error     { background: var(--danger-dim); color: var(--danger); }
.badge-error::before { background: var(--danger); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─────────────────────────────────────────────────────────────
   Pagination
───────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-4);
}

.pagination-info { font-size: 12px; color: var(--text-muted); }

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.page-btn {
  width: 32px; height: 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}

.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────
   Modals
───────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(16px);
  transition: transform var(--t-normal);
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.modal-close:hover { color: var(--danger); border-color: rgba(239,68,68,0.3); background: var(--danger-dim); }

.modal-body {
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

/* ─────────────────────────────────────────────────────────────
   Toast Notifications
───────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--sp-6);
  right: var(--sp-6);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: toastIn 0.35s ease, toastOut 0.35s ease var(--duration, 3s) forwards;
  max-width: 360px;
  min-width: 280px;
}

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

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

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    { border-color: var(--info); }
.toast.info    .toast-icon { color: var(--info); }

/* ─────────────────────────────────────────────────────────────
   Device Page Specific
───────────────────────────────────────────────────────────── */
.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-6);
}

.device-status-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.device-status-indicator {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--bg-card);
  border-radius: var(--r-md);
}

.pulse-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  position: relative;
}

.pulse-dot.connected {
  background: var(--success);
}

.pulse-dot.connected::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.3;
  animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

.device-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* ─────────────────────────────────────────────────────────────
   Reports Page Specific
───────────────────────────────────────────────────────────── */
.report-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.report-type-btn {
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-normal);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
}

.report-type-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.report-type-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 16px var(--accent-glow);
}

.report-type-btn .icon {
  font-size: 24px;
  margin-bottom: var(--sp-1);
}

.report-type-btn .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.report-type-btn.active .label { color: var(--accent-hover); }

.export-btn-group {
  display: flex;
  gap: var(--sp-2);
}

/* ─────────────────────────────────────────────────────────────
   Employee Profile / Detail View
───────────────────────────────────────────────────────────── */
.employee-profile-header {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-6);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.employee-avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 24px var(--accent-glow);
}

.employee-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.detail-value { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* ─────────────────────────────────────────────────────────────
   Loading Skeleton
───────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
  display: block;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─────────────────────────────────────────────────────────────
   Utilities
───────────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: var(--sp-2); }
.gap-3       { gap: var(--sp-3); }
.gap-4       { gap: var(--sp-4); }
.gap-6       { gap: var(--sp-6); }
.mt-1        { margin-top: var(--sp-1); }
.mt-2        { margin-top: var(--sp-2); }
.mt-4        { margin-top: var(--sp-4); }
.mb-4        { margin-bottom: var(--sp-4); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-muted  { color: var(--text-muted); }
.font-bold   { font-weight: 700; }
.text-center { text-align: center; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }

/* Two-column form grid */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-4) 0;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10);
  color: var(--text-muted);
  gap: var(--sp-3);
  text-align: center;
}

.empty-state .empty-icon { font-size: 48px; opacity: 0.4; }
.empty-state .empty-text { font-size: 14px; font-weight: 500; }
.empty-state .empty-sub  { font-size: 12px; }

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Info Row */
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }
.info-row .info-key { color: var(--text-muted); }
.info-row .info-val { color: var(--text-primary); font-weight: 500; }

/* ─────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .device-grid { grid-template-columns: 1fr; }
  .report-type-grid { grid-template-columns: repeat(2, 1fr); }
  .employee-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    --sidebar-w: 260px;
  }

  .main-content { margin-left: 0; }
  .topbar { padding: 0 var(--sp-4); }
  .page-body { padding: var(--sp-4); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .device-action-grid { grid-template-columns: 1fr; }
  .modal { max-width: 95%; }
}
