/* =============================================================
   Dashboard styles
   Scope: app/dashboard/* (loaded by app/dashboard/layout.tsx)
   ============================================================= */

.dashboard {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF0FF 100%);
  min-height: 100vh;
  color: #0F172A;
}

/* ---------- Login page ---------- */
.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}
.login__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: 0 22px 50px -32px rgba(99, 102, 241, 0.4);
}
.login__title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.login__sub {
  color: #64748B;
  margin: 0 0 24px;
  font-size: 0.95rem;
}
.login__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login__field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}
.login__field input {
  font: inherit;
  font-size: 0.95rem;
  padding: 11px 14px;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: #fff;
  color: #0F172A;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.login__field input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.login__error {
  color: #B91C1C;
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  margin: 0;
}
.login__submit {
  font: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  padding: 12px 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #fff;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.login__submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.login__submit:disabled {
  opacity: 0.6;
  cursor: progress;
}
.login__hint {
  margin: 22px 0 0;
  font-size: 0.82rem;
  color: #64748B;
  line-height: 1.55;
}
.login__hint code {
  background: #F1F5F9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ---------- Post-login dashboard ---------- */
.dash-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.dash-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.dash-header__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.dash-header h1 {
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 0;
}
.dash-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6366F1;
  margin: 0;
}
.dash-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 22px 24px;
  margin: 16px 0;
  box-shadow: 0 8px 22px -18px rgba(15, 23, 42, 0.18);
}
.dash-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 12px;
}
.dash-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
}
.dash-grid dt {
  font-weight: 600;
  color: #475569;
}
.dash-grid dd {
  margin: 0;
  color: #0F172A;
}
.dash-grid code {
  background: #F1F5F9;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.92em;
}
.dash-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #fff;
  cursor: pointer;
}
.dash-btn--ghost {
  background: #fff;
  color: #334155;
  border: 1px solid #CBD5E1;
}
.dash-btn--ghost:hover {
  border-color: #6366F1;
  color: #4F46E5;
}
.dash-btn--danger {
  background: #fff;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}
.dash-btn--danger:hover:not(:disabled) {
  background: #FEF2F2;
  border-color: #EF4444;
}

/* EV3 manager: editor + delete row */
.ev3-editor { display: grid; gap: 14px; }
.ev3-delete {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #E2E8F0;
}

.ev3-hint { font-size: 0.8rem; color: #64748B; margin: 0; }

.ev3-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ev3-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  background: #fff;
}
.ev3-row__handle { margin-top: 4px; }
.ev3-row__code { margin-top: 2px; }
.ev3-row--active { border-color: #6366F1; background: #EEF2FF; }
.ev3-row--dragging { opacity: 0.5; }
.ev3-row__handle { cursor: grab; color: #94A3B8; user-select: none; }
.ev3-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: #0F172A;
  padding: 2px;
}
.ev3-row__code {
  font-size: 0.72rem;
  background: #F1F5F9;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ev3-row__title {
  font-size: 0.88rem;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.35;
}
.ev3-row__arrows { display: inline-flex; gap: 2px; flex-shrink: 0; }
.ev3-row__arrows button {
  font: inherit;
  width: 24px;
  height: 24px;
  border: 1px solid #E2E8F0;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
}
.ev3-row__arrows button:hover:not(:disabled) { border-color: #6366F1; color: #4F46E5; }
.ev3-row__arrows button:disabled { opacity: 0.4; cursor: default; }

.ev3-place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
}
.ev3-place__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94A3B8;
  font-weight: 700;
}
.ev3-place__value { font-weight: 600; font-size: 0.92rem; }
.ev3-place__move {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}
.ev3-place__move select {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
}

.ev3-place__current { display: grid; gap: 2px; }
.ev3-place__controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}
.ev3-place__field {
  display: grid;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
}
.ev3-place__field select {
  font: 600 0.9rem / 1 inherit;
  text-transform: none;
  letter-spacing: 0;
  color: #0F172A;
  padding: 7px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  max-width: 260px;
}
.ev3-hint--warn {
  color: #B45309;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 6px 10px;
}
.dash-link {
  color: #4F46E5;
  text-decoration: none;
}
.dash-link:hover { text-decoration: underline; }

/* ---------- Loading state (dashboard variant) ---------- */
.dash-card--loading {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #64748B;
}
.dash-card--loading .page-loading__spinner {
  width: 28px;
  height: 28px;
  border-width: 2.5px;
  border-color: #E2E8F0;
  border-top-color: #6366F1;
}

/* ---------- Manager cards (schools / users) ---------- */
.dash-section {
  margin-top: 28px;
}
.dash-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.dash-section__lede {
  color: #64748B;
  margin: 0 0 16px;
  font-size: 0.95rem;
}

