:root {
  color-scheme: dark;
  --bg-page: #070b15;
  --bg-side: #0a0f1d;
  --bg-surface: #0e1526;
  --bg-raised: #141d33;
  --bg-hover: #18223a;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eefb;
  --text-muted: #a3b1c9;
  --text-faint: #6d7c96;
  --accent-from: #10b981;
  --accent-to: #06b6d4;
  --accent-bright: #34d399;
  --on-accent: #041412;
  --present: #34d399;
  --late: #fbbf24;
  --absent: #f87171;
  --out: #38bdf8;
  --active: #34d399;
  --inactive: #94a3b8;
  --danger: #f87171;
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;
  --sp-10: 4rem;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;
  --shadow-1: 0 1px 2px rgba(2, 6, 17, 0.5), 0 2px 6px rgba(2, 6, 17, 0.35);
  --shadow-2: 0 12px 32px rgba(2, 6, 17, 0.5);
  --shadow-accent: 0 4px 20px rgba(16, 185, 129, 0.35), 0 4px 12px rgba(6, 182, 212, 0.2);
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --dur-fast: 150ms;
  --dur-med: 250ms;
  --dur-slow: 400ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote {
  margin: 0;
}

ul, ol {
  list-style: none;
  padding: 0;
}

img, svg, canvas, video {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color var(--dur-fast) ease-out;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(16, 185, 129, 0.35);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-link:focus-visible {
  outline-offset: 3px;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 16rem;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  background: var(--bg-side);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.45rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(6, 182, 212, 0.25));
}

.brand-mark--lg {
  width: 2.5rem;
  height: 2.5rem;
}

.brand-mark--xl {
  width: 3.5rem;
  height: 3.5rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--dur-fast) ease-out, background-color var(--dur-fast) ease-out;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.09);
  text-decoration: none;
}

.nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-link[aria-current="page"] {
  color: var(--text);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14), rgba(6, 182, 212, 0.07));
}

.nav-link[aria-current="page"] .nav-icon {
  opacity: 1;
  color: var(--accent-bright);
}

