:root {
  --ink: #14231C;
  --ink-soft: #55655C;
  --paper: #F1F4EF;
  --paper-raised: #FFFFFF;
  --growth: #2F6B4F;
  --growth-deep: #1F4A36;
  --flag: #C6772E;
  --watch: #8A7A5C;
  --line: #DAE1D9;
  --display: 'Fraunces', serif;
  --body: 'Inter', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--growth-deep); }
:focus-visible { outline: 2px solid var(--growth); outline-offset: 3px; }

.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px 24px;
}
.shell.wide { max-width: 880px; }

.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  margin-bottom: 40px;
}
.brand em {
  font-style: italic;
  font-weight: 400;
  color: var(--growth-deep);
}
.brand a { text-decoration: none; color: var(--ink); }

h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.subtitle { color: var(--ink-soft); font-size: 14.5px; margin-bottom: 32px; }

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-bottom: 6px;
  margin-top: 18px;
}
label:first-of-type { margin-top: 0; }

input, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--body);
  font-size: 14.5px;
  background: var(--paper-raised);
  color: var(--ink);
}
input:focus, select:focus { border-color: var(--growth); }

button, .btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 12px 20px;
  border-radius: 7px;
  font-size: 14.5px;
  font-weight: 500;
  font-family: var(--body);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
button:hover, .btn:hover { background: var(--growth-deep); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: var(--paper-raised);
  color: var(--growth-deep);
  border: 1.5px solid var(--growth);
}
.btn-secondary:hover { background: rgba(47, 107, 79, 0.06); }

.full { width: 100%; margin-top: 24px; }

.msg {
  font-size: 13.5px;
  padding: 11px 14px;
  border-radius: 7px;
  margin-top: 16px;
  display: none;
}
.msg.show { display: block; }
.msg.error { background: rgba(198, 119, 46, 0.1); color: var(--flag); }
.msg.success { background: rgba(47, 107, 79, 0.1); color: var(--growth-deep); }
.msg.info { background: rgba(138, 122, 92, 0.12); color: var(--watch); }

.footer-link { text-align: center; margin-top: 24px; font-size: 13.5px; color: var(--ink-soft); }

.badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  display: inline-block;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge.pending { background: rgba(198, 119, 46, 0.12); color: var(--flag); }
.badge.approved { background: rgba(47, 107, 79, 0.12); color: var(--growth); }
.badge.rejected { background: rgba(85, 101, 92, 0.12); color: var(--ink-soft); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; padding: 11px 10px; border-bottom: 1.5px solid var(--ink); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
tbody tr:hover { background: rgba(47, 107, 79, 0.035); }
tbody tr:last-child td { border-bottom: none; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 24px; margin-bottom: 32px; border-bottom: 1px solid var(--line);
}
.topbar .brand { margin-bottom: 0; }

.section { margin-top: 40px; }
.section h2 { font-family: var(--display); font-weight: 500; font-size: 19px; margin-bottom: 16px; }

.code-display {
  font-family: var(--mono);
  font-size: 15px;
  background: rgba(47, 107, 79, 0.08);
  color: var(--growth-deep);
  padding: 8px 14px;
  border-radius: 6px;
  display: inline-block;
  letter-spacing: 0.03em;
}

/* ---------- App shell: sidebar + main (admin/teacher dashboards) ---------- */
.app-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 860px) { .app-shell { grid-template-columns: 1fr; } }