/* List of created items (schools, users) */
.dash-list {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}
.dash-list__item {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.92rem;
}
.dash-list__item:last-child { border-bottom: 0; }
.dash-list__item code {
  background: #F1F5F9;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}
.dash-list__head {
  background: #F8FAFC;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 1px solid #E2E8F0;
}
.dash-list__empty {
  padding: 22px;
  text-align: center;
  color: #94A3B8;
  font-style: italic;
}
.dash-list__role {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
}
.dash-list__role--admin   { background: #FEF3C7; color: #92400E; }
.dash-list__role--teacher { background: #DBEAFE; color: #1E40AF; }
.dash-list__role--student { background: #DCFCE7; color: #166534; }

/* Inline forms ("create school", "create user") */
.dash-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 18px;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 12px;
}
.dash-form__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 12px;
}
.dash-form__row label {
  font-weight: 600;
  color: #334155;
  font-size: 0.9rem;
}
.dash-form input,
.dash-form select {
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  color: #0F172A;
  width: 100%;
}
.dash-form input:focus,
.dash-form select:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.dash-form__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.dash-form__error {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #B91C1C;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin: 0;
}
.dash-form__ok {
  background: #DCFCE7;
  border: 1px solid #86EFAC;
  color: #166534;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin: 0;
}

@media (max-width: 720px) {
  .dash-list__item { grid-template-columns: 1fr; gap: 4px; padding: 14px 16px; }
  .dash-form__row  { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   Sidebar + content shell (post-restructure)
   ============================================================ */

.dash-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.dash-shell--no-sidebar { grid-template-columns: 1fr; }

.dash-content {
  min-width: 0;
  background: #F8FAFC;
}

.dash-sidebar {
  background: #fff;
  border-right: 1px solid #E2E8F0;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
}
.dash-sidebar__brand a {
  font-weight: 800;
  font-size: 1rem;
  color: #0F172A;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.dash-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
}
.dash-sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #475569;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background .12s ease, color .12s ease;
}
.dash-sidebar__link:hover {
  background: #F1F5F9;
  color: #0F172A;
  text-decoration: none;
}
.dash-sidebar__link--active {
  background: #EEF0FF;
  color: #4F46E5;
}
.dash-sidebar__link--active:hover {
  background: #E0E7FF;
  color: #4338CA;
}

/* Inline spinner shown by <LinkSpinner> while a sidebar nav transitions */
.link-spin {
  margin-left: auto;
  color: #4F46E5;
  width: 12px;
  height: 12px;
  border-width: 2px;
}

.dash-sidebar__footer {
  border-top: 1px solid #F1F5F9;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dash-sidebar__user {
  font-size: 0.85rem;
}
.dash-sidebar__name {
  font-weight: 700;
  color: #0F172A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-sidebar__role {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 2px;
}
.dash-sidebar__signout {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.dash-sidebar__signout:hover {
  border-color: #6366F1;
  color: #4F46E5;
}

@media (max-width: 880px) {
  .dash-shell { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
  .dash-sidebar__brand   { flex: 1 1 100%; }
  .dash-sidebar__nav     { flex-direction: row; flex-wrap: wrap; overflow: visible; margin: 0; }
  .dash-sidebar__footer  { flex: 1 1 100%; flex-direction: row; align-items: center; padding-top: 8px; }
  .dash-sidebar__user    { flex: 1; }
}

/* ============================================================
   Users table: per-row actions + search + pagination
   ============================================================ */

.dash-list__item--user {
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 14px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.user-actions__btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 11px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.user-actions__btn:hover:not(:disabled) {
  border-color: #6366F1;
  color: #4F46E5;
}
.user-actions__btn:disabled,
.user-actions__btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  display: inline-block;
}
.user-actions__btn--primary {
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #fff;
  border-color: transparent;
}
.user-actions__btn--primary:hover:not(:disabled) {
  color: #fff;
  filter: brightness(1.07);
}
.user-actions__btn--danger {
  border-color: #FCA5A5;
  color: #B91C1C;
  background: #FEF2F2;
}
.user-actions__btn--danger:hover:not(:disabled) {
  background: #B91C1C;
  color: #fff;
  border-color: #B91C1C;
}
.user-actions__inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.user-actions__inline-text {
  font-size: 0.82rem;
  color: #334155;
}
.user-actions__toast {
  font-size: 0.78rem;
  color: #166534;
  margin-left: 6px;
}
.user-actions__toast--err { color: #B91C1C; }

.dash-search {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}
.dash-search__input {
  flex: 1;
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  color: #0F172A;
}
.dash-search__input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.dash-search__btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  color: #fff;
  cursor: pointer;
}
.dash-search__clear {
  font-size: 0.85rem;
  color: #64748B;
  text-decoration: none;
}
.dash-search__clear:hover { color: #4F46E5; text-decoration: underline; }

.dash-pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.dash-pagination__info {
  font-size: 0.85rem;
  color: #64748B;
}
.dash-pagination__btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.dash-pagination__btn:hover:not(.dash-pagination__btn--disabled) {
  border-color: #6366F1;
  color: #4F46E5;
}
.dash-pagination__btn--disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================================================
   Dialogs (HTML5 <dialog>)
   ============================================================ */

.dash-dialog {
  border: 0;
  padding: 0;
  border-radius: 16px;
  box-shadow: 0 22px 52px -20px rgba(15, 23, 42, 0.45);
  max-width: 520px;
  width: 92vw;
}
.dash-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.dash-dialog__form {
  padding: 24px;
  display: grid;
  gap: 14px;
}
.dash-dialog__form h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.dash-dialog__sub {
  margin: 0;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.5;
}
.dash-dialog__sub code {
  background: #F1F5F9;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 0.92em;
}
.dash-dialog__phrase {
  font: inherit;
  font-size: 0.95rem;
  padding: 11px 14px;
  border: 2px solid #FCA5A5;
  border-radius: 10px;
  background: #fff;
}
.dash-dialog__phrase:focus {
  outline: none;
  border-color: #B91C1C;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.18);
}
.dash-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.dash-dialog--danger h3 { color: #B91C1C; }

/* link list on the account page */
.dash-link-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.dash-link-list li { padding: 2px 0; }

/* ============================================================
   Login page — back-to-home link
   ============================================================ */
.login__back {
  display: inline-block;
  margin: 18px 0 0;
  font-size: 0.88rem;
  color: #4F46E5;
  text-decoration: none;
  font-weight: 600;
}
.login__back:hover { text-decoration: underline; }

/* ============================================================
   Progress grid (student "My progress" + teacher "Approvals")
   ============================================================ */

.progress { display: grid; gap: 24px; margin-top: 16px; }

.progress__course-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}
/* Second-tier (level) nav sits tighter under the course nav. */
.progress__level-nav {
  margin: -6px 0 16px;
}
.progress__level-nav .progress__course-tab {
  font-size: 0.82rem;
  padding: 5px 12px;
}
.progress__course-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
}
.progress__course-tab:hover {
  border-color: #6366F1;
  color: #4F46E5;
  text-decoration: none;
}
.progress__course-tab--active {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #fff;
}
.progress__course-tab--active:hover { color: #fff; }

.progress__course { display: grid; gap: 18px; }
.progress__level { display: grid; gap: 8px; }
.progress__course-name {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475569;
  margin: 0 0 4px;
}

.progress__table {
  display: grid;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.progress__row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.9rem;
}
.progress__row:last-child { border-bottom: 0; }
/* Robotics courses (EV3 / Advasbot) add a 4th phase (Mission 3) → 7 columns. */
.progress__row--robotics {
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr;
}
.progress__row--head {
  background: #F8FAFC;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
}
.progress__lesson {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.progress__lesson code {
  font-size: 0.78rem;
  background: #F1F5F9;
  padding: 1px 8px;
  border-radius: 5px;
  width: max-content;
}
.progress__title {
  color: #0F172A;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress__title:hover { color: #4F46E5; text-decoration: underline; }

.progress__form { margin: 0; }
.progress__form--row { display: flex; gap: 6px; align-items: center; }

.progress__btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
}
.progress__btn--todo {
  background: #fff;
  border-color: #CBD5E1;
  color: #334155;
}
.progress__btn--todo:hover {
  border-color: #6366F1;
  color: #4F46E5;
}
.progress__btn--pending {
  background: #FEF3C7;
  border-color: #FDE68A;
  color: #92400E;
}
.progress__btn--pending:hover {
  background: #FEFCE8;
}
.progress__btn--approve {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  border-color: transparent;
  color: #fff;
}
.progress__btn--approve:hover {
  filter: brightness(1.08);
}
.progress__btn--revert {
  background: #fff;
  border-color: #FCA5A5;
  color: #B91C1C;
}
.progress__btn--revert:hover {
  background: #FEF2F2;
}

.progress__status {
  display: inline-block;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748B;
}
.progress__status--approved {
  background: #DCFCE7;
  color: #166534;
  border-radius: 7px;
}

@media (max-width: 720px) {
  .progress__row { grid-template-columns: 1fr; gap: 4px; }
  .progress__row--head { display: none; }
}

/* ============================================================
   Quiz + Upload columns (Student Progress grid)
   ============================================================ */

/* Generic primary dashboard button (used by quiz/upload dialogs). */
.dash-btn--primary {
  background: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  border-color: transparent;
  color: #fff;
}
.dash-btn--primary:hover:not(:disabled) { filter: brightness(1.08); }

/* ---- Quiz cell ---- */
.progress__quiz {
  display: inline-block;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 7px;
  text-decoration: none;
}
.progress__quiz--soon { color: #94A3B8; font-weight: 500; }
.progress__quiz--locked { color: #94A3B8; }
.progress__quiz--take {
  background: #EEF2FF;
  border: 1px solid #C7D2FE;
  color: #4338CA;
}
.progress__quiz--take:hover { background: #E0E7FF; }
.progress__quiz--score {
  background: #DCFCE7;
  border: 1px solid #BBF7D0;
  color: #166534;
}
.progress__quiz--score:hover { background: #BBF7D0; }

/* ---- Upload cell ---- */
.upload-cell__btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  cursor: pointer;
}
.upload-cell__btn:hover { border-color: #6366F1; color: #4F46E5; }
.upload-cell__btn--done {
  background: #DCFCE7;
  border-color: #BBF7D0;
  color: #166534;
}

/* ---- Upload + quiz modal ---- */
.upload-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.upload-modal {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.35);
}
.upload-modal__title { margin: 0 0 4px; font-size: 1.1rem; color: #0F172A; }
.upload-modal__lede { margin: 0 0 16px; font-size: 0.92rem; color: #475569; }
.upload-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.upload-form__row { display: grid; gap: 6px; margin-bottom: 14px; }
.upload-form__row label { font-weight: 600; font-size: 0.85rem; color: #334155; }
.upload-form__row input[type="url"] {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
}
.upload-form__hint { font-size: 0.78rem; color: #64748B; }
.upload-form__check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500 !important;
  font-size: 0.82rem;
  color: #B91C1C;
}
.upload-form__preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

/* ---- Remark cell (micro:bit) ---- */
.remark-note {
  white-space: pre-wrap;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: #1E293B;
  line-height: 1.5;
}
.remark-textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  resize: vertical;
}
.remark-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
}
.remark-badge--student { background: #DBEAFE; color: #1D4ED8; }
.remark-badge--staff { background: #FEF3C7; color: #B45309; }
.remark-ratings {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 12px 14px 14px;
  margin: 4px 0 14px;
}
.remark-ratings legend {
  font-weight: 600;
  font-size: 0.85rem;
  color: #334155;
  padding: 0 6px;
}
.remark-ratings__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.remark-rating {
  display: grid;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}
.remark-rating input {
  font: inherit;
  padding: 7px 8px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  text-align: center;
}
@media (max-width: 480px) {
  .remark-ratings__grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Quiz runner + record (/dashboard/quiz/[coordinate])
   ============================================================ */
.quiz-runner__bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.quiz-runner__progress {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4338CA;
  background: #EEF2FF;
  padding: 4px 12px;
  border-radius: 999px;
}
.quiz-runner__list,
.quiz-record__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.quiz-q {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px 18px;
  background: #fff;
}
.quiz-q__stem {
  font-size: 0.98rem;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 12px;
}
.quiz-q__num { color: #6366F1; margin-right: 6px; }
.quiz-q__opts { display: grid; gap: 8px; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 0.92rem;
}
.quiz-opt:hover { border-color: #C7D2FE; }
.quiz-opt--picked { border-color: #6366F1; background: #EEF2FF; }
.quiz-opt--readonly { cursor: default; }
.quiz-opt--correct {
  border-color: #86EFAC;
  background: #F0FDF4;
}
.quiz-opt--wrong {
  border-color: #FCA5A5;
  background: #FEF2F2;
}
.quiz-opt__mark { width: 16px; font-weight: 700; }
.quiz-opt--correct .quiz-opt__mark { color: #16A34A; }
.quiz-opt--wrong .quiz-opt__mark { color: #DC2626; }
.quiz-opt__tag {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748B;
}
.quiz-runner__foot {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.quiz-runner__warn { margin: 0; font-size: 0.85rem; color: #B45309; }
.quiz-record__banner {
  font-size: 1.05rem;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.quiz-record__banner--pass { background: #DCFCE7; color: #166534; }
.quiz-record__banner--low { background: #FEF3C7; color: #92400E; }

/* ============================================================
   SubmitButton spinner (shown via useFormStatus while a form action
   is in flight)
   ============================================================ */
.submit-pending {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.submit-pending__label { opacity: 0.85; }

.spin-mini {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin-mini-rot 0.7s linear infinite;
}
@keyframes spin-mini-rot { to { transform: rotate(360deg); } }

/* ============================================================
   Teacher mode — bulk approve, checkboxes, approved toggle
   ============================================================ */

.progress--teacher { display: block; }

.progress__bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  margin: 0 0 16px;
}
.progress__bulk-bar--top { margin-bottom: 16px; }
.progress__bulk-bar:not(.progress__bulk-bar--top) { margin: 18px 0 0; }

.progress__bulk-approve {
  font-size: 0.92rem;
  padding: 9px 16px;
}
.progress__bulk-approve:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.progress__bulk-total {
  font-size: 0.82rem;
  color: #64748B;
  font-weight: 600;
  margin-left: auto;
}

.progress__select-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.progress__select-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.progress__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid #FDE68A;
  background: #FEF3C7;
  border-radius: 7px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  color: #92400E;
  font-weight: 600;
}
.progress__checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #10B981;
  cursor: pointer;
}
.progress__checkbox-label { white-space: nowrap; }

.progress__btn--approved-toggle {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #166534;
}
.progress__btn--approved-toggle:hover:not(:disabled) {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #B91C1C;
}

/* ============================================================
   Lesson management — page-level course tabs (Python / Scratch /
   Arduino / EV3 / Parking)
   ============================================================ */

.lm-tabs { display: grid; gap: 16px; margin-top: 8px; }

.lm-tabs__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  background: #F1F5F9;
  border-radius: 12px;
}

.lm-tab {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #475569;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.lm-tab:hover { background: #fff; color: #0F172A; }
.lm-tab--active,
.lm-tab--active:hover {
  background: #fff;
  color: #4F46E5;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.lm-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  background: #E2E8F0;
  border-radius: 999px;
}
.lm-tab--active .lm-tab__count {
  background: #EEF2FF;
  color: #4F46E5;
}
.lm-tab--parking {
  margin-left: auto;
  border: 1px dashed #CBD5E1;
}
.lm-tab--parking.lm-tab--active { border-color: #4F46E5; }

.lm-tabs__panel { padding-top: 4px; }

/* Sub-tabs inside a top-level panel (e.g. Parking → Advasbot / EV3) */
.lm-subtabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.lm-subtab {
  font: inherit;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  cursor: pointer;
}
.lm-subtab:hover { color: #0F172A; border-color: #CBD5E1; }
.lm-subtab--active,
.lm-subtab--active:hover {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4F46E5;
}

/* ============================================================
   Lesson management — resource manager (two-pane: list + editor)
   ============================================================ */

.lr-manage {
  display: grid;
  /* minmax(0, ...) caps the column even when its content (long titles,
     code badges) would otherwise force it wider, which was causing the
     right pane to sit on top of the left list. */
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 14px;
  align-items: start;
}

.lr-manage__list { display: grid; gap: 12px; min-width: 0; }
.lr-manage__editor { min-width: 0; }

.lr-search {
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  color: #0F172A;
  width: 100%;
}
.lr-search:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.lr-level { display: grid; gap: 6px; }
.lr-level__name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475569;
  margin: 8px 0 2px;
}

.lr-lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

.lr-lesson {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  color: #0F172A;
}
.lr-lesson__code { margin-top: 2px; }
.lr-lesson:hover { border-color: #6366F1; background: #F8FAFC; }
.lr-lesson--active {
  border-color: #6366F1;
  background: #EEF2FF;
  box-shadow: 0 0 0 1px #6366F1 inset;
}
.lr-lesson__code {
  font-size: 0.72rem;
  background: #F1F5F9;
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.lr-lesson__title {
  font-size: 0.88rem;
  /* Long titles wrap onto multiple lines rather than being truncated. */
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.35;
}
.lr-lesson__badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: #6366F1;
  border-radius: 999px;
  padding: 0 6px;
}

.lr-coming-soon {
  font-style: normal;
  color: #64748B;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
}

.lr-manage__editor {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  /* Give the scrollbar a little breathing room from the inputs. */
  padding-right: 6px;
}
.lr-empty {
  padding: 28px;
  text-align: center;
  color: #64748B;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  border-radius: 12px;
  margin: 0;
}

.lr-editor { margin-top: 0; }
.lr-editor__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
  margin-bottom: 4px;
}
.lr-editor__head code {
  font-size: 0.74rem;
  background: #E0E7FF;
  color: #3730A3;
  padding: 2px 8px;
  border-radius: 5px;
}
.lr-editor__head strong { font-size: 0.98rem; color: #0F172A; }
.lr-editor__head a {
  margin-left: auto;
  font-size: 0.82rem;
  color: #4F46E5;
  text-decoration: none;
  white-space: nowrap;
}
.lr-editor__head a:hover { text-decoration: underline; }

/* file rows align their content under the label column */
.lr-editor .dash-form__row { align-items: start; }
.lr-file { display: grid; gap: 6px; }
.lr-file__current {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}
.lr-file__thumb {
  max-width: 120px;
  max-height: 80px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  object-fit: cover;
}
.lr-file__remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #B91C1C;
  cursor: pointer;
}
.lr-file__hint { font-size: 0.78rem; color: #64748B; }

@media (max-width: 860px) {
  .lr-manage { grid-template-columns: 1fr; }
  .lr-manage__editor { position: static; }
}

/* ============================================================
   Approvals list (per-student summary on /dashboard/approvals)
   ============================================================ */

.dash-list__item--approvals {
  grid-template-columns: 2fr 1fr auto;
  gap: 14px;
}
.approvals-list__pending-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #92400E;
  font-size: 0.82rem;
  font-weight: 700;
}
.approvals-list__zero { color: #94A3B8; }

.progress__filter-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.approvals__header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.approvals__header-row h2 { margin: 0; }

@media (max-width: 720px) {
  .dash-list__item--approvals { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   Classes + Students manager + Bulk marking
   ============================================================ */
.dash-btn--sm { padding: 5px 12px; font-size: 0.82rem; }

.class-manager__create,
.class-manager__rename {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.class-manager__rename { margin-bottom: 0; }

.class-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 4px 0;
}
.class-pick__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
}
.class-chip {
  display: inline-block;
  background: #EEF2FF;
  color: #4338CA;
  border: 1px solid #C7D2FE;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  margin: 1px 3px 1px 0;
}

.students-manager__toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
/* Search form fills the rest of the row; drop its standalone bottom margin. */
.students-manager__search { flex: 1; min-width: 260px; margin: 0; }
/* Class dropdown sized identically to the search input so the row aligns. */
.students-manager__filter-select {
  font: inherit;
  font-size: 0.92rem;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  color: #0F172A;
  min-width: 170px;
}
.students-manager__filter-select:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.class-pick--stack { flex-direction: column; gap: 8px; }
.students-manager__bulk {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.students-manager__bulk select {
  font: inherit;
  padding: 6px 9px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
}
.students-manager__bulk-label { font-weight: 600; font-size: 0.85rem; color: #334155; }
.students-manager__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-list__muted { color: #94A3B8; }
.students-manager__sid {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.75rem;
  color: #64748B;
  background: #F1F5F9;
  border-radius: 6px;
  padding: 1px 7px;
  white-space: nowrap;
}

/* ---- Bulk import students ---- */
.bulk-import { display: flex; flex-direction: column; gap: 14px; }
.bulk-import__lede { font-size: 0.9rem; color: #475569; line-height: 1.5; margin: 0; }
.bulk-import__lede code {
  background: #F1F5F9;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.85em;
}
.bulk-import__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #E2E8F0;
  padding-top: 14px;
}
.bulk-import__file input[type="file"] { font: inherit; font-size: 0.85rem; }
.bulk-import__filename { font-size: 0.82rem; color: #475569; margin: 0; }
.bulk-import__results { border-top: 1px solid #E2E8F0; padding-top: 12px; }
.bulk-import__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bulk-import__row {
  display: grid;
  grid-template-columns: 64px auto 1fr;
  align-items: baseline;
  gap: 10px;
  font-size: 0.82rem;
  padding: 5px 9px;
  border-radius: 7px;
}
.bulk-import__row--created { background: #F0FDF4; }
.bulk-import__row--skipped { background: #FEF2F2; }
.bulk-import__row-line { color: #94A3B8; font-size: 0.75rem; }
.bulk-import__row-msg { color: #475569; }
.bulk-import__row--skipped .bulk-import__row-msg { color: #B91C1C; }

.dash-list__item--student {
  grid-template-columns: auto 2.2fr 2fr auto;
  gap: 24px;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 14px;
}
@media (max-width: 720px) {
  .dash-list__item--student { grid-template-columns: 1fr; gap: 6px; }
}

.dash-list__item--class-member {
  grid-template-columns: auto 2.4fr auto;
  gap: 20px;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
}
@media (max-width: 720px) {
  .dash-list__item--class-member { grid-template-columns: 1fr; gap: 6px; }
}

.bulk-mark__step {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px 16px 16px;
  margin: 0 0 16px;
}
.bulk-mark__step legend {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1E293B;
  padding: 0 8px;
}
.bulk-mark__row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bulk-mark__inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}
.bulk-mark__inline select {
  font: inherit;
  padding: 6px 9px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
}
.bulk-mark__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 14px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #F1F5F9;
  border-radius: 8px;
}
.bulk-mark__check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
}
.bulk-mark__check code { color: #64748B; }

/* ---- Progress checking ---- */
.progress-check__lesson { flex: 1 1 320px; }
.progress-check__lesson select { flex: 1; min-width: 200px; }
.progress-check__badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 6px;
  padding: 1px 6px;
}
.progress-check__badge--pending { background: #FEF3C7; color: #92400E; }
.progress-check__badge--approved { background: #DCFCE7; color: #166534; }

/* =========================================================================
   Assessment feature — landing, record, mark, runner
   ========================================================================= */

/* Status pills (used on student landing, staff landing, super-admin table) */
.assess-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.assess-pill--locked       { background: #F1F5F9; color: #475569; border-color: #CBD5E1; }
.assess-pill--unlocked     { background: #DBEAFE; color: #1D4ED8; border-color: #93C5FD; }
.assess-pill--in-progress  { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }
.assess-pill--submitted    { background: #FFEDD5; color: #9A3412; border-color: #FDBA74; }
.assess-pill--marked       { background: #DCFCE7; color: #166534; border-color: #86EFAC; }

/* Result band on the record page */
.assess-band {
  display: inline-block;
  margin-left: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.assess-band--distinction { background: #FEF9C3; color: #92400E; border: 1px solid #FDE68A; }
.assess-band--pass        { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.assess-band--not-yet     { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }

/* Student landing — papers grouped by (course, level) */
.assess-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.assess-list__group {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.assess-list__group-title {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #1E293B;
}
.assess-list__inner { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.assess-row {
  display: grid;
  grid-template-columns: 2fr 2fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  background: #F8FAFC;
  border-radius: 8px;
}
.assess-row__info  { display: grid; gap: 2px; }
.assess-row__meta  { font-size: 0.82rem; color: #64748B; }
.assess-row__action { justify-self: end; }
@media (max-width: 720px) {
  .assess-row { grid-template-columns: 1fr; }
  .assess-row__action { justify-self: stretch; }
}

/* Simple table used by super-admin catalogue view */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.93rem;
}
.dash-table th,
.dash-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #E2E8F0;
}
.dash-table th { background: #F8FAFC; font-weight: 600; color: #334155; }

/* MCQ list (used by the live runner + the record view) */
.as-mcq-list {
  list-style: none;
  counter-reset: mcq;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}
.as-mcq {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
}
.as-mcq__opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.as-mcq__opts li { display: flex; align-items: baseline; gap: 8px; }
.as-mcq__opts input[type="radio"] { transform: translateY(2px); }
.as-mcq__opts label { cursor: pointer; }

/* Record-mode MCQ — green ✓ for correct, red ring on wrong picks */
.as-mcq--record.as-mcq--correct { border-color: #86EFAC; background: #F0FDF4; }
.as-mcq--record.as-mcq--wrong   { border-color: #FCA5A5; background: #FEF2F2; }
.as-mcq__opt-record {
  list-style: none;
  padding: 2px 0;
  color: #475569;
}
.as-mcq__opt--correct { color: #166534; font-weight: 600; }
.as-mcq__opt--picked  { background: #FEE2E2; color: #B91C1C; border-radius: 4px; padding: 2px 6px; }
.as-mcq__opt--picked.as-mcq__opt--correct { background: #DCFCE7; color: #166534; }

/* Rubric — mark-entry table for staff, and read-only for students */
.as-rubric {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}
.as-rubric li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 4px 8px;
  background: #F8FAFC;
  border-radius: 6px;
}
.as-rubric__total { font-weight: 600; color: #1E293B; background: #E2E8F0 !important; }

.as-rubric--input li.as-rubric__row {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  align-items: center;
  gap: 10px;
}
.as-rubric__input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font: inherit;
  font-size: 0.92rem;
  text-align: right;
}
.as-rubric__input:focus { outline: 2px solid #6366F1; outline-offset: 1px; }
.as-rubric__cap { color: #64748B; font-size: 0.85rem; }

/* Modal — already styled in python_styles.css; this is a fallback for when
   that file isn't loaded (e.g. preview of student record without the runner).
   Keep selectors specific so they don't conflict. */
.assessment-take .as-modal-bg,
.assessment-record .as-modal-bg {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}

/* Per-question runner: banner + progress bar + MCQ opts + review grid */
.as-progress-bar {
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin: 10px 0 14px;
}
.as-progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #818CF8);
  transition: width .2s ease;
}

.as-q-banner {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 14px;
  background: #E0E7FF;
  color: #3730A3;
  border: 1px solid #C7D2FE;
}
.as-q-banner--A { background: #DBEAFE; color: #1D4ED8; border-color: #93C5FD; }
.as-q-banner--B { background: #FEF3C7; color: #92400E; border-color: #FCD34D; }
.as-q-banner--C { background: #FCE7F3; color: #9D174D; border-color: #F9A8D4; }

.as-q-stem-wrap p.as-q-stem { margin: 0 0 14px; }

.as-opts {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.as-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.as-opt:hover { border-color: #6366F1; }
.as-opt--picked {
  border-color: #6366F1;
  background: #EEF2FF;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.as-opt input[type="radio"] { margin-top: 4px; flex-shrink: 0; }

/* scratchblocks rendered chips inline inside option labels */
.as-opt pre.blocks { display: inline-block; margin: 0 4px; vertical-align: middle; }
.as-q-stem pre.blocks { display: inline-block; margin: 2px 4px; vertical-align: middle; }

.as-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* Review screen */
.as-rev-section { margin: 18px 0; }
.as-rev-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #1E293B;
}
.as-rev-cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.as-rev-cell {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.as-rev-cell:hover { border-color: #6366F1; color: #4F46E5; }
.as-rev-cell.answered {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #166534;
}

.as-warn {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  margin: 10px 0;
}

/* =============================================================
   Advasbot planning page (/dashboard/advasbot-planning)
   ============================================================= */
.abp-muted { color: #64748B; font-size: 0.88rem; margin: 0 0 10px; }
.abp-warn {
  background: #FEF3C7; border: 1px solid #FCD34D; color: #92400E;
  border-radius: 10px; padding: 12px 14px;
}
.abp-card { margin-top: 6px; }
.abp-tablewrap { overflow-x: auto; }
.abp-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.abp-table th, .abp-table td {
  border: 1px solid #E2E8F0; padding: 6px 8px; text-align: left; vertical-align: top;
}
.abp-table th { background: #F8FAFC; color: #334155; font-weight: 600; white-space: nowrap; }
.abp-table input, .abp-table select {
  width: 100%; border: 1px solid #CBD5E1; border-radius: 6px; padding: 5px 7px;
  font: inherit; font-size: 0.85rem; background: #fff;
}
.abp-td--qty { width: 60px; }
.abp-td--port { width: 110px; }
.abp-table--read td { background: #fff; }
.abp-rowdel {
  border: none; background: transparent; color: #B91C1C; cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 4px;
}
.abp-rowdel:hover { color: #7F1D1D; }
.abp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

.abp-textarea {
  width: 100%; border: 1px solid #CBD5E1; border-radius: 8px; padding: 8px 10px;
  font: inherit; font-size: 0.88rem; resize: vertical; background: #fff;
}

/* SDG checklist */
.abp-sdg-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
@media (min-width: 720px) { .abp-sdg-grid { grid-template-columns: 1fr 1fr; } }
.abp-sdg {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid #CBD5E1; border-radius: 8px; cursor: pointer; font-size: 0.88rem;
}
.abp-sdg--on { border-color: #0EA5E9; background: #F0F9FF; }
.abp-sdg input { margin-top: 2px; }

/* Per-lesson two-pane editor */
.abp-lessons { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .abp-lessons { grid-template-columns: 300px 1fr; } }
.abp-lessons__list { max-height: 520px; overflow-y: auto; border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px; }
.abp-lessons__group h4 { margin: 8px 6px 4px; font-size: 0.8rem; color: #64748B; text-transform: uppercase; letter-spacing: 0.03em; }
.abp-lessons__group ul { list-style: none; margin: 0 0 6px; padding: 0; }
.abp-lessonbtn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: transparent; padding: 7px 9px; border-radius: 7px; cursor: pointer;
}
.abp-lessonbtn:hover { background: #F1F5F9; }
.abp-lessonbtn--active { background: #E0F2FE; }
.abp-lessonbtn code { font-size: 0.72rem; color: #0369A1; flex-shrink: 0; }
.abp-lessonbtn span { font-size: 0.83rem; color: #1E293B; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abp-dot { width: 8px; height: 8px; border-radius: 999px; background: #22C55E; margin-left: auto; flex-shrink: 0; }
.abp-editor__title { margin: 0 0 12px; }

/* 3D build library */
.abp-td--lvl { width: 64px; }
.abp-td--link { min-width: 200px; }
.abp-linkcell { display: flex; align-items: center; gap: 6px; }
.abp-open { flex-shrink: 0; text-decoration: none; color: #0EA5E9; font-weight: 700; }
.abp-open:hover { color: #0369A1; }
.abp-empty { text-align: center; color: #94A3B8; font-style: italic; padding: 14px; }

/* Advasbot lesson markdown editor */
.avb-md-input {
  width: 100%;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  tab-size: 2;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  background: #fff;
}

/* ===================================================================== */
/* Assessment certificates                                               */
/* ===================================================================== */

/* --- the printable certificate stage --------------------------------- */
.cert-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 18px;
}
.cert-stage {
  position: relative;
  width: 100%;
  max-width: 980px;
  container-type: inline-size;    /* enables cqw units for the name auto-fit */
  aspect-ratio: 841.9 / 595.3;    /* matches the template viewBox / A4 landscape */
  background: #FBF7EF;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}
.cert-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

/* Dynamic fields overlaid on the artwork. Positions are tuned to the
   placeholder template (public/certificates/python.svg); nudge top/left
   when the real .ai export lands. All percentages are of the stage box. */
.cert-field {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  text-align: center;
  color: #111827;
  line-height: 1.1;
}
.cert-field--name {
  top: 58.5%;                       /* rests on the gradient underline (rect y=351.7 -> 59.05%) */
  transform: translate(-50%, -100%);
  width: 47%;                       /* matches the name underline (rect width 394.7 -> 46.9%) */
  font-size: clamp(18px, 3.1vw, 30px);
  font-weight: 800;
  color: #1F2937;
  letter-spacing: 0.5px;
}
/* EV3's name underline is wider (rect x=199 w=444 -> 52.7%) than Python/Scratch. */
.cert-stage--ev3 .cert-field--name { width: 52.7%; }

/* Single-line name that shrinks to fit the underline (see FitName.tsx). */
.cert-fit { display: block; width: 100%; }
.cert-fit__text {
  display: inline-block;
  white-space: nowrap;
}
.cert-field--course {
  top: 65.3%;                       /* below "successfully completed the course" (~63%) */
  font-size: clamp(12px, 1.7vw, 17px);
  font-weight: 700;
}
.cert-field--grade {
  top: 68.3%;                       /* tucked into the gap above the laurel badge (~70%) */
  font-size: clamp(9px, 1.3vw, 13px);
  font-style: italic;
  font-weight: 700;
  color: #B8741A;
}
.cert-field--date {
  top: 78.9%;                       /* above the DATE rule (rect y=472.5 -> 79.4%) */
  left: 27%;                        /* DATE rule centre (x 156.2..298.7 -> 27.0%) */
  width: 24%;
  transform: translate(-50%, -100%);
  font-size: clamp(10px, 1.5vw, 15px);
  font-weight: 700;
  color: #374151;
}
.cert-field--code {
  top: 89%;                         /* bottom-centre clear zone, below the signature row */
  font-size: clamp(8px, 1.05vw, 12px);
  letter-spacing: 0.5px;
  color: #6B7280;
}

/* Per-school signature block, on the right rule (mirrors the DATE block).
   Right rule: rect x=543.7..686.2 -> centre 73.0%, y=473.5 -> 79.5%. */
.cert-sign-img {
  position: absolute;
  left: 73%;
  top: 78.6%;
  transform: translate(-50%, -100%);
  max-width: 22%;
  max-height: 13%;
  object-fit: contain;
  pointer-events: none;
}
.cert-field--sign-name {
  top: 82.3%;
  left: 73%;
  width: 30%;
  font-size: clamp(10px, 1.5vw, 15px);
  font-weight: 700;
  color: #111827;
}
.cert-field--sign-pos {
  top: 85.3%;
  left: 73%;
  width: 30%;
  font-size: clamp(8px, 1.1vw, 12px);
  letter-spacing: 1px;
  color: #6B7280;
}

/* School signature editor (Certificates page, school-admin only) */
.cert-sign-editor__current {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
  padding: 12px;
  background: #F8FAFC;
  border-radius: 8px;
}
.cert-sign-editor__label { font-weight: 700; color: #475569; }
.cert-sign-editor__preview {
  max-height: 70px;
  max-width: 220px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 6px;
}

/* Certification tab: list + create form */
.cert-search {
  width: 100%;
  max-width: 480px;
  padding: 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.cert-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.cert-toolbar .cert-search { margin-bottom: 0; flex: 1; min-width: 220px; }
.cert-grade-filter {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: #0F172A;
  cursor: pointer;
  line-height: 1.4;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
}
.cert-grade-filter:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.cert-list-row {
  display: grid;
  align-items: center;
  gap: 12px;
}
.cert-list-row--with-student { grid-template-columns: 1.5fr 1.7fr 1fr auto; }
.cert-list-row--no-student { grid-template-columns: 2fr 1fr auto; }
.cert-pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
.assess-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.assess-search .cert-search { margin-bottom: 0; flex: 1; min-width: 220px; }
.cert-list-row__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.cert-create-form__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.cert-create-form__code {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cert-create-form__code input { flex: 1; }
.user-actions__btn--danger {
  background: #FEF2F2;
  color: #B91C1C;
  border-color: #FCA5A5;
}
.user-actions__btn--danger:hover { background: #FEE2E2; }

@media (max-width: 720px) {
  .cert-list-row--with-student,
  .cert-list-row--no-student { grid-template-columns: 1fr; gap: 4px; }
  .cert-create-form__grid { grid-template-columns: 1fr; }
}

/* --- modal dialog ----------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  animation: modal-in 0.14s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid #E2E8F0;
}
.modal__title { margin: 0; font-size: 1.15rem; }
.modal__close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: #64748B;
  cursor: pointer;
  padding: 0 4px;
}
.modal__close:hover { color: #0F172A; }
.modal__body { padding: 22px; }
/* generous spacing for forms inside modals */
.modal__body .dash-form { display: flex; flex-direction: column; gap: 16px; }
.modal__body .dash-form__row { display: flex; flex-direction: column; gap: 6px; }
.modal__body .dash-form__actions { margin-top: 4px; }

/* --- staff batch-issue list ------------------------------------------ */
.cert-issue-row {
  display: grid;
  grid-template-columns: 36px 1.5fr 1.6fr 1.1fr;
  align-items: center;
  gap: 12px;
}
.cert-issue-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.cert-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.cert-inline-issue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* --- print: show only the certificate, full-bleed A4 landscape ------- */
@media print {
  @page { size: A4 landscape; margin: 0; }
  body * { visibility: hidden; }
  .cert-print-page,
  .cert-print-page * { visibility: visible; }
  .cert-print-page {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    max-width: none;
  }
  .cert-no-print { display: none !important; }
  .cert-wrap { margin: 0; }
  .cert-stage {
    width: 100%;
    max-width: none;
    border-radius: 0;
    box-shadow: none;
  }
}

