/* ==============================================================================
 * 007 PRO - QR Code Staff Attendance System
 * Modern Glassmorphism & High-End Dark UI Design System
 * ============================================================================== */

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

:root {
  /* Color Palette - Cyber Dark / Emerald Accent */
  --bg-main: #0a0e17;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-solid: #121826;
  --bg-sidebar: #0f1422;
  --bg-input: #1a2234;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #10b981;
  --border-glow: rgba(16, 185, 129, 0.35);

  /* Primary & Accents */
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: rgba(16, 185, 129, 0.15);
  --primary-glow: rgba(16, 185, 129, 0.4);

  --accent-blue: #3b82f6;
  --accent-blue-light: rgba(59, 130, 246, 0.15);
  --accent-purple: #8b5cf6;
  --accent-purple-light: rgba(139, 92, 246, 0.15);
  --accent-amber: #f59e0b;
  --accent-amber-light: rgba(245, 158, 11, 0.15);
  --accent-rose: #ef4444;
  --accent-rose-light: rgba(239, 68, 68, 0.15);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-family: 'Kantumruy Pro', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Shadows & Blurs */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.25);
  --backdrop-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.05);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  background: 
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
    var(--bg-main);
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  z-index: 50;
  transition: var(--transition);
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
  color: white;
  font-size: 22px;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Nav Links */
.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--primary-light);
  border-color: rgba(16, 185, 129, 0.2);
  transform: translateX(4px);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.15) 100%);
  border-color: rgba(16, 185, 129, 0.4);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.nav-item .icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cloud-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.status-dot.offline {
  background: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
}

.cloud-info {
  flex: 1;
}

.cloud-info .title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.cloud-info .subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* Top App Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 20, 34, 0.7);
  backdrop-filter: var(--backdrop-blur);
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  cursor: pointer;
}

.page-title h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.page-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.live-clock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 175px;
  flex-shrink: 0;
  user-select: none;
}

.clock-icon {
  color: var(--primary);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.clock-details {
  text-align: right;
  min-width: 110px;
}

.clock-time {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
}

.clock-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.2;
}

/* Views Container */
.content-area {
  padding: 28px 32px;
  flex: 1;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-view.active {
  display: block;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 600;
}

.card-title .icon {
  color: var(--primary);
  font-size: 1.3rem;
}

/* ==============================================================================
 * QR Scanner Specific Components
 * ============================================================================== */
.scanner-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.scanner-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 22px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.scanner-mode-switch {
  display: flex;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-full);
  margin-bottom: 18px;
  width: 100%;
  max-width: 440px;
}

.mode-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mode-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

/* Camera Viewport */
.camera-wrapper {
  width: 100%;
  max-width: 460px;
  height: 380px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: #000000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(16, 185, 129, 0.35);
  margin: 0 auto 14px auto;
}

#reader {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
}

#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 16px;
}

/* Animated Scanner Reticle */
.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 230px;
  height: 230px;
  pointer-events: none;
  z-index: 10;
}

.reticle-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  border-color: #10b981;
  border-style: solid;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.8));
}

.reticle-corner.top-left { top: 0; left: 0; border-width: 3.5px 0 0 3.5px; border-radius: 8px 0 0 0; }
.reticle-corner.top-right { top: 0; right: 0; border-width: 3.5px 3.5px 0 0; border-radius: 0 8px 0 0; }
.reticle-corner.bottom-left { bottom: 0; left: 0; border-width: 0 0 3.5px 3.5px; border-radius: 0 0 0 8px; }
.reticle-corner.bottom-right { bottom: 0; right: 0; border-width: 0 3.5px 3.5px 0; border-radius: 0 0 8px 0; }

.laser-bar {
  position: absolute;
  top: 0;
  left: 5%;
  width: 90%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #34d399, #38bdf8, transparent);
  box-shadow: 0 0 15px #34d399, 0 0 30px #38bdf8;
  animation: scanLaser 2.2s ease-in-out infinite alternate;
}