.app-sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(241,244,239,0.06);
}
@media (max-width: 860px) { .app-sidebar { position: relative; height: auto; } }
.app-sidebar .brand {
  color: var(--paper);
  font-size: 20px;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.app-sidebar .brand em { color: #7FBF9E; }
.app-org { font-family: var(--mono); font-size: 11px; color: rgba(241,244,239,0.55); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 36px; word-break: break-word; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-nav-btn {
  text-align: left; background: transparent; border: none; color: rgba(241,244,239,0.65);
  font-family: var(--body); font-size: 14px; font-weight: 500; padding: 11px 12px;
  border-radius: 7px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.side-nav-btn:hover { background: rgba(241,244,239,0.06); color: var(--paper); }
.side-nav-btn.active { background: rgba(47,107,79,0.35); color: var(--paper); }

.app-sidebar .sign-out-btn {
  background: transparent; border: 1px solid rgba(241,244,239,0.2); color: rgba(241,244,239,0.75);
  font-size: 13px; padding: 10px 14px; border-radius: 7px; cursor: pointer; margin-top: 20px;
}
.app-sidebar .sign-out-btn:hover { border-color: rgba(241,244,239,0.4); color: var(--paper); background: transparent; }

/* ---------- Sidebar collapse ---------- */
.app-shell { transition: grid-template-columns 0.2s ease; }
.app-shell.collapsed { grid-template-columns: 72px 1fr; }

.sidebar-top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sidebar-toggle {
  background: transparent; border: 1px solid rgba(241,244,239,0.2); color: rgba(241,244,239,0.75);
  width: 28px; height: 28px; min-width: 28px; border-radius: 6px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.sidebar-toggle:hover { border-color: rgba(241,244,239,0.4); color: var(--paper); background: transparent; }

.app-shell.collapsed .app-sidebar { padding: 28px 12px; align-items: center; }
.app-shell.collapsed .app-org { display: none; }
.app-shell.collapsed .brand-full { display: none; }
.app-shell.collapsed .brand-short { display: inline; }
.app-shell.collapsed .side-nav-btn,
.app-shell.collapsed .sign-out-btn { text-align: center; padding: 11px 4px; }
.app-shell.collapsed .side-nav { align-items: center; }
.app-shell.collapsed .sidebar-top-row { justify-content: center; }

.brand-short { display: none; }

.app-main {
  padding: 42px 46px 60px;
  max-width: 1180px;
  width: 100%;
}
@media (max-width: 640px) {
  .app-main {
    padding: 28px 18px 44px;
  }
}

.page-head { margin-bottom: 28px; }
.page-eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
.page-title { font-family: var(--display); font-weight: 500; font-size: 24px; letter-spacing: -0.01em; }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 32px; }
.stat-cell { background: var(--paper-raised); padding: 18px 20px; }
.stat-num { font-family: var(--display); font-weight: 500; font-size: 26px; color: var(--ink); line-height: 1.1; }
.stat-label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-top: 6px; }

.panel-card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20,35,28,0.04);
}
.panel-card-pad { padding: 26px; }
.panel-head { font-family: var(--display); font-weight: 500; font-size: 16px; margin-bottom: 4px; }
.panel-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }

/* ---------- Auth pages (login / signup / redeem) ---------- */
body.auth-page {
  background: var(--paper) url('books.jpg') no-repeat right center;
  background-size: auto 100%;
  /* Locks the image to the viewport instead of the full scrollable page.
     Without this, background-size: auto 100% scales against each page's
     own height, so a page with more form fields (taller) renders the
     same image bigger/more zoomed than a short page. Fixed attachment
     keeps every auth page showing the same crop of the image. */
  background-attachment: fixed;
  min-height: 100vh;
}

body.auth-page .shell {
  max-width: 420px;
  margin: 0;
  margin-left: max(24px, calc(50% - 480px));
  padding: 48px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Remove the white card look */
body.auth-page .card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

body.auth-page .brand {
  margin-bottom: 28px;
}

body.auth-page .back-home {
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
}
body.auth-page .back-home:hover {
  color: var(--growth-deep);
}

/* On smaller screens, hide the books so the form stays clean */
@media (max-width: 900px) {
  body.auth-page {
    background-image: none;
  }
  body.auth-page .shell {
    margin: 0 auto;
    max-width: 420px;
  }
}

/* =========================================================
   Skrunt — ADMIN UI REFINEMENT
   ========================================================= */

/* ---------- Sidebar navigation ---------- */

.nav-section-label {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(241,244,239,0.34);
  padding: 0 12px;
  margin: 0 0 7px;
}

.people-label {
  margin-top: 27px;
}

.side-nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 7px;
  position: relative;
}

.side-nav-btn .nav-icon {
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(241,244,239,0.48);
  border: 1px solid rgba(241,244,239,0.12);
  border-radius: 5px;
}

.side-nav-btn .nav-text {
  display: inline-block;
}

.side-nav-btn.active .nav-icon {
  color: #A9D3BA;
  border-color: rgba(127,191,158,0.3);
  background: rgba(127,191,158,0.08);
}

