:root {
  --bg-dark: #070b14;
  --surface: #0f172a;
  --surface-border: rgba(255, 255, 255, 0.08);
  --surface-hover: rgba(30, 41, 59, 0.7);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-glow: rgba(59, 130, 246, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(16, 185, 129, 0.05) 0%, transparent 40%),
    linear-gradient(to bottom, #070b14, #0a0f1d);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title span {
  background: linear-gradient(135deg, #60a5fa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  gap: 6px;
  background: rgba(10, 15, 29, 0.6);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  color: #fff;
  background: var(--accent-blue);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 12px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #34d399;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* APP CONTAINER */
.app-container {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  flex: 1;
}

/* STATS ROW */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon.emp { background: rgba(59, 130, 246, 0.15); }
.stat-icon.scan { background: rgba(6, 182, 212, 0.15); }
.stat-icon.grant { background: rgba(16, 185, 129, 0.15); }
.stat-icon.deny { background: rgba(245, 158, 11, 0.15); }

.stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* TAB PANES */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* SCANNER LAYOUT */
.scanner-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .scanner-layout { grid-template-columns: 1fr; }
}

.camera-card, .sidebar-card, .table-card, .setting-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  overflow: hidden;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--surface-border);
  background: rgba(10, 15, 29, 0.4);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  display: inline-block;
}

/* VIDEO CONTAINER */
.video-container {
  position: relative;
  width: 100%;
  background: #020408;
  aspect-ratio: 16/9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

.cam-placeholder {
  position: absolute;
  inset: 0;
  background: #060a14;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  z-index: 10;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.cam-placeholder h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.cam-placeholder p {
  color: var(--text-muted);
  max-width: 380px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* HUD Overlay */
.scanner-hud {
  position: absolute;
  inset: 20px;
  pointer-events: none;
  border: 1px dashed rgba(59, 130, 246, 0.2);
  border-radius: 12px;
}

.hud-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 2px solid var(--accent-cyan);
}

.hud-corner.top-left { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.hud-corner.top-right { top: -2px; right: -2px; border-left: none; border-bottom: none; }
.hud-corner.bottom-left { bottom: -2px; left: -2px; border-right: none; border-top: none; }
.hud-corner.bottom-right { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.hud-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  box-shadow: 0 0 10px var(--accent-cyan);
  animation: scanmove 3s ease-in-out infinite alternate;
}

@keyframes scanmove {
  0% { top: 5%; opacity: 0.4; }
  100% { top: 95%; opacity: 0.9; }
}

/* RECOGNITION BANNER */
.access-banner {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  border: 2px solid var(--success);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 20;
  transform: translateY(120%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.access-banner.show {
  transform: translateY(0);
  opacity: 1;
}

.access-banner.denied {
  border-color: var(--danger);
}

.banner-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  overflow: hidden;
}

.banner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-info { flex: 1; }

.banner-status {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #34d399;
}

.access-banner.denied .banner-status {
  color: #f87171;
}

.banner-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1px 0;
}

.banner-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.banner-badge {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.access-banner.denied .banner-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* CAMERA FOOTER */
.camera-footer {
  padding: 0.9rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--surface-border);
  background: rgba(10, 15, 29, 0.4);
}

.hud-telemetry {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hud-telemetry b {
  color: var(--text-main);
}

/* BOSS DASHBOARD STYLING */
.boss-lock-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.lock-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 480px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.workstation-radar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.radar-card {
  background: var(--surface);
  border: 2px solid var(--surface-border);
  border-radius: 16px;
  padding: 1.25rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.radar-card.status-present {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
}

.radar-card.status-away {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.radar-card.status-offline {
  border-color: var(--surface-border);
  opacity: 0.75;
}

.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.radar-emp-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.radar-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.radar-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.radar-badge.present { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.radar-badge.away { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.radar-badge.offline { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }

.radar-metrics {
  background: rgba(10, 15, 29, 0.6);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radar-metric-row {
  display: flex;
  justify-content: space-between;
}

/* SIDEBAR FEED */
.live-feed-list {
  padding: 1rem;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

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

.feed-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #1e293b;
  object-fit: cover;
}

.feed-details { flex: 1; }
.feed-name { font-weight: 600; font-size: 0.88rem; }
.feed-meta { font-size: 0.75rem; color: var(--text-muted); }

.feed-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.feed-badge.granted { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.feed-badge.denied { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.feed-badge.unknown { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* BUTTONS */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.live-tag {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* DATA TABLE */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: rgba(10, 15, 29, 0.6);
  padding: 12px 16px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--surface-border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--surface-border);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-snapshot {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
}

/* EMPLOYEE DIRECTORY */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.emp-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.emp-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.emp-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.emp-avatar {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(59, 130, 246, 0.3);
}

.emp-name { font-weight: 700; font-size: 1.05rem; }
.emp-role { font-size: 0.8rem; color: var(--text-muted); }

.emp-details {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}

.emp-detail-row { display: flex; justify-content: space-between; }
.emp-detail-lbl { color: var(--text-muted); }
.emp-detail-val { font-weight: 600; }

.emp-actions { display: flex; justify-content: flex-end; margin-top: auto; }
.btn-delete-emp {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-delete-emp:hover { background: rgba(239, 68, 68, 0.15); }

/* SETTINGS */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.setting-card { padding: 1.5rem; }
.setting-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.setting-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.25rem; }

.slider-control input[type=range] { width: 100%; accent-color: var(--accent-blue); }
.slider-labels { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.highlight-val { color: #38bdf8; font-weight: 700; }

/* FORM CONTROLS */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-input, .form-select {
  width: 100%;
  background: rgba(10, 15, 29, 0.8);
  border: 1px solid var(--surface-border);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 0.9rem;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.modal-backdrop.show { display: flex; animation: fadeIn 0.2s ease; }
.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--surface-border); }
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; background: rgba(10, 15, 29, 0.4); }

.photo-enrollment-box {
  border: 2px dashed var(--surface-border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.photo-preview {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-options { display: flex; flex-direction: column; gap: 8px; }

/* TOGGLE */
.toggle-switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: relative; width: 44px; height: 24px; background-color: #334155; transition: .3s; border-radius: 24px; }
.toggle-switch .slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
.toggle-switch input:checked + .slider { background-color: var(--accent-blue); }
.toggle-switch input:checked + .slider:before { transform: translateX(20px); }
