/* ============================================================
   RDFL Grade System — Mobile-First CSS
   Colors: #1a3a8f (blue) #f5c518 (yellow)
   Font: Sarabun
   ============================================================ */

:root {
  --blue:        #1a3a8f;
  --blue-dark:   #122d72;
  --blue-light:  #e8eef9;
  --yellow:      #f5c518;
  --yellow-light:#fffbea;
  --white:       #ffffff;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-400:    #9ca3af;
  --gray-500:    #6b7280;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --red:         #dc2626;
  --red-light:   #fef2f2;
  --green:       #16a34a;
  --green-light: #f0fdf4;
  --orange:      #ea580c;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 2px 8px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 24px rgba(0,0,0,.12);
  --nav-h:       60px;   /* bottom nav height mobile */
  --topbar-h:    56px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Sarabun', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
  min-height: 100dvh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ── Public site header ─────────────────────────────────── */
.site-header {
  background: var(--blue);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.site-header__inner {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}
.site-header__brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--white);
  text-decoration: none;
}
.site-header__logo { height: 32px; width: auto; }
.site-header__title { font-weight: 600; font-size: 1rem; color: var(--white); }
.site-main { padding-bottom: 2rem; }
.site-footer {
  text-align: center;
  font-size: .8rem;
  color: var(--gray-500);
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--gray-200);
}

/* ── App shell (teacher/admin) ──────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100dvh; }

/* Top bar */
.topbar {
  height: var(--topbar-h);
  background: var(--blue);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: .75rem;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}
.topbar__menu-btn {
  background: none;
  border: none;
  color: var(--white);
  padding: .4rem;
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  display: none; /* shown on desktop via media query */
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
  color: var(--white);
  text-decoration: none;
  min-width: 0;
}
.topbar__logo { height: 30px; }
.topbar__title {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__user {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: rgba(255,255,255,.85);
  font-size: .85rem;
}
.topbar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.topbar__name { display: none; }

/* Main layout */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar (hidden on mobile, shown on tablet+) */
.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  display: none;
}
.sidebar__nav { padding: .75rem 0; }
.sidebar__section {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: .75rem 1.25rem .25rem;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: var(--gray-700);
  font-size: .9rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}
.sidebar__link:hover { background: var(--gray-50); text-decoration: none; }
.sidebar__link.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 600;
}
.sidebar__link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.sidebar__link.active svg { opacity: 1; }

/* Page content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: calc(var(--nav-h) + 1rem); /* space for bottom nav */
}
.page-header {
  margin-bottom: 1.25rem;
}
.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}
.page-subtitle {
  font-size: .85rem;
  color: var(--gray-500);
  margin-top: .15rem;
}

/* Bottom navigation (mobile only) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  z-index: 200;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  color: var(--gray-400);
  font-size: .65rem;
  font-weight: 500;
  padding: .35rem .25rem .2rem;
  border: none;
  background: none;
  transition: color .15s;
  text-decoration: none;
}
.bottom-nav__item svg { width: 22px; height: 22px; }
.bottom-nav__item.active { color: var(--blue); }
.bottom-nav__item:hover { color: var(--blue); text-decoration: none; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-body { padding: 1rem; }
.card-header {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.card-title { font-weight: 600; font-size: .95rem; }

/* Subject card (dashboard) */
.subject-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--subj-color, var(--blue));
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  text-decoration: none;
  color: inherit;
}
.subject-card:hover { box-shadow: var(--shadow); border-left-color: var(--subj-color, var(--blue)); text-decoration: none; }
.subject-card__code { font-size: .75rem; color: var(--subj-color, var(--gray-500)); font-weight: 500; }
.subject-card__name { font-weight: 600; font-size: .95rem; line-height: 1.3; }
.subject-card__meta { font-size: .8rem; color: var(--gray-500); }
.subject-card__progress-bar {
  height: 4px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}
.subject-card__progress-fill {
  height: 100%;
  background: var(--subj-color, var(--blue));
  border-radius: 99px;
  transition: width .3s;
}
.subject-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--gray-500);
}
.subject-card.archived { opacity: .65; }
.subject-card.archived .subject-card__name { text-decoration: line-through; }

/* Grid for subject cards */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

