:root {
  --sk-sidebar-width: 250px;
  --sk-brand: #0d6efd;
}

html, body { height: 100%; }
body {
  background-color: #f5f6f8;
  min-height: 100vh;
}

/* ---------- Auth screens ---------- */
.sk-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.sk-auth-card { width: 100%; max-width: 420px; }

/* ---------- App shell ---------- */
.sk-app { min-height: 100vh; }
.sk-sidebar {
  width: var(--sk-sidebar-width);
  background: #1f2937;
  color: #e5e7eb;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1045;
  transition: transform .2s ease-in-out;
}
.sk-sidebar .sk-brand {
  font-weight: 700;
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sk-sidebar .nav-link {
  color: #cbd5e1;
  border-radius: .375rem;
  margin: .1rem .5rem;
  padding: .55rem .85rem;
  display: flex;
  align-items: center;
  gap: .65rem;
}
.sk-sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sk-sidebar .nav-link.active { background: var(--sk-brand); color: #fff; }
.sk-sidebar .nav-section {
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .05em;
  color: #94a3b8;
  padding: .75rem 1.25rem .25rem;
}

.sk-main {
  margin-left: var(--sk-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.sk-topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: .6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}
.sk-content { padding: 1.25rem; flex: 1 1 auto; }

.sk-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 1040; display: none;
}

@media (max-width: 991.98px) {
  .sk-sidebar { transform: translateX(-100%); }
  .sk-sidebar.show { transform: translateX(0); }
  .sk-main { margin-left: 0; }
  .sk-backdrop.show { display: block; }
}

/* ---------- Cards / stats ---------- */
.sk-stat { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.sk-stat .sk-stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.sk-stat .sk-stat-label { color: #6b7280; font-size: .85rem; }

.card { border: none; box-shadow: 0 1px 3px rgba(0,0,0,.07); }

/* ---------- 7-day chart ---------- */
.sk-chart { display: flex; align-items: flex-end; gap: .5rem; height: 180px; }
.sk-chart .sk-bar-col {
  flex: 1 1 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%;
  min-width: 0;
}
.sk-chart .sk-bar-stack {
  width: 60%; max-width: 42px; display: flex; flex-direction: column-reverse;
  border-radius: 4px 4px 0 0; overflow: hidden; background: #eef1f4;
}
.sk-chart .sk-bar-seg { width: 100%; }
.sk-chart .sk-bar-present { background: #198754; }
.sk-chart .sk-bar-late { background: #ffc107; }
.sk-chart .sk-bar-gap { background: #dc3545; }
.sk-chart .sk-bar-label { font-size: .7rem; color: #6b7280; margin-top: .35rem; text-align: center; }

.sk-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; }
.sk-legend .sk-dot { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; margin-right: .35rem; }

/* ---------- Attendance / selfie ---------- */
.sk-selfie-video, .sk-selfie-canvas, .sk-selfie-preview {
  width: 100%; max-width: 360px; border-radius: .5rem; background: #000;
  aspect-ratio: 3 / 4; object-fit: cover;
}
.sk-selfie-preview { object-fit: contain; background: #f1f3f5; }

.sk-empty {
  text-align: center; color: #6b7280; padding: 2.5rem 1rem;
}
.sk-empty i { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }

.sk-table-wrap { overflow-x: auto; }
table.sk-table { white-space: nowrap; }

.sk-required::after { content: " *"; color: #dc3545; }

.sk-toast-container { z-index: 1100; }

/* Print helper for report print view */
@media print {
  .sk-sidebar, .sk-topbar, .sk-no-print { display: none !important; }
  .sk-main { margin-left: 0; }
  .sk-content { padding: 0; }
}

.badge-status-present { background-color: #198754; }
.badge-status-late { background-color: #ffc107; color: #000; }
.badge-status-absent { background-color: #dc3545; }
.badge-status-not_yet_attended { background-color: #6c757d; }
.badge-status-not_school_day { background-color: #0dcaf0; color: #000; }

.text-truncate-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Step progress (attendance flow) ---------- */
.sk-step-bar {
  align-items: center;
}
.sk-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  min-width: 0;
}
.sk-step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  background: #e5e7eb;
  color: #6b7280;
  flex-shrink: 0;
}
.sk-step-item.active .sk-step-circle {
  background: var(--sk-brand);
  color: #fff;
}
.sk-step-item.done .sk-step-circle {
  background: #198754;
  color: #fff;
}
.sk-step-label {
  font-size: .7rem;
  color: #6b7280;
  text-align: center;
  white-space: nowrap;
}
.sk-step-item.active .sk-step-label { color: var(--sk-brand); font-weight: 600; }
.sk-step-item.done .sk-step-label { color: #198754; }
.sk-step-line {
  flex: 1 1 0;
  height: 2px;
  background: #e5e7eb;
  margin: 0 .25rem;
  margin-bottom: 1.4rem;
  min-width: 1.5rem;
}
.sk-step-line.done { background: #198754; }

/* ---------- Modal scroll fix for small viewports ---------- */
.modal-dialog-scrollable {
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
}
.modal-dialog-scrollable .modal-body {
  -webkit-overflow-scrolling: touch;
}