.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-from), var(--accent-to));
  transform-origin: left center;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 3.75rem;
  padding: 0.55rem 1.75rem;
  background: rgba(7, 11, 21, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-date {
  color: var(--text-faint);
  font-size: 0.85rem;
  white-space: nowrap;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.user-role {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.content {
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  flex: 1;
  padding: 1.75rem 1.75rem 3rem;
}

.page-title {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 1.4rem;
}

.skip-link {
  position: fixed;
  left: -100rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2);
}

.skip-link:focus {
  left: 0.75rem;
}

.grid {
  display: grid;
  gap: var(--sp-5);
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid--sidebar {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}

.row--tight {
  gap: var(--sp-2);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.between {
  justify-content: space-between;
}

.grow {
  flex: 1;
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.section-title {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (max-width: 900px) {
  .grid--2,
  .grid--3,
  .grid--4,
  .grid--sidebar {
    grid-template-columns: 1fr;
  }

  .toolbar > * {
    width: 100%;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 1.5rem;
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.15rem 1.3rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-value--present { color: var(--present); }
.stat-value--late { color: var(--late); }
.stat-value--absent { color: var(--absent); }
.stat-value--out { color: var(--out); }

.stat-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-hint {
  font-size: 0.74rem;
  color: var(--text-faint);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  flex-shrink: 0;
  border-radius: var(--r-md);
}

.stat-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.stat-icon--present {
  color: var(--present);
  background: rgba(52, 211, 153, 0.13);
}

.stat-icon--late {
  color: var(--late);
  background: rgba(251, 191, 36, 0.13);
}

.stat-icon--absent {
  color: var(--absent);
  background: rgba(248, 113, 113, 0.13);
}

.stat-icon--out {
  color: var(--out);
  background: rgba(56, 189, 248, 0.13);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.58rem 1.15rem;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) ease-out,
    border-color var(--dur-fast) ease-out, color var(--dur-fast) ease-out,
    box-shadow var(--dur-fast) ease-out, filter var(--dur-fast) ease-out;
}

.btn:active {
  transform: translateY(1px);
}

.btn--sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn--lg {
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(2, 6, 17, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-accent);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--bg-raised);
  color: var(--text);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
  transform: translateY(-1px);
  text-decoration: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
}

.hint {
  font-size: 0.76rem;
  color: var(--text-faint);
}

.input,
.select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}

.input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

.input:hover,
.select:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover,
textarea:hover,
select:hover {
  border-color: rgba(148, 163, 184, 0.45);
}

.input:focus,
.select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.input:focus-visible,
.select:focus-visible {
  outline: none;
}

.select,
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3b1c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1rem;
}

.search-box {
  position: relative;
}

.search-box .input {
  padding-left: 2.4rem;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.toolbar .search-box {
  flex: 1 1 14rem;
  max-width: 26rem;
}

@media (max-width: 900px) {
  .toolbar .search-box {
    max-width: none;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.16rem 0.62rem 0.16rem 0.55rem;
  border-radius: var(--r-full);
  border: 1px solid;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.pill--present {
  color: var(--present);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.pill--late {
  color: var(--late);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.32);
}

.pill--absent {
  color: var(--absent);
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.32);
}

.pill--out {
  color: var(--out);
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.32);
}

.pill--active {
  color: var(--active);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.pill--inactive {
  color: var(--inactive);
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.28);
}

.pill--transferred {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.32);
}

.pill--sm {
  font-size: 0.66rem;
  padding: 0.05rem 0.5rem 0.05rem 0.42rem;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.avatar--sm {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.65rem;
}

.avatar--c1 { background: linear-gradient(135deg, #34d399, #10b981); }
.avatar--c2 { background: linear-gradient(135deg, #38bdf8, #0ea5e9); }
.avatar--c3 { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.avatar--c4 { background: linear-gradient(135deg, #f472b6, #ec4899); }
.avatar--c5 { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.avatar--c6 { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-1);
}

.table-wrap::-webkit-scrollbar {
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: var(--r-full);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  padding: 0.6rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: rgba(148, 163, 184, 0.05);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.table td {
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  transition: background-color var(--dur-fast) ease-out, transform var(--dur-fast) var(--ease-out);
}

.table tbody tr:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-from);
}

.chart-box {
  position: relative;
  height: 15rem;
}

.feed-target {
  min-height: 6rem;
}

.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.55rem 0;
}

.list-row + .list-row {
  border-top: 1px solid var(--border);
}

.push {
  margin-left: auto;
}

.feed-time {
  min-width: 4.7rem;
  color: var(--text-faint);
  font-size: 0.78rem;
}

.feed-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.feed-station {
  color: var(--text-faint);
  font-size: 0.8rem;
}

.feed-empty {
  padding: 0.4rem 0;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.health-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.student-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.student-cell a {
  font-weight: 600;
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 1rem;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(163, 177, 201, 0.13), transparent);
}

.skeleton--line {
  height: 0.8rem;
  width: 60%;
}

.skeleton--title {
  height: 1.4rem;
  width: 40%;
  margin-bottom: 0.4rem;
}

.skeleton--avatar {
  width: 2.4rem;
  height: 2.4rem;
  min-height: 0;
  border-radius: 50%;
}

.skeleton--block {
  min-height: 4rem;
  width: 100%;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-faint);
}

.empty-state svg {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
}

.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  padding: 0.65rem 1rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.loading-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: var(--sp-2);
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
}

.loading-rows .skeleton {
  height: 0.85rem;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity var(--dur-med) ease-out;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.profile-photo {
  width: 7.5rem;
  height: 7.5rem;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  box-shadow: var(--shadow-1);
}

.profile-name {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.detail-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: 0.88rem;
}

.alert svg {
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
}

.alert--error {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.32);
  color: #fca5a5;
}

.alert--info {
  background: rgba(56, 189, 248, 0.09);
  border-color: rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}

.alert--success {
  background: rgba(52, 211, 153, 0.09);
  border-color: rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: 0.02em;
}

.auth-body {
  background:
    radial-gradient(46rem 26rem at 78% -8%, rgba(6, 182, 212, 0.1), transparent 60%),
    radial-gradient(40rem 24rem at 12% 108%, rgba(16, 185, 129, 0.08), transparent 60%),
    var(--bg-page);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
}

.auth-card {
  width: min(100%, 26rem);
  padding: 2.25rem 2rem;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
}

.auth-title {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.auth-form .btn--block {
  margin-top: 0.4rem;
}

.auth-alert {
  margin-bottom: 1.2rem;
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-4);
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5);
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(92deg, var(--accent-bright), var(--accent-to));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 30rem;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes fade-up {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes pulse-in {
    0% {
      opacity: 0;
      transform: translateY(-4px);
    }
    55% {
      opacity: 1;
      transform: none;
      background-color: rgba(52, 211, 153, 0.14);
    }
    100% {
      opacity: 1;
      transform: none;
      background-color: transparent;
    }
  }

  @keyframes shimmer {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(100%);
    }
  }

  @keyframes nav-in {
    from {
      opacity: 0;
      transform: scale(0.4);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  .fade-up {
    animation: fade-up var(--dur-med) var(--ease-out) both;
  }

  .content {
    animation: fade-up var(--dur-slow) var(--ease-out);
  }

  .nav-link[aria-current="page"]::before {
    animation: nav-in var(--dur-med) var(--ease-out) both;
  }

  .pulse-in {
    animation: pulse-in var(--dur-slow) var(--ease-out) both;
  }

  .skeleton::after {
    animation: shimmer 1.2s linear infinite;
  }

  .stagger > * {
    animation: fade-up var(--dur-med) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
  }

  .stagger > :nth-child(1) { --i: 0; }
  .stagger > :nth-child(2) { --i: 1; }
  .stagger > :nth-child(3) { --i: 2; }
  .stagger > :nth-child(4) { --i: 3; }
  .stagger > :nth-child(5) { --i: 4; }
  .stagger > :nth-child(6) { --i: 5; }
  .stagger > :nth-child(7) { --i: 6; }
  .stagger > :nth-child(8) { --i: 7; }
  .stagger > :nth-child(9) { --i: 8; }
  .stagger > :nth-child(10) { --i: 9; }
  .stagger > :nth-child(11) { --i: 10; }
  .stagger > :nth-child(12) { --i: 11; }
  .stagger > :nth-child(13) { --i: 12; }
  .stagger > :nth-child(14) { --i: 13; }
  .stagger > :nth-child(15) { --i: 14; }
  .stagger > :nth-child(16) { --i: 15; }
  .stagger > :nth-child(17) { --i: 16; }
  .stagger > :nth-child(18) { --i: 17; }
  .stagger > :nth-child(19) { --i: 18; }
  .stagger > :nth-child(20) { --i: 19; }
  .stagger > :nth-child(21) { --i: 20; }
  .stagger > :nth-child(22) { --i: 21; }
  .stagger > :nth-child(23) { --i: 22; }
  .stagger > :nth-child(24) { --i: 23; }
  .stagger > :nth-child(25) { --i: 24; }
  .stagger > :nth-child(n + 26) { --i: 25; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .sidebar {
    height: auto;
    width: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 15, 29, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    overflow: visible;
  }

  .brand {
    margin-bottom: 0;
    flex-shrink: 0;
    padding: 0.2rem 0.35rem;
  }

  .nav {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.42rem 0.65rem;
    font-size: 0.82rem;
    gap: 0.45rem;
  }

  .nav-icon {
    width: 1rem;
    height: 1rem;
  }

  .nav-link[aria-current="page"]::before {
    left: 14%;
    right: 14%;
    top: auto;
    bottom: 5%;
    width: auto;
    height: 2px;
    transform-origin: center;
  }

  .topbar {
    position: static;
    min-height: 0;
    padding: 0.75rem 0.9rem 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: none;
  }

  .content {
    padding: 1.25rem 0.9rem 3rem;
  }

  .page-title {
    font-size: 1.3rem;
    margin-bottom: 1.1rem;
  }
}

@media (max-width: 520px) {
  .brand-name,
  .user-meta,
  .topbar-date {
    display: none;
  }
}

/* ==========================================================================
   Page components — SMS monitor, settings, enrollment, teacher, student,
   reports. Added when those nine templates were migrated off Tailwind.
   ========================================================================== */

/* --- shared bits -------------------------------------------------------- */

.card-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 var(--sp-4);
}

.text-faint { color: var(--text-faint); }

.link-strong {
  color: var(--accent-bright);
  font-weight: 600;
  text-decoration: none;
}
.link-strong:hover { text-decoration: underline; }

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.hint-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  vertical-align: -2px;
  margin-right: var(--sp-1);
}

.toolbar-spacer { flex: 1 1 auto; }

.table-actions { text-align: right; white-space: nowrap; }

.count {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.count--present { color: var(--present); }
.count--late    { color: var(--late); }
.count--absent  { color: var(--absent); }

/* --- forms -------------------------------------------------------------- */

.form-card {
  max-width: 34rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.form-actions {
  display: flex;
  gap: var(--sp-3);
  padding-top: var(--sp-1);
}

/* --- SMS monitor -------------------------------------------------------- */

.stat-strip { margin-bottom: var(--sp-5); }

.stat-card--compact { padding: var(--sp-4); text-align: center; }
.stat-card--compact .stat-value { font-size: 1.55rem; }
.stat-card--compact .stat-label { text-transform: capitalize; }

.stat-value--pending { color: var(--late); }
.stat-value--claimed { color: var(--out); }
.stat-value--sent    { color: var(--present); }
.stat-value--failed  { color: var(--absent); }
.stat-value--expired { color: var(--text-faint); }

.drain-note { margin: 0 0 var(--sp-5); }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.feed-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  font-size: 0.87rem;
  transition: background-color 140ms ease-out;
}
.feed-item:hover { background: var(--bg-hover); }

.feed-time { color: var(--text-faint); font-size: 0.8rem; }
.feed-note { color: var(--text-muted); }

/* --- enrollment --------------------------------------------------------- */

.enroll-card { max-width: 34rem; }

.enroll-reader {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: rgba(16, 185, 129, 0.04);
}

.enroll-lead { margin: 0; font-weight: 600; }
.enroll-reader .hint { margin: var(--sp-1) 0 0; }

.reader-pulse {
  width: 12px;
  height: 12px;
  border-radius: var(--r-full);
  background: var(--accent-bright);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
}

.enroll-status:empty { display: none; }

/* --- student portal ----------------------------------------------------- */

.avatar--lg {
  width: 56px;
  height: 56px;
  font-size: 1.15rem;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.profile-meta { flex: 1 1 12rem; }
.profile-name { margin: 0; font-size: 1.15rem; font-weight: 700; }
.profile-sub  { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: 0.87rem; }
.profile-stat { text-align: right; }

.calendar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-2);
  text-align: center;
}

.calendar-day {
  padding: var(--sp-2) 0;
  border-radius: var(--r-md);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.calendar-day--present { background: rgba(52, 211, 153, 0.14); color: var(--present); border-color: rgba(52, 211, 153, 0.22); }
.calendar-day--late    { background: rgba(251, 191, 36, 0.14); color: var(--late);    border-color: rgba(251, 191, 36, 0.22); }
.calendar-day--absent  { background: rgba(248, 113, 113, 0.14); color: var(--absent); border-color: rgba(248, 113, 113, 0.22); }

.calendar-empty { grid-column: 1 / -1; }

/* --- reports ------------------------------------------------------------ */

.report-lead { margin: 0 0 var(--sp-5); }

.report-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--sp-4);
}

.report-tile {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}
.report-tile:hover {
  border-color: rgba(52, 211, 153, 0.4);
  background: var(--bg-hover);
}
.report-tile:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.report-icon { width: 20px; height: 20px; color: var(--accent-bright); flex-shrink: 0; }
.report-name { font-weight: 600; flex: 1; }
.report-arrow { width: 16px; height: 16px; color: var(--text-faint); flex-shrink: 0; }

@media (prefers-reduced-motion: no-preference) {
  .report-tile:hover { transform: translateY(-2px); }
  .report-tile:hover .report-arrow { transform: translateX(3px); }
  .report-arrow { transition: transform 160ms ease-out; }

  .reader-pulse { animation: reader-ping 2s ease-out infinite; }

  @keyframes reader-ping {
    0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
  }

  .feed-item,
  .calendar-day,
  .report-grid > li {
    animation: fade-up 320ms ease-out both;
    animation-delay: calc(var(--i, 0) * 22ms);
  }
}

@media (max-width: 900px) {
  .form-card, .enroll-card { max-width: none; }
  .profile-stat { text-align: left; }
  .toolbar-spacer { display: none; }
}

.grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- enrolment student picker ------------------------------------------ */

.picker-results { margin-top: var(--sp-2); }

.picker-list {
  list-style: none;
  margin: 0;
  padding: var(--sp-1);
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
}

.picker-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.picker-option:hover { background: var(--bg-hover); }
.picker-option:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: -2px; }

.picker-main { display: flex; flex-direction: column; gap: 2px; }
.picker-name { font-weight: 600; }
.picker-meta { font-size: 0.8rem; color: var(--text-faint); }

.picker-hint {
  margin: var(--sp-2) 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.picker-chosen {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-2) 0 0;
}

/* `display: flex` above beats the hidden attribute, which would otherwise
   leave the chosen-student chip on screen after it was cleared - showing
   one name while the form submits another. */
.picker-chosen[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .picker-list li { animation: fade-up 220ms ease-out both; animation-delay: calc(var(--i, 0) * 18ms); }
}