/* ── GPA Badges ─────────────────────────────────────────── */
.gpa-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  border-radius: 99px;
  font-weight: 700;
  font-size: .82rem;
  padding: 0 .6rem;
}
.gpa-4   { background: #16a34a; color: #fff; }
.gpa-35  { background: #2563eb; color: #fff; }
.gpa-3   { background: #0891b2; color: #fff; }
.gpa-25  { background: #ca8a04; color: #fff; }
.gpa-2   { background: #ea580c; color: #fff; }
.gpa-15  { background: #dc2626; color: #fff; }
.gpa-1   { background: #9f1239; color: #fff; }
.gpa-0   { background: var(--gray-300); color: var(--gray-700); }

/* ── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-label { font-size: .88rem; font-weight: 500; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  min-height: 44px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,58,143,.12);
}
.form-input.error { border-color: var(--red); }
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: .78rem; color: var(--gray-500); }

/* Inline form row */
.form-row {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  border: 1.5px solid transparent;
  min-height: 44px;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--blue); color: var(--white); border-color: var(--blue); }
.btn--primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; }
.btn--secondary { background: var(--white); color: var(--blue); border-color: var(--blue); }
.btn--secondary:hover { background: var(--blue-light); text-decoration: none; }
.btn--danger { background: var(--red); color: var(--white); border-color: var(--red); }
.btn--danger:hover { opacity: .88; text-decoration: none; }
.btn--ghost { background: none; color: var(--gray-700); border-color: var(--gray-300); }
.btn--ghost:hover { background: var(--gray-100); text-decoration: none; }
.btn--yellow { background: var(--yellow); color: var(--blue-dark); border-color: var(--yellow); font-weight: 700; }
.btn--full { width: 100%; }
.btn--sm { min-height: 36px; padding: .35rem .75rem; font-size: .82rem; }
.btn--icon { padding: .5rem; min-height: 40px; width: 40px; border-radius: var(--radius-sm); }

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + .75rem);
  right: 1rem;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  border: none;
  transition: transform .15s, background .15s;
}
.fab:hover { background: var(--blue-dark); transform: scale(1.06); }
.fab svg { width: 22px; height: 22px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.table th {
  background: var(--gray-50);
  color: var(--gray-500);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .6rem .75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* Grade spreadsheet */
.grade-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100dvh - var(--topbar-h) - var(--nav-h) - 120px);
}
.grade-table {
  border-collapse: collapse;
  font-size: .82rem;
  min-width: 100%;
}
.grade-table th, .grade-table td {
  border: 1px solid var(--gray-200);
  padding: 0;
  white-space: nowrap;
}
.grade-table thead th {
  background: var(--gray-50);
  position: sticky;
  top: 0;
  z-index: 10;
  font-size: .72rem;
  font-weight: 600;
  color: var(--gray-600);
  padding: .4rem .5rem;
  text-align: center;
}
/* Sticky first column */
.grade-table .col-num,
.grade-table .col-name {
  position: sticky;
  background: var(--white);
  z-index: 5;
}
.grade-table .col-num  { left: 0; width: 36px; text-align: center; }
.grade-table .col-name { left: 36px; min-width: 120px; max-width: 160px; }
.grade-table thead .col-num,
.grade-table thead .col-name { z-index: 15; }

.grade-table .col-total {
  font-weight: 700;
  text-align: center;
  background: var(--gray-50);
  min-width: 52px;
}
.grade-table .col-gpa { text-align: center; min-width: 52px; }

/* Score input cell */
.score-cell {
  width: 56px;
  text-align: center;
}
.score-input {
  width: 100%;
  height: 36px;
  border: none;
  background: transparent;
  text-align: center;
  font-size: .88rem;
  font-family: inherit;
  color: var(--gray-900);
  padding: 0 .2rem;
}
.score-input:focus {
  outline: none;
  background: #ebf0ff;
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Type column headers */
.type-assign    { background: #f3f0ff; }
.type-mid-work  { background: #fffbea; }
.type-mid       { background: #fef2f2; }
.type-final-work { background: #f0fdf4; }
.type-final     { background: #fff7ed; }

/* LMS badge */
.lms-badge {
  display: inline-block;
  font-size: .6rem;
  font-weight: 700;
  background: #0ea5e9;
  color: #fff;
  padding: 0 .3rem;
  border-radius: 3px;
  line-height: 1.4;
  vertical-align: top;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert--error   { background: var(--red-light);   color: #991b1b; border: 1px solid #fecaca; }
.alert--success { background: var(--green-light);  color: #14532d; border: 1px solid #bbf7d0; }
.alert--info    { background: var(--blue-light);   color: var(--blue-dark); border: 1px solid #bfdbfe; }
.alert--warn    { background: var(--yellow-light); color: #92400e; border: 1px solid #fde68a; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  top: calc(var(--topbar-h) + .5rem);
  right: .75rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  pointer-events: none;
}
.toast {
  background: var(--gray-900);
  color: var(--white);
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
  max-width: 240px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast--success { background: var(--green); }
.toast--error   { background: var(--red); }
.toast--saving  { background: var(--blue); }

/* ── Skeleton ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-wave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Bottom Sheet ────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
  display: none;
}
.sheet-backdrop.open { display: block; }
.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 301;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  max-height: 90dvh;
  overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--gray-300);
  border-radius: 99px;
  margin: .75rem auto .5rem;
}
.sheet-header {
  padding: .5rem 1rem .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-title { font-weight: 700; font-size: 1rem; }
.sheet-body { padding: 0 1rem 1.5rem; }

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue) 0%, #2d5be3 100%);
  padding: 1rem;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-logo { height: 52px; margin: 0 auto .75rem; }
.login-title { font-size: 1.25rem; font-weight: 700; color: var(--blue); }
.login-subtitle { font-size: .82rem; color: var(--gray-500); margin-top: .2rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-back { text-align: center; font-size: .82rem; margin-top: 1.25rem; color: var(--gray-500); }
.input-eye { position: relative; }
.input-eye .form-input { padding-right: 2.75rem; }
.eye-btn {
  position: absolute;
  right: .6rem; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  padding: .25rem;
  display: flex;
  align-items: center;
}
.eye-btn svg { width: 18px; height: 18px; }

/* ── Public student lookup ────────────────────────────────── */
.lookup-hero {
  background: linear-gradient(135deg, var(--blue) 0%, #2d5be3 100%);
  padding: 2rem 1rem 2.5rem;
  text-align: center;
  color: var(--white);
}
.lookup-hero__title { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.lookup-hero__sub { font-size: .85rem; opacity: .85; margin-bottom: 1.25rem; }
.lookup-form {
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  gap: .5rem;
}
.lookup-form .form-input {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.3);
  color: var(--white);
  text-align: center;
  letter-spacing: .08em;
  font-size: 1.1rem;
}
.lookup-form .form-input::placeholder { color: rgba(255,255,255,.6); }
.lookup-form .form-input:focus {
  background: rgba(255,255,255,.25);
  border-color: var(--white);
  box-shadow: none;
}

.student-info-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  margin: -1rem 1rem 0;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.student-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.student-info__name { font-weight: 700; font-size: 1rem; }
.student-info__meta { font-size: .8rem; color: var(--gray-500); }

/* Subject score card */
.score-subject-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.score-subject-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  cursor: pointer;
  gap: .5rem;
}
.score-subject-head:hover { background: var(--gray-50); }
.score-subject-info { flex: 1; min-width: 0; }
.score-subject-name { font-weight: 600; font-size: .95rem; }
.score-subject-code { font-size: .75rem; color: var(--gray-500); }
.score-subject-right {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.score-total { font-size: .9rem; font-weight: 600; color: var(--gray-700); }
.chevron {
  width: 16px; height: 16px;
  color: var(--gray-400);
  transition: transform .2s;
}
.score-subject-card.open .chevron { transform: rotate(180deg); }

.score-detail {
  display: none;
  border-top: 1px solid var(--gray-100);
}
.score-subject-card.open .score-detail { display: block; }
.score-type-group { }
.score-type-label {
  padding: .4rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  background: var(--gray-50);
}
.score-type-label.type-mid-work   { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }
.score-type-label.type-mid        { background: #fee2e2; color: #991b1b; border-left: 3px solid #ef4444; }
.score-type-label.type-final-work { background: #dcfce7; color: #166534; border-left: 3px solid #22c55e; }
.score-type-label.type-final      { background: #ffedd5; color: #9a3412; border-left: 3px solid #f97316; }
.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: .88rem;
}
.score-row:last-child { border-bottom: none; }
.score-row__name { color: var(--gray-700); flex: 1; }
.score-row__val {
  font-weight: 600;
  color: var(--gray-900);
  min-width: 64px;
  text-align: right;
}
.score-row__val .null { color: var(--gray-400); font-weight: 400; }
.score-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--blue-light);
  font-weight: 700;
}

/* ── Misc ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
}
.badge--blue   { background: var(--blue-light); color: var(--blue); }
.badge--green  { background: var(--green-light); color: var(--green); }
.badge--orange { background: #fff7ed; color: var(--orange); }
.badge--gray   { background: var(--gray-100); color: var(--gray-500); }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  padding: .3rem .7rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.chip.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto .75rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

.divider { height: 1px; background: var(--gray-200); margin: 1rem 0; }

/* ── Tablet (640px+) ─────────────────────────────────────── */
@media (min-width: 640px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 1.25rem 1.5rem calc(var(--nav-h) + 1rem); }
  .topbar__name { display: block; }
  .lookup-hero { padding: 3rem 1rem 3.5rem; }
  .lookup-hero__title { font-size: 1.6rem; }
  .student-info-card { margin: -1.25rem 1.5rem 0; }
}

/* ── Desktop (1024px+) ──────────────────────────────────── */
@media (min-width: 1024px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .page-content { padding: 1.5rem 2rem 2rem; }
  .subject-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar__menu-btn { display: flex; }
  .fab { bottom: 1.5rem; }
  .toast-wrap { right: 1.5rem; }
}