.side-nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: #7FBF9E;
}

.app-shell.collapsed .nav-section-label {
  display: none;
}

.app-shell.collapsed .side-nav-btn {
  justify-content: center;
  gap: 0;
}

.app-shell.collapsed .side-nav-btn .nav-text {
  display: none;
}

.app-shell.collapsed .side-nav-btn .nav-icon {
  display: flex;
}

.app-shell.collapsed .side-nav-btn.active::before {
  left: -1px;
}

/* ---------- Dashboard welcome ---------- */

.dashboard-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.dashboard-welcome .page-head {
  margin-bottom: 0;
}

.dashboard-subtitle {
  color: var(--ink-soft);
  font-size: 14px;
  margin-top: 6px;
}

.dashboard-date {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 5px;
}

.date-dot {
  width: 6px;
  height: 6px;
  background: var(--growth);
  border-radius: 50%;
}

/* ---------- Statistics ---------- */

.stat-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  box-shadow: 0 1px 2px rgba(20,35,28,0.03);
}

.stat-cell {
  padding: 17px 18px 16px;
  min-height: 112px;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 13px;
}

.stat-top .stat-label {
  margin: 0;
}

.stat-symbol {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
}

.stat-num {
  font-size: 28px;
}

.stat-note {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 5px;
}

@media (max-width: 900px) {
  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .stat-strip {
    grid-template-columns: 1fr;
  }
}

.stat-strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-strip-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3col { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 700px) {
  .stat-strip-3, .stat-strip-4, .grid-3col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .stat-strip-3, .stat-strip-4, .grid-3col { grid-template-columns: 1fr; }
}

/* ---------- Quick actions ---------- */

.quick-actions {
  margin-bottom: 32px;
}

.quick-actions-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.section-kicker,
.card-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.quick-actions-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
  margin-top: 3px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px 1fr 20px;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: var(--paper-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(20,35,28,0.025);
}

.quick-action:hover {
  background: var(--paper-raised);
  border-color: #BFCBC1;
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20,35,28,0.06);
}

.quick-action-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(47,107,79,0.07);
  color: var(--growth-deep);
  font-family: var(--mono);
  font-size: 14px;
}

.quick-action strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.quick-action small {
  display: block;
  color: var(--ink-soft);
  font-size: 11.5px;
  margin-top: 2px;
  font-weight: 400;
}

.quick-arrow {
  color: var(--ink-soft);
  font-size: 15px;
  transition: transform 0.15s ease;
}

.quick-action:hover .quick-arrow {
  transform: translateX(3px);
}

@media (max-width: 760px) {
  .quick-actions-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Cards ---------- */

.panel-card {
  box-shadow: 0 1px 2px rgba(20,35,28,0.025);
}

.panel-card-pad {
  padding: 25px;
}

.card-eyebrow {
  margin-bottom: 5px;
}

.panel-head {
  font-size: 17px;
}

.panel-sub {
  line-height: 1.55;
}

/* ---------- Card headers ---------- */

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.compact-btn {
  padding: 7px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.count-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 3px 7px;
  border-radius: 20px;
}

/* ---------- Form polish ---------- */

.student-add-card input,
.student-add-card select {
  background: #FCFDFC;
}

.student-add-card input:hover,
.student-add-card select:hover {
  border-color: #C6D0C8;
}

.student-add-card input:focus,
.student-add-card select:focus {
  box-shadow: 0 0 0 3px rgba(47,107,79,0.08);
}

/* ---------- Tables ---------- */

table {
  font-size: 13px;
}

th {
  padding-top: 10px;
  padding-bottom: 10px;
  color: #6A776F;
}

td {
  padding: 13px 10px;
}

tbody tr {
  transition: background 0.12s ease;
}

/* ---------- Responsive dashboard ---------- */

@media (max-width: 760px) {
  .dashboard-welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .dashboard-date {
    padding-bottom: 0;
  }

  .two-col {
    gap: 16px;
  }
}

/* =========================================================
   Skrunt — PART 2: STUDENTS / ROSTER
   ========================================================= */

/* ---------- Students page header ---------- */

.students-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.students-page-title {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.students-page-subtitle {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin-top: 7px;
}

.students-page-action {
  flex-shrink: 0;
}

.students-page-action button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  font-size: 13px;
}

/* ---------- Student directory ---------- */

.students-directory {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 1px 2px rgba(20,35,28,0.025);
  overflow: hidden;
}

.students-directory-head {
  padding: 21px 22px 18px;
  border-bottom: 1px solid var(--line);
}

.students-directory-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.students-directory-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}

