/* Local Lato Fonts for 100% Offline PWA */
@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/lato-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../vendor/fonts/lato-700.woff2') format('woff2');
}

@font-face {
  font-family: 'Lato';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../vendor/fonts/lato-900.woff2') format('woff2');
}

/* Reset and Custom Properties */
:root {
  --purple-900: #2C124D;
  --purple-800: #421B66;
  --purple-700: #5E2D91;
  --purple-600: #7B3FB5;
  --purple-400: #9C67D4;
  --purple-100: #EDE7F6;
  --purple-50: #F8F5FC;
  --white: #FFFFFF;
  --gray-900: #1F2937;
  --gray-700: #374151;
  --gray-500: #6B7280;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --green-800: #1B5E20;
  --green-600: #2E7D32;
  --green-100: #E8F5E9;
  --green-50: #F1F8E9;
  --red-800: #B71C1C;
  --red-600: #C62828;
  --red-100: #FFEBEE;
  --amber-900: #78350F;
  --amber-700: #B45309;
  --amber-600: #D97706;
  --amber-100: #FEF3C7;
  --amber-50: #FFFBEB;
  --font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --border-width: 2px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
}

body {
  font-family: var(--font-family);
  background-color: var(--purple-50);
  color: var(--gray-900);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* App Container */
.app-container {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Header */
.top-header {
  height: 76px;
  background-color: rgba(94, 45, 145, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  flex-shrink: 0;
  border-bottom: var(--border-width) solid rgba(66, 27, 102, 0.9);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 58px;
}

.header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button {
  background: transparent;
  border: var(--border-width) solid transparent;
  color: var(--white);
  width: 58px;
  height: 58px;
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.icon-button.hidden {
  display: none !important;
}

.icon-button:focus-visible {
  background-color: var(--purple-800);
  border-color: var(--purple-400);
  outline: none;
}

.icon-button i {
  font-size: 26px;
}

/* Status Badge Toggle */
.status-toggle {
  background-color: rgba(66, 27, 102, 0.85);
  border: var(--border-width) solid var(--purple-400);
  color: var(--white);
  padding: 12px 26px;
  font-size: 19px;
  font-weight: 900;
  font-family: var(--font-family);
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.status-toggle:focus-visible {
  background-color: var(--purple-900);
  outline: none;
}

.status-toggle.offline {
  background-color: rgba(55, 65, 81, 0.85);
  border-color: var(--gray-500);
  color: var(--gray-200);
}

/* Screens Container & Slide Animations */
.screens-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: calc(100vh - 76px);
  height: calc(100dvh - 76px);
  overflow: hidden;
  background-color: var(--purple-50);
}

.app-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--purple-50);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.28s ease, visibility 0.28s ease;
  z-index: 10;
}

.app-screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 20;
}

/* Slide Left / Right Animation Classes */
.app-screen.slide-left-in {
  animation: slideLeftIn 0.28s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.app-screen.slide-left-out {
  animation: slideLeftOut 0.28s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.app-screen.slide-right-in {
  animation: slideRightIn 0.28s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.app-screen.slide-right-out {
  animation: slideRightOut 0.28s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes slideLeftIn {
  from {
    opacity: 0;
    transform: translateX(100%);
    visibility: visible;
  }
  to {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
}

@keyframes slideLeftOut {
  from {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
  to {
    opacity: 0;
    transform: translateX(-100%);
    visibility: hidden;
  }
}

@keyframes slideRightIn {
  from {
    opacity: 0;
    transform: translateX(-100%);
    visibility: visible;
  }
  to {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
}

@keyframes slideRightOut {
  from {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
  }
  to {
    opacity: 0;
    transform: translateX(100%);
    visibility: hidden;
  }
}

.screen-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 40px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Camera Viewport (Screen 1) */
#mainCameraView {
  background-color: #000000;
}

.camera-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  color: rgba(255, 255, 255, 0.85);
  z-index: 8;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.camera-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.camera-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.screen-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 12;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

.screen-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.offline-overlay {
  background-color: rgba(44, 18, 77, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--white);
}

.standby-overlay {
  background-color: rgba(248, 245, 252, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--gray-900);
}

.success-overlay {
  background-color: rgba(27, 94, 32, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--white);
  z-index: 22;
}

.success-overlay.in {
  background-color: rgba(27, 94, 32, 0.94);
}

.success-overlay.tardy,
.success-overlay.early {
  background-color: rgba(217, 119, 6, 0.94); /* Amber/warning */
}

.success-overlay.out {
  background-color: rgba(198, 40, 40, 0.94); /* Danger/red */
}

.success-icon {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.22);
  border: 4px solid var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 52px;
  color: var(--white);
}

.overlay-content {
  max-width: 480px;
}

.overlay-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  line-height: 1.15;
}

.offline-overlay .overlay-title {
  color: var(--white);
}

.standby-overlay .overlay-title {
  color: var(--purple-900);
}

.success-overlay .overlay-title {
  color: var(--white);
}

.overlay-subtitle {
  font-size: 20px;
  font-weight: 700;
}

.offline-overlay .overlay-subtitle {
  color: var(--purple-100);
}

.standby-overlay .overlay-subtitle {
  color: var(--purple-700);
}

.success-overlay .overlay-subtitle {
  color: var(--white);
  font-style: italic;
  font-size: 22px;
  font-weight: 600;
  opacity: 0.95;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background-color: var(--purple-700);
  color: var(--white);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  display: none !important;
}

.loading-spinner {
  font-size: 64px;
  color: var(--purple-100);
  margin-bottom: 24px;
}

.loading-spinner.error {
  color: #FFCDD2;
}

.loading-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.loading-progress {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-100);
}

.camera-denied-state {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.camera-denied-state.hidden {
  display: none !important;
}

.btn-camera-request {
  background-color: var(--white);
  color: var(--purple-900);
  font-size: 18px;
  font-weight: 900;
  padding: 14px 28px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-camera-request:focus-visible {
  background-color: var(--purple-50);
  transform: scale(1.02);
  outline: none;
}



/* Bottom Bar */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
  pointer-events: none;
}

.manual-button {
  pointer-events: auto;
  width: calc(100% - 32px);
  max-width: 520px;
  height: 64px;
  border-radius: 32px;
  background-color: rgba(94, 45, 145, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 3px solid var(--white);
  color: var(--white);
  font-family: var(--font-family);
  font-size: 19px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.manual-button.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.95);
}

.manual-button:focus-visible {
  background-color: var(--purple-600);
  border-color: var(--purple-100);
  outline: none;
}

/* Attendance List Screen (Grouped AM / PM, 1 Column) */
.attendance-groups-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.attendance-group-header {
  font-size: 22px;
  font-weight: 900;
  color: var(--purple-900);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--purple-700);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.attendance-group-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--purple-600);
}

.attendance-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-list-item {
  padding: 16px 18px;
  border-radius: 8px;
  border: var(--border-width) solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background-color: var(--white);
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.student-list-item:focus-visible {
  border-color: var(--purple-400);
  outline: none;
}

.student-list-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  text-align: left;
}

.student-list-item-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

.student-status-icon {
  font-size: 20px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-list-item.ontime {
  background-color: var(--green-50);
  border-color: var(--green-600);
}
.student-list-item.ontime .student-status-icon {
  color: var(--green-600);
}

.student-list-item.tardy-early {
  background-color: var(--amber-50);
  border-color: var(--amber-600);
}
.student-list-item.tardy-early .student-status-icon {
  color: var(--amber-600);
}

.student-list-item.absent {
  background-color: var(--red-50);
  border-color: var(--red-600);
}
.student-list-item.absent .student-status-icon {
  color: var(--red-600);
}

.student-list-item.overridden {
  background-color: #E8F0FE;
  border-color: #1A73E8;
}
.student-list-item.overridden .student-status-icon {
  color: #1A73E8;
}

.student-list-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.student-list-time-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-700);
  text-align: right;
}

.student-list-item.absent .student-list-time-badge {
  color: var(--red-800);
  font-weight: 800;
}

.student-list-item.ontime .student-list-time-badge {
  color: var(--green-800);
}

.student-list-item.tardy-early .student-list-time-badge {
  color: var(--amber-900);
}

.student-list-chevron {
  font-size: 14px;
  color: var(--gray-500);
}

/* Student History / Detail View Screen */
.student-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.student-history-name {
  font-size: 28px;
  font-weight: 900;
  color: var(--purple-900);
}

.session-tag {
  background-color: var(--purple-700);
  color: var(--white);
  padding: 6px 14px;
  font-size: 14px;
  border-radius: 6px;
  font-weight: 900;
}

/* 3-Column Stats Grid */
.stats-3col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background-color: var(--white);
  border: var(--border-width) solid var(--gray-300);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
}

.stat-box.on-time {
  border-color: var(--green-600);
  background-color: var(--green-50);
}
.stat-box.on-time .stat-value {
  color: var(--green-800);
}
.stat-box.on-time .stat-icon-label {
  color: var(--green-800);
}

.stat-box.tardy-early {
  border-color: var(--amber-600);
  background-color: var(--amber-50);
}
.stat-box.tardy-early .stat-value {
  color: var(--amber-900);
}
.stat-box.tardy-early .stat-icon-label {
  color: var(--amber-900);
}

.stat-box.absent {
  border-color: var(--red-600);
  background-color: var(--red-50);
}
.stat-box.absent .stat-value {
  color: var(--red-800);
}
.stat-box.absent .stat-icon-label {
  color: var(--red-800);
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-icon-label {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Table Container */
.table-container {
  background-color: var(--white);
  border: var(--border-width) solid var(--gray-300);
  border-radius: 8px;
  overflow: hidden;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 12px 14px;
  font-size: 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.history-table th {
  background-color: var(--purple-700);
  color: var(--white);
  font-weight: 900;
}

.history-table tr.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

/* Row Color Coding */
.history-table tr.row-ontime td {
  background-color: var(--green-50);
  color: var(--green-800);
}

.history-table tr.row-tardy td,
.history-table tr.row-early td {
  background-color: var(--amber-50);
  color: var(--amber-900);
}

.history-table tr.row-absent td {
  background-color: var(--red-50);
  color: var(--red-800);
}

.history-table tr.row-overridden td {
  background-color: #E8F0FE !important;
  color: #1A73E8 !important;
  font-weight: 700;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.badge-tag.present {
  background-color: var(--green-100);
  color: var(--green-800);
}

.badge-tag.absent {
  background-color: var(--red-100);
  color: var(--red-800);
}

.badge-tag.tardy,
.badge-tag.early {
  background-color: var(--amber-100);
  color: var(--amber-900);
}

.badge-tag.overridden {
  background-color: #1A73E8;
  color: var(--white);
}

/* Manual Attendance (Screen 5) 2-Col Grid */
.manual-heading-section {
  text-align: center;
  margin-bottom: 20px;
}

.screen-page-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--purple-900);
}

.manual-search-container {
  margin-bottom: 20px;
}

.manual-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.manual-name-card {
  padding: 24px 16px;
  min-height: 76px;
  background-color: var(--white);
  border: var(--border-width) solid var(--purple-700);
  border-radius: 10px;
  font-size: 20px;
  font-weight: 900;
  color: var(--purple-900);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition: background-color 0.15s ease;
}

.manual-name-card:focus-visible {
  outline: 3px solid var(--purple-400);
}

/* Fullscreen Face Registration Screen (Screen 6) */
.scan-screen {
  background-color: var(--purple-700);
  opacity: 1;
}

/* Scan Security Intro Full Purple Look (100% solid, not semi-transparent) */
.scan-intro-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background-color: var(--purple-700);
  color: var(--white);
  text-align: center;
}

.scan-intro-view.hidden {
  display: none !important;
}

.scan-intro-content {
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.scan-intro-lock-icon {
  width: 90px;
  height: 90px;
  border-radius: 45px;
  background-color: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.scan-intro-lock-icon i {
  font-size: 42px;
  color: var(--white);
}

.scan-intro-title {
  font-size: 26px;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 8px;
}

.scan-intro-subtitle {
  font-size: 16px;
  font-weight: 600;
  color: var(--purple-100);
  max-width: 440px;
  line-height: 1.4;
  margin-bottom: 20px;
}

.scan-intro-student-badge {
  display: inline-block;
  background-color: var(--purple-900);
  color: var(--purple-100);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 900;
  margin-top: 8px;
}

.scan-intro-start-btn {
  margin-top: 16px;
  min-width: 220px;
  height: 60px;
  font-size: 19px;
  font-weight: 900;
  border-radius: 30px;
  background-color: #1c0b33;
  color: var(--white);
  border: 3px solid var(--purple-400);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.scan-intro-start-btn:focus-visible {
  background-color: var(--purple-900);
  border-color: var(--white);
  outline: none;
}

.scan-fullscreen-body {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #000;
  overflow: hidden;
}

.scan-fullscreen-body.hidden {
  display: none !important;
}

.scan-fullscreen-camera-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-fullscreen-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
}

.scan-status-bottom-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 20px 40px;
  background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 70%, transparent 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.scan-target-name {
  font-size: 22px;
  font-weight: 900;
  color: var(--white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.scan-fullscreen-feedback {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-100);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.scan-progress-bar {
  width: min(80vw, 360px);
  height: 8px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  overflow: hidden;
}

.scan-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--green-600);
  transition: width 0.25s ease;
}

.scan-action-row {
  margin-top: 8px;
}

.scan-capture-btn {
  min-width: 200px;
  height: 60px;
  font-size: 19px;
  font-weight: 900;
  border-radius: 30px;
}

/* Manual Confirm Modal Styles */
.confirm-student-name {
  font-size: 32px;
  font-weight: 900;
  color: var(--purple-900);
  margin: 12px 0 6px;
  text-align: center;
}

.confirm-prompt-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-700);
  text-align: center;
}

.manual-confirm-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.large-btn {
  height: 54px;
  font-size: 17px;
  font-weight: 900;
  border-radius: 8px;
}

/* Modals and Sheets (PIN & Add Student) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(44, 18, 77, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--white);
  border: var(--border-width) solid var(--purple-700);
  border-radius: 8px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1001;
  pointer-events: auto;
}

.modal-header {
  background-color: var(--purple-700);
  color: var(--white);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--white);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  border-radius: 4px;
  pointer-events: auto;
}

.modal-close-btn:focus-visible {
  background-color: var(--purple-800);
  outline: none;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  pointer-events: auto;
}

.modal-footer {
  padding: 14px 18px;
  border-top: var(--border-width) solid var(--gray-200);
  background-color: var(--purple-50);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  pointer-events: auto;
}

/* PIN Modal Keypad */
.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 16px 0 24px;
}

.pin-digit-box {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: var(--border-width) solid var(--purple-700);
  background-color: var(--white);
}

.pin-digit-box.filled {
  background-color: var(--purple-700);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.keypad-btn {
  height: 64px;
  background-color: var(--white);
  border: var(--border-width) solid var(--purple-700);
  color: var(--purple-900);
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-family);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.keypad-btn:focus-visible {
  background-color: var(--purple-100);
  outline: none;
}

.keypad-btn.action-btn {
  font-size: 15px;
  background-color: var(--purple-50);
}

.form-alert {
  min-height: 22px;
  font-size: 14px;
  font-weight: 700;
  color: var(--red-600);
  text-align: center;
  margin-top: 10px;
}

/* Button Component */
.btn {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: var(--border-width) solid transparent;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--purple-700);
  border-color: var(--purple-800);
  color: var(--white);
}

.btn-primary:focus-visible {
  background-color: var(--purple-800);
  outline: none;
}

.btn-secondary {
  background-color: var(--white);
  border-color: var(--gray-300);
  color: var(--gray-700);
}

.btn-secondary:focus-visible {
  background-color: var(--gray-100);
  outline: none;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
  min-width: 0;
  width: 100%;
}

.form-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input,
.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px !important;
  font-family: var(--font-family);
  border: var(--border-width) solid var(--gray-300);
  border-radius: 6px;
  background-color: var(--white);
  color: var(--gray-900);
  min-height: 48px;
  box-sizing: border-box;
}

