:root {
  --relay-radius: 0.75rem;
  --sidebar-width: 250px;
  --sidebar-bg: #111827;
  --sidebar-fg: #cbd5e1;
  --sidebar-fg-muted: #64748b;
  --topbar-height: 56px;
}

body {
  min-height: 100vh;
}

/* ---------------------------------------------------------------------------
   Sidebar
--------------------------------------------------------------------------- */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease;
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-brand i {
  font-size: 1.5rem;
}

.app-sidebar-brand:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.app-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.6rem;
}

.app-nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sidebar-fg-muted);
  padding: 0.9rem 0.65rem 0.35rem;
}

.app-sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--sidebar-fg);
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.15rem;
  font-size: 0.925rem;
}

.app-sidebar-nav .nav-link i {
  font-size: 1.05rem;
  width: 1.2rem;
  text-align: center;
}

.app-sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-sidebar-nav .nav-link.active {
  background: var(--bs-primary);
  color: #fff;
  font-weight: 600;
}

.app-sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-user:hover,
.sidebar-user:focus {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ---------------------------------------------------------------------------
   Main column
--------------------------------------------------------------------------- */
.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--topbar-height);
  padding: 0.5rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--bs-border-color);
}

.app-content {
  flex: 1;
  padding: 1.5rem;
}

.app-footer {
  padding: 0.85rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  border-top: 1px solid var(--bs-border-color);
}

.app-sidebar-backdrop {
  display: none;
}

/* ---------------------------------------------------------------------------
   Responsive: sidebar becomes an off-canvas drawer on small screens
--------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.35);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .app-sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1035;
  }
}

@media (min-width: 992px) {
  #appSidebarToggle {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Components
--------------------------------------------------------------------------- */
.card {
  border-radius: var(--relay-radius);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.table > :not(caption) > * > * {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

code {
  font-size: 0.85em;
}

pre code {
  font-size: 0.82rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------------------
   Documentation page
--------------------------------------------------------------------------- */
.docs-toc {
  position: sticky;
  top: calc(var(--topbar-height) + 1rem);
}

.docs-toc .list-group-item {
  border: 0;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.docs-code {
  position: relative;
}

.docs-code pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 3rem 1rem 1rem;
  border-radius: 0.65rem;
  margin: 0;
  overflow-x: auto;
}

.docs-code pre code {
  color: inherit;
  background: transparent;
}

.docs-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  cursor: pointer;
}

.docs-copy:hover {
  background: rgba(255, 255, 255, 0.18);
}

.docs-copy.copied {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
}

#attendance-feed tr.flash-new {
  animation: rowFlash 1.4s ease-out;
}

@keyframes rowFlash {
  from {
    background-color: rgba(13, 110, 253, 0.16);
  }
  to {
    background-color: transparent;
  }
}

.dropdown-menu {
  border-radius: 0.5rem;
}