.students-directory-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 20px;
}

/* ---------- Search / filters ---------- */

.students-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
}

.student-search {
  position: relative;
}

.student-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
  pointer-events: none;
}

.student-search input {
  padding-left: 36px;
  height: 40px;
  background: #FCFDFC;
}

.students-toolbar select {
  height: 40px;
  background: #FCFDFC;
}

/* ---------- Results meta ---------- */

.students-results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
}

.students-results-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.students-clear-filter {
  border: none;
  background: transparent;
  color: var(--growth-deep);
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}

.students-clear-filter:hover {
  background: transparent;
  color: var(--growth);
}

/* ---------- Student table ---------- */

.students-table-wrap {
  overflow-x: auto;
}

.students-table {
  width: 100%;
  min-width: 570px;
  border-collapse: collapse;
}

.students-table th {
  padding: 10px 22px;
  background: #FBFCFB;
  border-bottom: 1px solid var(--line);
  border-top: none;
  font-family: var(--mono);
  font-size: 10px;
  color: #6A776F;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

.students-table td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.students-table tbody tr {
  transition: background 0.12s ease;
}

.students-table tbody tr:hover {
  background: rgba(47,107,79,0.035);
}

.students-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Student identity ---------- */

.student-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.student-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(47,107,79,0.09);
  color: var(--growth-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
}

.student-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.student-meta {
  color: var(--ink-soft);
  font-size: 11px;
  margin-top: 2px;
}

/* ---------- Class cell ---------- */

.student-class {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* ---------- Parent contact ---------- */

.student-contact {
  color: var(--ink-soft);
  font-size: 12.5px;
}

/* ---------- Empty state ---------- */

.students-empty {
  padding: 58px 24px 64px;
  text-align: center;
}

.students-empty-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--growth-deep);
  background: rgba(47,107,79,0.045);
  font-family: var(--mono);
  font-size: 15px;
}

.students-empty-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}

.students-empty-text {
  max-width: 360px;
  margin: 6px auto 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.students-empty button {
  font-size: 12.5px;
  padding: 9px 14px;
}

/* ---------- Add student modal ---------- */

.student-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(20,35,28,0.42);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.student-modal.show {
  display: flex;
}

.student-modal-card {
  width: 100%;
  max-width: 470px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 20px 60px rgba(20,35,28,0.18);
}

.student-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.student-modal-kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 5px;
}

.student-modal-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 500;
}

.student-modal-subtitle {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-top: 4px;
}

.student-modal-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  font-size: 18px;
  line-height: 1;
}

.student-modal-close:hover {
  background: var(--paper);
  color: var(--ink);
}

.student-modal-body {
  padding: 22px 24px 24px;
}

.student-modal-body label {
  margin-top: 17px;
}

.student-modal-body label:first-of-type {
  margin-top: 0;
}

.student-modal-body input,
.student-modal-body select {
  height: 42px;
}

.student-form-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 17px;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.45;
}

.student-form-note span:first-child {
  color: var(--growth);
  font-family: var(--mono);
}

.student-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.student-modal-actions button {
  width: auto;
  margin-top: 0;
}

.student-modal-actions .btn-secondary {
  border-width: 1px;
}

/* ---------- Loading ---------- */