.form-input[type="time"] {
  max-width: 220px;
}

.form-input[type="number"] {
  max-width: 220px;
}

.form-input[type="password"] {
  max-width: 220px;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--purple-700);
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  max-width: 520px;
  width: 100%;
  box-sizing: border-box;
}

/* Settings Sections */
.settings-section {
  background-color: var(--white);
  border: var(--border-width) solid var(--gray-300);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--purple-900);
  margin-bottom: 14px;
}

.student-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background-color: var(--purple-50);
  border: var(--border-width) solid var(--purple-100);
  border-radius: 6px;
  padding: 10px 14px;
}

.student-row-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.student-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-select {
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-family);
  border: var(--border-width) solid var(--gray-300);
  border-radius: 4px;
  background-color: var(--white);
}

.btn-icon-action {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: var(--border-width) solid var(--gray-300);
  background-color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-700);
}

.btn-icon-action:focus-visible {
  background-color: var(--purple-50);
  border-color: var(--purple-700);
  color: var(--purple-700);
  outline: none;
}

.btn-icon-action.bound {
  background-color: var(--green-100);
  border-color: var(--green-600);
  color: var(--green-800);
}

.btn-icon-action.delete:focus-visible {
  background-color: var(--red-100);
  border-color: var(--red-600);
  color: var(--red-800);
  outline: none;
}

/* Face Captured Success Overlay (Solid Opaque Purple, not semi-transparent) */
.scan-success-overlay {
  position: absolute;
  inset: 0;
  background-color: var(--purple-700);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: fadeIn 0.25s ease forwards;
}

.scan-success-overlay.hidden {
  display: none !important;
}

.scan-success-icon {
  font-size: 80px;
  color: var(--white);
  animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Four-Breakpoint Responsive Layout */
@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .stats-3col-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
}

@media (min-width: 1025px) {
}