/* Scanner Action Panel */
.scanner-actions {
  display: flex;
  gap: 10px;
  margin: 0 auto;
  width: 100%;
  max-width: 460px;
}

.action-type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.btn-action-type {
  position: relative;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.7);
  color: #94a3b8;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.75;
  transform: scale(0.98);
  user-select: none;
}

.btn-action-type:hover {
  opacity: 0.95;
  transform: translateY(-2px) scale(0.99);
}

.action-btn-main {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.action-btn-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.action-btn-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.action-btn-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.action-btn-sub {
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0.85;
}

.action-selected-pill {
  display: none;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* =========================================================================
   CHECK-IN ACTIVE STATE (SOLID GLOWING EMERALD GREEN)
   ========================================================================= */
.btn-action-type.check-in.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border-color: #34d399 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  transform: scale(1.03) !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

.btn-action-type.check-in.active .action-selected-pill {
  display: inline-block;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* =========================================================================
   CHECK-OUT ACTIVE STATE (SOLID GLOWING RUBY RED)
   ========================================================================= */
.btn-action-type.check-out.active {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  transform: scale(1.03) !important;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.55), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

.btn-action-type.check-out.active .action-selected-pill {
  display: inline-block;
  background: rgba(0, 0, 0, 0.25);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* =========================================================================
   LIVE SCAN MODE INDICATOR BANNER
   ========================================================================= */
.scan-mode-indicator-banner {
  padding: 8px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.scan-mode-indicator-banner.check-in-mode {
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.scan-mode-indicator-banner.check-out-mode {
  background: rgba(239, 68, 68, 0.15);
  border: 1.5px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.mode-badge-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mode-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.check-in-mode .mode-pulse-dot {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseGreen 1.5s infinite;
}

.check-out-mode .mode-pulse-dot {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: pulseRed 1.5s infinite;
}

@keyframes pulseGreen {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

@keyframes pulseRed {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.camera-wrapper.mode-checkin {
  border-color: #10b981 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.35), inset 0 0 20px rgba(0, 0, 0, 0.8) !important;
}

.camera-wrapper.mode-checkout {
  border-color: #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.35), inset 0 0 20px rgba(0, 0, 0, 0.8) !important;
}

/* Result Modal & Popup Card */
.result-display-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scanned-user-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.user-avatar-badge {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-md);
}

.scanned-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.scanned-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.scanned-id-pill {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  font-family: monospace;
}

.scan-status-banner {
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.scan-status-banner.success {
  background: var(--primary-light);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.scan-status-banner.warning {
  background: var(--accent-amber-light);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==============================================================================
 * Stats & Dashboard Widgets
 * ============================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon-wrapper.emerald { background: var(--primary-light); color: #34d399; }
.stat-icon-wrapper.blue { background: var(--accent-blue-light); color: #60a5fa; }
.stat-icon-wrapper.amber { background: var(--accent-amber-light); color: #fbbf24; }
.stat-icon-wrapper.rose { background: var(--accent-rose-light); color: #f87171; }

.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
}

.stat-info .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==============================================================================
 * Modern Data Tables
 * ============================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

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

.custom-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-in { background: var(--primary-light); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-out { background: var(--accent-rose-light); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-ontime { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-late { background: var(--accent-amber-light); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-leave { background: rgba(230, 126, 34, 0.2); color: #f39c12; border: 1px solid rgba(243, 156, 18, 0.4); }
.badge-unauthorized { background: rgba(153, 45, 34, 0.25); color: #ff6b6b; border: 1px solid rgba(153, 45, 34, 0.6); }
.badge-dayoff { background: rgba(52, 152, 219, 0.22); color: #60a5fa; border: 1px solid rgba(52, 152, 219, 0.5); }
.badge-extraday { background: rgba(39, 174, 96, 0.22); color: #4ade80; border: 1px solid rgba(39, 174, 96, 0.5); }

/* Table Row Highlights Matching Python v1.9 */
.custom-table tbody tr.row-unauthorized {
  background: rgba(153, 45, 34, 0.15);
  border-left: 3px solid #992d22;
}
.custom-table tbody tr.row-unauthorized:hover {
  background: rgba(153, 45, 34, 0.25);
}

.custom-table tbody tr.row-dayoff {
  background: rgba(52, 152, 219, 0.12);
  border-left: 3px solid #3498db;
}
.custom-table tbody tr.row-dayoff:hover {
  background: rgba(52, 152, 219, 0.2);
}

.custom-table tbody tr.row-extraday {
  background: rgba(39, 174, 96, 0.12);
  border-left: 3px solid #27ae60;
}
.custom-table tbody tr.row-extraday:hover {
  background: rgba(39, 174, 96, 0.2);
}

.custom-table tbody tr.row-leave {
  background: rgba(230, 126, 34, 0.12);
  border-left: 3px solid #e67e22;
}
.custom-table tbody tr.row-leave:hover {
  background: rgba(230, 126, 34, 0.2);
}

/* ==============================================================================
 * UI ដូចកម្មវិធី v.1.9 007 PRO - Time-Based Payroll System
 * ============================================================================== */
.v19-layout-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 1080px) {
  .v19-layout-container {
    grid-template-columns: 1fr;
  }
}

/* Left Sidebar: Input Panel (320px) ដូច sidebar ក្នុង v1.9 */
.v19-left-sidebar {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 85px;
}

.v19-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.v19-panel-title .icon {
  color: var(--primary);
  font-size: 1.25rem;
}

.btn-v19-add {
  width: 100%;
  padding: 12px 16px;
  background: #27ae60 !important;
  color: #ffffff !important;
  border: 1px solid #1e8449 !important;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.35);
  transition: var(--transition);
  margin-top: 4px;
}

.btn-v19-add:hover {
  background: #2ecc71 !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(39, 174, 96, 0.5);
}

.v19-action-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.btn-v19-unauthorized {
  width: 100%;
  padding: 10px 14px;
  background: #992d22 !important;
  border: 1px solid #7c241c !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(153, 45, 34, 0.3);
}
.btn-v19-unauthorized:hover {
  background: #b03a2e !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(153, 45, 34, 0.5);
}

.btn-v19-leave {
  width: 100%;
  padding: 10px 14px;
  background: #e67e22 !important;
  border: 1px solid #d35400 !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(230, 126, 34, 0.3);
}
.btn-v19-leave:hover {
  background: #f39c12 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(230, 126, 34, 0.5);
}

.btn-v19-extraday {
  width: 100%;
  padding: 10px 14px;
  background: #27ae60 !important;
  border: 1px solid #1e8449 !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}
.btn-v19-extraday:hover {
  background: #2ecc71 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(39, 174, 96, 0.5);
}

.btn-v19-dayoff {
  width: 100%;
  padding: 10px 14px;
  background: #3498db !important;
  border: 1px solid #2980b9 !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}
.btn-v19-dayoff:hover {
  background: #2980b9 !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(52, 152, 219, 0.5);
}

.v19-sidebar-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  line-height: 1.5;
}

/* Right Main Area ដូច main_area ក្នុង v1.9 */
.v19-main-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 1. Summary Card ដូច sum_card ក្នុង v1.9 */
.v19-summary-card {
  background: var(--bg-card);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.v19-sum-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: #bbbbbb;
}

.v19-sum-item .sum-val {
  font-weight: 700;
  color: var(--text-main);
}

.v19-sum-item .text-amber { color: #fbbf24 !important; }
.v19-sum-item .text-rose { color: #f87171 !important; }
.v19-sum-item .text-blue { color: #60a5fa !important; }
.v19-sum-item .text-orange { color: #fb923c !important; }
.v19-sum-item .text-gold { color: #f1c40f !important; font-size: 1.05rem; }

.v19-sum-item.total-pay-highlight {
  background: rgba(241, 196, 15, 0.1);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(241, 196, 15, 0.3);
}

/* 2. Filter Bar ដូច filter_layout ក្នុង v1.9 */
.v19-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.v19-filter-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.v19-filter-controls .filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v19-filter-controls .filter-group label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-input-sm {
  padding: 8px 12px;
  font-size: 0.84rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  min-width: 120px;
}

.filter-input-sm:focus {
  border-color: var(--primary);
}

.v19-filter-actions,
.v19-filter-actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.v19-filter-actions-inline .btn {
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 3. Table Widget (10 Columns ដូចក្នុង Python v1.9) */
.v19-table-wrapper {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #000000;
  box-shadow: var(--shadow-md);
}

.v19-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #000000;
}

.v19-table th {
  background: #1a1a1a;
  color: #dddddd;
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid #333333;
  white-space: nowrap;
  text-align: left;
}

.v19-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #222222;
  color: #ffffff;
  vertical-align: middle;
}

.v19-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.v19-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Specific Row Color Highlighting matching Python v1.9 */
.v19-table tbody tr.row-unauthorized td {
  background-color: #992d22 !important;
  color: #ffffff !important;
  font-weight: 600;
}
.v19-table tbody tr.row-unauthorized td * {
  color: #ffffff !important;
}

.v19-table tbody tr.row-leave td {
  background-color: #f39c12 !important;
  color: #000000 !important;
  font-weight: 700;
}
.v19-table tbody tr.row-leave td * {
  color: #000000 !important;
}

.v19-table tbody tr.row-extraday td {
  background-color: #27ae60 !important;
  color: #ffffff !important;
  font-weight: 600;
}
.v19-table tbody tr.row-extraday td * {
  color: #ffffff !important;
}

.v19-table tbody tr.row-dayoff td {
  background-color: #3498db !important;
  color: #ffffff !important;
  font-weight: 600;
}
.v19-table tbody tr.row-dayoff td * {
  color: #ffffff !important;
}

.v19-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  background: #1c1c1c;
  color: #d1d5db;
  border: 1px solid #383838;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
}

.pagination-btn:hover:not(:disabled) {
  background: #2a2a2a;
  color: #ffffff;
  border-color: #666666;
}

.pagination-btn.active {
  background: var(--primary, #3b82f6) !important;
  color: #ffffff !important;
  border-color: var(--primary, #3b82f6) !important;
}

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

.pagination-ellipsis {
  color: #6b7280;
  font-size: 0.8rem;
  padding: 0 4px;
}

/* Action Dropdown inside table */
.log-action-select {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #1a1a1a;
  border: 1px solid #444444;
  color: #ffffff;
  font-size: 0.76rem;
  outline: none;
  cursor: pointer;
}


/* Form Elements */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

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

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: var(--accent-rose);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

/* ==============================================================================
 * QR Generator & Printable Badges
 * ============================================================================== */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.staff-card-item {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s ease !important;
}

.staff-card-item:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 92, 246, 0.4) !important;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.2) !important;
}

.staff-id-badge {
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  border: 1px solid #e2e8f0;
}

.badge-company-header {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.badge-qr-container {
  padding: 10px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 14px;
}

.badge-staff-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.badge-staff-pos {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 6px;
}

.badge-staff-id-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #059669;
  background: #ecfdf5;
  padding: 2px 10px;
  border-radius: 4px;
}

.staff-id-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-card-actions .btn {
  border-radius: 8px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.badge-card-actions .btn-download-badge {
  background: #6366f1 !important;
  color: #ffffff !important;
  border: 1px solid #4f46e5 !important;
}

.badge-card-actions .btn-download-badge:hover {
  background: #4f46e5 !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45) !important;
  transform: translateY(-1px);
}

.badge-card-actions .btn-test-scan {
  background: #10b981 !important;
  color: #ffffff !important;
  border: 1px solid #059669 !important;
}

.badge-card-actions .btn-test-scan:hover {
  background: #059669 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45) !important;
  transform: translateY(-1px);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideInRight 0.3s ease;
}

.toast.error {
  border-left-color: var(--accent-rose);
}

.toast.warning {
  border-left-color: var(--accent-amber);
}

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

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

@keyframes scanLaser {
  0% { top: 0%; opacity: 0.8; }
  50% { opacity: 1; }
  100% { top: 96%; opacity: 0.8; }
}

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

/* ==============================================================================
 * 7. SETTINGS & GOOGLE SHEETS / GPS GEOFENCING STYLES
 * ============================================================================== */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1050px;
  margin: 0 auto;
  width: 100%;
}

.settings-card {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.settings-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.settings-card .card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

.settings-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-emerald:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Custom Toggle Switch for GPS */
.custom-toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.custom-toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  position: relative;
  transition: all 0.25s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-toggle-switch input:checked + .toggle-slider {
  background: #10b981;
  border-color: #10b981;
}

.custom-toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

/* GPS Inputs & Actions Grid */
.gps-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0 20px;
}

.gps-inputs-grid .form-group {
  margin-bottom: 0;
}

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

.input-unit-wrapper input {
  padding-right: 55px;
}

.input-unit-tag {
  position: absolute;
  right: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  pointer-events: none;
  font-weight: 500;
}

.gps-actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn-detect-gps {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.35) !important;
  color: #93c5fd !important;
}

.btn-detect-gps:hover {
  background: rgba(59, 130, 246, 0.22) !important;
}

.gps-actions-grid .btn-save-gps {
  margin-left: auto;
}

/* Tutorial Steps Grid */
.tutorial-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.tutorial-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition);
}

.tutorial-step-item:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.tutorial-step-item.full-width {
  grid-column: 1 / -1;
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.3);
}

.step-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-badge.highlight {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.step-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.step-text strong {
  color: var(--text-main);
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .sidebar, .top-bar, .scanner-box, .btn, .nav-menu, .badge-card-actions {
    display: none !important;
  }
  .main-wrapper {
    height: auto !important;
    overflow: visible !important;
  }
  .badges-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
  }
  .staff-id-badge {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid !important;
  }
}

/* ==============================================================================
 * Staff Portal Mode (?mode=scan, ?mode=leave, /scan, /leave)
 * ============================================================================== */
/* ==============================================================================
 * Staff Portal Mode (?mode=scan, ?mode=leave, /scan, /leave)
 * ============================================================================== */
body.mode-staff-portal .sidebar,
body.mode-scan-only .sidebar,
body.mode-leave-only .sidebar {
  display: none !important;
}

body.mode-staff-portal .mobile-bottom-nav,
body.mode-scan-only .mobile-bottom-nav,
body.mode-leave-only .mobile-bottom-nav {
  display: none !important;
}

body.mode-staff-portal .main-wrapper,
body.mode-scan-only .main-wrapper,
body.mode-leave-only .main-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  background: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 60%), #0b0f19;
}

body.mode-staff-portal #btn-sync-python,
body.mode-staff-portal #btn-share-links,
body.mode-staff-portal #top-bar-auth-badge,
body.mode-scan-only #btn-sync-python,
body.mode-scan-only #btn-share-links,
body.mode-scan-only #top-bar-auth-badge,
body.mode-leave-only #btn-sync-python,
body.mode-leave-only #btn-share-links,
body.mode-leave-only #top-bar-auth-badge,
body.mode-leave-only .btn-leave-share-link {
  display: none !important;
}

/* ==============================================================================
 * Clean & Beautiful Header for Staff Scan Portal Mode (?mode=staff)
 * ============================================================================== */
body.mode-staff-portal .top-bar {
  padding: 10px 20px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: rgba(11, 15, 25, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.mode-staff-portal .top-bar-left .page-title h2 {
  display: none !important;
}

body.mode-staff-portal .top-bar-left .page-title {
  display: flex !important;
  align-items: center !important;
}

body.mode-staff-portal #live-date {
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
}

body.mode-staff-portal .live-clock-card {
  padding: 6px 14px !important;
  border-radius: 12px !important;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

body.mode-staff-portal .clock-time {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #34d399 !important;
}

body.mode-staff-portal .clock-date {
  font-size: 0.72rem !important;
  color: #64748b !important;
}

/* ==============================================================================
 * Ultra-Compact & Cohesive Staff Scan Portal Mode (?mode=staff)
 * ============================================================================== */
body.mode-staff-portal .content-area,
body.mode-scan-only .content-area {
  padding: 10px 14px 24px 14px !important;
  max-width: 540px !important;
  margin: 0 auto !important;
}

body.mode-staff-portal .scanner-grid,
body.mode-scan-only .scanner-grid {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  max-width: 520px !important;
  margin: 0 auto !important;
  width: 100% !important;
}

body.mode-staff-portal .scanner-box,
body.mode-scan-only .scanner-box {
  padding: 12px 14px !important;
  border-radius: 16px !important;
}

body.mode-staff-portal #staff-account-card {
  padding: 8px 12px !important;
  margin-bottom: 8px !important;
  border-radius: 10px !important;
}

body.mode-staff-portal #staff-account-card label {
  margin-bottom: 3px !important;
  font-size: 0.8rem !important;
}

body.mode-staff-portal #staff-account-select {
  padding: 4px 10px !important;
  font-size: 0.85rem !important;
  height: 36px !important;
}

body.mode-staff-portal .scanner-box h3 {
  font-size: 0.98rem !important;
  margin-bottom: 2px !important;
}

body.mode-staff-portal #scanner-instruction {
  font-size: 0.76rem !important;
  line-height: 1.2 !important;
}

body.mode-staff-portal .action-type-selector {
  gap: 12px !important;
  margin-bottom: 12px !important;
  width: 100% !important;
  max-width: 460px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.mode-staff-portal .btn-action-type {
  border-radius: 14px !important;
}

body.mode-staff-portal .camera-wrapper,
body.mode-scan-only .camera-wrapper {
  max-width: 460px !important;
  width: 100% !important;
  height: 380px !important;
  max-height: 380px !important;
  border-radius: 18px !important;
  margin: 0 auto 14px auto !important;
}

body.mode-staff-portal .scanner-actions {
  gap: 10px !important;
  margin-bottom: 4px !important;
  width: 100% !important;
  max-width: 460px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

body.mode-staff-portal .scanner-actions .btn {
  padding: 9px 14px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
}

body.mode-staff-portal .result-display-card,
body.mode-scan-only .result-display-card {
  gap: 8px !important;
  margin-top: 0 !important;
}

body.mode-staff-portal .result-display-card .glass-card {
  padding: 10px 12px !important;
  border-radius: 14px !important;
}

body.mode-staff-portal .result-display-card .card-header {
  margin-bottom: 6px !important;
  padding-bottom: 4px !important;
}

body.mode-staff-portal #scanner-today-summary-title {
  font-size: 0.92rem !important;
  font-weight: 700 !important;
}

body.mode-staff-portal .stats-grid,
body.mode-scan-only .stats-grid,
#scanner-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
  margin-bottom: 12px !important;
  width: 100% !important;
}

body.mode-staff-portal .stat-card,
body.mode-scan-only .stat-card,
#scanner-stats-grid .stat-card {
  padding: 10px 12px !important;
  border-radius: 12px !important;
  gap: 8px !important;
  min-height: auto !important;
  background: rgba(15, 23, 42, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  align-items: center !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}

body.mode-staff-portal .stat-icon-wrapper,
body.mode-scan-only .stat-icon-wrapper,
#scanner-stats-grid .stat-icon-wrapper {
  width: 36px !important;
  height: 36px !important;
  font-size: 1.1rem !important;
  border-radius: 10px !important;
  flex-shrink: 0 !important;
}

body.mode-staff-portal .stat-info,
body.mode-scan-only .stat-info,
#scanner-stats-grid .stat-info {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

body.mode-staff-portal .stat-value,
body.mode-scan-only .stat-value,
#scanner-stats-grid .stat-value {
  font-size: clamp(0.85rem, 2.8vw, 1.05rem) !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.mode-staff-portal .stat-label,
body.mode-scan-only .stat-label,
#scanner-stats-grid .stat-label {
  font-size: 0.72rem !important;
  color: #94a3b8 !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  margin-top: 2px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.mode-staff-portal #scanner-quick-tips,
body.mode-scan-only #scanner-quick-tips {
  display: none !important;
}

body.mode-staff-portal #staff-portal-nav,
body.mode-scan-only #staff-portal-nav,
body.mode-leave-only #staff-portal-nav {
  display: flex !important;
}

body.mode-staff-portal #admin-leave-history-section,
body.mode-leave-only #admin-leave-history-section {
  display: none !important;
}

body.mode-staff-portal #view-leave .glass-card,
body.mode-leave-only #view-leave .glass-card {
  max-width: 650px;
  margin: 10px auto 30px auto;
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.15);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.btn-back-to-scanner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back-to-scanner:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.6);
  transform: translateY(-1px);
}

/* Staff Portal Floating Pill Navigation Bar */
.staff-portal-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 8px;
  margin: 0 auto 20px auto;
  max-width: 520px;
  border-radius: 100px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.staff-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.btn-staff-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-staff-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.btn-staff-tab.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-staff-tab.leave-tab.active {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.btn-staff-admin-unlock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-staff-admin-unlock:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ==============================================================================
 * Staff Account Profile & Quick Attendance VIP Card
 * ============================================================================== */
.staff-account-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(16, 185, 129, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.staff-account-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #10b981, #38bdf8, transparent);
}

.staff-account-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.staff-account-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 220px;
}

.staff-account-avatar {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 6px 18px rgba(16, 185, 129, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.staff-account-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.staff-account-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #34d399;
}

.badge-saved-tag {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.staff-account-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.staff-account-meta {
  font-size: 0.82rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.staff-account-picker {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
}

.staff-select-dropdown {
  background: rgba(11, 15, 25, 0.95) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: #f1f5f9 !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  padding: 9px 12px !important;
  border-radius: 10px !important;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.staff-select-dropdown:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
  outline: none;
}

.staff-account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-staff-quick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.btn-staff-quick.in {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-staff-quick.in:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-staff-quick.in:active {
  transform: translateY(0);
}

.btn-staff-quick.out {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
}

.btn-staff-quick.out:hover {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 63, 94, 0.45);
}

.btn-staff-quick.out:active {
  transform: translateY(0);
}

/* Hide Quick tips specifically in Staff Portal mode while keeping for Admin */
body.mode-staff-portal #scanner-quick-tips,
body.mode-scan-only #scanner-quick-tips,
body.mode-leave-only #scanner-quick-tips {
  display: none !important;
}

/* ==========================================================================
   Bulk Multi-Select Actions Bar for Logs Table
   ========================================================================== */
.v19-bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(59, 130, 246, 0.25);
  animation: fadeInDown 0.25s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bulk-selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-badge {
  font-size: 0.88rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.bulk-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-bulk-action {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-bulk-action:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-bulk-delete {
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 8px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid #f87171;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  transition: all 0.15s ease;
}

.btn-bulk-delete:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
}

.btn-bulk-cancel {
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 8px;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-bulk-cancel:hover {
  color: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.6);
}

/* Row checkbox styling */
.log-row-checkbox, #select-all-logs-checkbox {
  width: 17px;
  height: 17px;
  accent-color: #10b981;
  cursor: pointer;
  vertical-align: middle;
}

.custom-table tr.row-selected {
  background: rgba(59, 130, 246, 0.16) !important;
  border-left: 3px solid #3b82f6 !important;
}

.custom-table tr.row-selected td {
  background: rgba(59, 130, 246, 0.12) !important;
}