.students-loading {
  padding: 30px 22px;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
  .students-page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .students-page-action {
    width: 100%;
    flex-direction: column;
  }

  .students-page-action button {
    width: 100%;
    justify-content: center;
  }

  .students-toolbar {
    grid-template-columns: 1fr;
  }

  .students-directory-head {
    padding: 18px 16px 16px;
  }

  .students-results-meta {
    padding-left: 16px;
    padding-right: 16px;
  }

  .students-table {
    min-width: 520px;
  }

  .students-table th,
  .students-table td {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 480px) {
  .students-page-title {
    font-size: 27px;
  }

  .student-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .student-modal-card {
    max-height: calc(100vh - 20px);
    border-radius: 13px 13px 10px 10px;
  }

  .student-modal-head,
  .student-modal-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .student-modal-actions {
    flex-direction: column-reverse;
  }

  .student-modal-actions button {
    width: 100%;
  }
}


/* ---------- Student profile modal (admin/teacher drill-down) ---------- */
.profile-modal-card {
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 20px 60px rgba(20,35,28,0.18);
}
.profile-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 22px 24px 0;
}
.profile-modal-close {
  width: 30px; height: 30px; min-width: 30px; padding: 0;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 7px; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.profile-modal-close:hover { background: var(--paper); color: var(--ink); }
.profile-modal-body { padding: 4px 24px 26px; }

.profile-header { padding-top: 6px; }
.profile-name { font-family: var(--display); font-weight: 500; font-size: 21px; }
.profile-meta { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.profile-scope-note { font-family: var(--mono); font-size: 11px; }

.profile-subject-grid { grid-template-columns: 1fr; }

.view-profile-btn {
  background: transparent; border: 1px solid var(--line); color: var(--growth-deep);
  font-family: var(--mono); font-size: 11px; padding: 4px 10px; border-radius: 20px;
  cursor: pointer;
}
.view-profile-btn:hover { background: rgba(47,107,79,0.06); border-color: var(--growth); }

/* Subject cards + topic drill-down — shared visual language with
   parent.html so staff see the same thing a parent would. */
.subject-card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 12px; }
.subject-card.is-flagged { border-color: rgba(198,119,46,0.35); }
.subject-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; gap: 10px; }
.subject-name { font-family: var(--display); font-weight: 500; font-size: 16px; }
.badge-flag { font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(198,119,46,0.12); color: var(--flag); white-space: nowrap; }
.badge-watch { font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(138,122,92,0.14); color: var(--watch); white-space: nowrap; }
.badge-good { font-family: var(--mono); font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(47,107,79,0.12); color: var(--growth); white-space: nowrap; }
.spark-mini { width: 100%; height: 40px; margin-bottom: 10px; }
.subject-diagnosis { font-size: 13.5px; margin-bottom: 5px; }
.subject-action { font-size: 12.5px; color: var(--growth-deep); font-weight: 500; margin-bottom: 4px; }
.subject-volatility-note { font-size: 11.5px; color: var(--watch); margin-bottom: 10px; }
.subject-history { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); border-top: 1px solid var(--line); padding-top: 9px; margin-top: 9px; }

.topic-toggle {
  background: transparent; border: none; padding: 0; margin-top: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--growth-deep);
  cursor: pointer; display: flex; align-items: center; gap: 5px;
}
.topic-toggle:hover { background: transparent; color: var(--growth); }
.topic-toggle .chevron { transition: transform 0.15s ease; }
.topic-toggle.open .chevron { transform: rotate(180deg); }
.topic-panel { display: none; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.topic-panel.open { display: block; }
.topic-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.topic-row:last-child { border-bottom: none; }
.topic-row-name { font-size: 12.5px; font-weight: 500; }
.topic-row-note { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.topic-row-pct { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; flex-shrink: 0; }
.topic-empty { font-size: 12px; color: var(--ink-soft); padding: 4px 0; }


/* ---------- Score history: grouped assessments ---------- */
.score-history-toolbar.students-toolbar {
  grid-template-columns: minmax(0,1fr) 150px 170px 150px;
  margin-top: 18px;
}
@media (max-width: 760px) {
  .score-history-toolbar.students-toolbar { grid-template-columns: 1fr; }
}

.score-history-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 12px;
}

.score-group-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.score-group {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #FCFDFC;
  overflow: hidden;
}

.score-group-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--paper-raised);
}
.score-group-head:hover { background: rgba(47,107,79,0.03); }

.score-group-main { flex: 1; min-width: 180px; }
.score-group-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.score-group-sub {
  font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin-top: 3px;
}

.score-group-stats { display: flex; gap: 8px; flex-shrink: 0; }
.score-stat-pill {
  font-family: var(--mono); font-size: 11px; padding: 4px 9px; border-radius: 20px;
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-soft); white-space: nowrap;
}
.score-stat-pill.avg {
  color: var(--growth-deep); border-color: rgba(47,107,79,0.25); background: rgba(47,107,79,0.06);
}

.score-group-count {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--line); padding: 3px 8px; border-radius: 20px;
  flex-shrink: 0;
}

.score-group-chevron {
  font-family: var(--mono); font-size: 11px; color: var(--ink-soft);
  transition: transform 0.15s ease; flex-shrink: 0;
}
.score-group.open .score-group-chevron { transform: rotate(180deg); }

.score-group-body { display: none; border-top: 1px solid var(--line); }
.score-group.open .score-group-body { display: block; }
.score-group-body table { width: 100%; border-collapse: collapse; }
.score-group-body th {
  padding: 8px 16px; font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: #6A776F; border-bottom: 1px solid var(--line); text-align: left;
}
.score-group-body td { padding: 9px 16px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.score-group-body tbody tr:last-child td { border-bottom: none; }


/* ---------- Import: category picker for senior students ---------- */
.import-student-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 2px 0;
}
.import-category-picker {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.import-category-warning {
  font-size: 11px; color: var(--flag); font-family: var(--mono); white-space: nowrap;
}
.imp-student-category { width: 150px; padding: 6px 8px; font-size: 12.5px; }

/* ---------- Score history: inline edit ---------- */
.score-edit-input { width: 70px; padding: 4px 6px; font-size: 12.5px; }

/* ---------- AI study tip (topic-level, on-demand) ---------- */
.ai-tip-btn {
  background: transparent; border: 1px solid rgba(47,107,79,0.35); color: var(--growth-deep);
  font-family: var(--mono); font-size: 10.5px; padding: 3px 9px; border-radius: 20px;
  cursor: pointer; margin-top: 6px;
}
.ai-tip-btn:hover { background: rgba(47,107,79,0.06); }
.ai-tip-btn:disabled { opacity: 0.6; cursor: default; }
.ai-tip-box {
  margin-top: 8px; padding: 10px 12px; background: rgba(47,107,79,0.05);
  border: 1px solid rgba(47,107,79,0.15); border-radius: 8px;
  font-size: 12.5px; color: var(--ink); line-height: 1.5;
}

/* ---------- Term-over-term delta badge (parent view) ---------- */
.term-delta-badge {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  padding: 3px 9px; border-radius: 20px; margin-bottom: 10px;
}
.term-delta-badge.up { background: rgba(47,107,79,0.1); color: var(--growth-deep); }
.term-delta-badge.down { background: rgba(198,119,46,0.1); color: var(--flag); }
.term-delta-badge.flat { background: rgba(85,101,92,0.08); color: var(--ink-soft); }

/* ---------- Skro chat widget ---------- */
#skroWidget { position: fixed; bottom: 22px; right: 22px; z-index: 1500; font-family: var(--body); }
#skroToggleBtn {
  width: 54px; height: 54px; border-radius: 50%; background: var(--growth-deep); color: #fff;
  border: none; font-size: 22px; cursor: pointer; box-shadow: 0 6px 18px rgba(20,35,28,0.25);
  display: flex; align-items: center; justify-content: center;
}
#skroToggleBtn:hover { background: var(--growth); }

@keyframes skro-pulse {
  0%, 80%, 100% { box-shadow: 0 6px 18px rgba(20,35,28,0.25), 0 0 0 0 rgba(47,107,79,0.4); }
  90% { box-shadow: 0 6px 18px rgba(20,35,28,0.25), 0 0 0 8px rgba(47,107,79,0); }
}
#skroToggleBtn { animation: skro-pulse 10s ease-in-out infinite; }

#skroNudge {
  position: absolute;
  bottom: 66px;
  right: 0;
  width: 210px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 10px 30px rgba(20,35,28,0.25);
  display: none;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#skroNudge.show { opacity: 1; transform: translateY(0); }
#skroNudge::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 22px;
  width: 12px; height: 12px;
  background: var(--ink);
  transform: rotate(45deg);
}
#skroNudgeClose {
  background: transparent; border: none; color: rgba(241,244,239,0.6);
  font-size: 14px; line-height: 1; padding: 0; margin-left: auto; cursor: pointer;
}
#skroNudgeClose:hover { background: transparent; color: #fff; }

#skroPanel {
  position: absolute; bottom: 66px; right: 0; width: 340px; max-width: calc(100vw - 40px);
  height: 460px; max-height: calc(100vh - 120px);
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(20,35,28,0.2); display: flex; flex-direction: column; overflow: hidden;
}
#skroPanelHead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 16px 14px; border-bottom: 1px solid var(--line); background: var(--ink); color: var(--paper);
}
#skroPanelName { font-family: var(--display); font-weight: 500; font-size: 16px; }
#skroPanelSub { font-size: 11.5px; color: rgba(241,244,239,0.65); margin-top: 2px; }
#skroCloseBtn {
  width: 26px; height: 26px; min-width: 26px; padding: 0; border: 1px solid rgba(241,244,239,0.25);
  background: transparent; color: rgba(241,244,239,0.8); border-radius: 6px; font-size: 16px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
#skroCloseBtn:hover { background: rgba(241,244,239,0.1); color: #fff; }
#skroClearBtn {
  width: 26px; height: 26px; min-width: 26px; padding: 0; border: 1px solid rgba(241,244,239,0.25);
  background: transparent; color: rgba(241,244,239,0.8); border-radius: 6px; font-size: 13px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
#skroClearBtn:hover { background: rgba(241,244,239,0.1); color: #fff; }
#skroClearBtn:disabled { opacity: 0.5; cursor: default; }
#skroMessages { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; }
.skro-bubble { max-width: 84%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.skro-bubble.bot { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 3px; }
.skro-bubble.user { align-self: flex-end; background: var(--growth-deep); color: #fff; border-bottom-right-radius: 3px; }
.skro-typing { opacity: 0.6; font-style: italic; }
#skroInputRow { display: flex; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
#skroInput { flex: 1; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
#skroInput:focus { border-color: var(--growth); outline: none; }
#skroSendBtn { height: 38px; padding: 0 16px; font-size: 13px; }
@media (max-width: 480px) {
  #skroPanel { width: calc(100vw - 32px); right: -6px; }
}

/* ---------- Generic auth modal (forgot password) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(20, 35, 28, 0.48);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 20px 60px rgba(20, 35, 28, 0.18);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
}

.modal-kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 5px;
}

.modal-title {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 500;
  margin: 0;
  color: var(--ink);
}

.modal-close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  border-radius: 7px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.modal-close:hover {
  background: var(--paper);
  color: var(--ink);
}

.modal-body {
  padding: 18px 24px 24px;
}

.modal-lead {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 18px;
}

.modal-body label {
  margin-top: 0;
}

.modal-body input {
  height: 42px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  margin-top: 0;
}

.modal-actions .btn-secondary {
  border-width: 1.5px;
}

.modal-body .msg {
  margin-top: 14px;
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 16px;
  }
  .modal-card {
    border-radius: 13px;
  }
}

/* =========================================================
   Skrunt — MOBILE PASS
   ========================================================= */

/* Sidebar nav as one button per line eats the whole screen height
   on a phone before you even reach page content. Wrap it into pills
   instead, and always keep Sign out reachable. */
@media (max-width: 860px) {
  .app-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 14px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(241,244,239,0.08);
  }
  .sidebar-top-row { margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
  .sidebar-toggle { display: none; } /* collapse toggle is desktop-only */
  .app-org { display: none; } /* saves a row — the page title already says who you are */

  .side-nav {
    order: 3;
    flex: 1 1 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .nav-section-label { display: none; }
  .side-nav-btn { flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; min-height: 36px; }

  .app-sidebar .sign-out-btn {
    order: 2;
    width: auto;
    margin-top: 0;
    padding: 8px 12px;
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* Badges/tags are deliberately non-wrapping (white-space: nowrap) so
   the text inside them never breaks awkwardly — but that means the
   row they sit in can get forced wider than the phone screen instead.
   Letting the row wrap keeps each pill intact and just drops it to
   its own line. */
.subject-top,
.card-header-row,
.import-student-row {
  flex-wrap: wrap;
}

/* Multi-field rows (assessment type / week / max score, class /
   subject) get cramped side-by-side on a phone — stack them. */
@media (max-width: 600px) {
  .inline-field { flex-direction: column; gap: 0; }
}