/* Keep the class and its students at the centre of the page. */
.class-credit-board {
  min-width: 0;
  max-width: 1280px;
  margin: auto;
  padding: 24px;
  border-radius: 20px;
  background: #fff;
}
.class-credit-board [hidden] { display: none !important; }
.cb-class-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: -4px 0 24px;
  border-bottom: 1px solid var(--line);
}
.cb-class-tabs {
  display: flex;
  flex: 1;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  padding: 4px 3px 0;
  scrollbar-width: thin;
  scrollbar-color: #d4cddd transparent;
  overscroll-behavior-x: contain;
}
.cb-class-tabs > button {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  max-width: 260px;
  padding: 12px 14px 16px;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  overflow-wrap: anywhere;
  scroll-margin-inline: 8px;
}
.cb-class-tabs > button[aria-selected="true"] { color: var(--blue); }
.cb-class-tabs > button[aria-selected="true"]::after {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--blue);
  content: "";
}
.class-credit-board .cb-class-tabs > button:focus-visible { outline-offset: -3px; }
.cb-new-class {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  margin: 0 0 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.cb-new-class svg { width: 18px; height: 18px; flex: 0 0 auto; }
#cb-class-panel { min-width: 0; }
.cb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cb-heading,
.cb-heading-actions,
.cb-class-heading,
.cb-controls,
.cb-selection {
  display: flex;
  align-items: center;
}
.cb-heading {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 18px;
}
.cb-header-main { min-width: 0; max-width: 100%; }
.cb-class-heading { gap: 4px; }
.cb-heading h1 {
  min-width: 0;
  margin: 0;
  font-size: clamp(25px, 2.3vw, 30px);
  line-height: 1.25;
  letter-spacing: -.6px;
  overflow-wrap: anywhere;
}
.cb-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.cb-heading-actions { gap: 8px; }
.cb-heading-actions .secondary {
  min-height: 44px;
  padding: 10px 14px;
  border-color: var(--line);
  font-size: 13px;
}
.cb-more,
.cb-options { position: relative; }
.cb-more > summary,
.cb-options > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.cb-more > summary { width: 44px; padding: 10px; }
.cb-more > summary::-webkit-details-marker,
.cb-options > summary::-webkit-details-marker { display: none; }
.cb-more > summary svg,
.cb-options > summary svg { width: 18px; height: 18px; flex: 0 0 auto; }
.cb-more > summary svg { fill: currentColor; }
.cb-more[open] > summary,
.cb-options[open] > summary { background: var(--theme-soft, #edf2fc); }
.cb-menu,
.cb-toolbar {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 15;
  width: min(280px, calc(100vw - 48px));
  max-height: min(420px, 65vh);
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 8px 30px #17243b16;
}
.cb-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  overflow-wrap: anywhere;
}
.cb-controls { flex-wrap: wrap; gap: 10px 16px; margin-bottom: 18px; }
.cb-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 380px;
}
.cb-search > svg {
  position: absolute;
  top: 13px;
  left: 13px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.cb-search input {
  width: 100%;
  height: 44px;
  margin: 0;
  padding: 10px 14px 10px 40px;
  border-color: var(--line);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 400;
}
.cb-search input::placeholder { color: var(--muted); opacity: 1; }
.cb-select-all {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.cb-select-all input,
.cb-student-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.cb-options { margin-left: auto; }
.cb-options > summary {
  padding: 10px 12px;
  border-color: var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.cb-toolbar {
  display: grid;
  gap: 17px;
  width: min(300px, calc(100vw - 48px));
  padding: 18px;
}
.cb-amount { display: flex; min-width: 0; gap: 6px; margin: 0; padding: 0; border: 0; }
.cb-amount legend { margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.cb-amount button {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 8px 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}
.cb-amount button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.cb-reason { min-width: 0; font-size: 12px; }
.cb-reason select { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 13px; font-weight: 400; }
.cb-selection {
  position: sticky;
  top: 12px;
  z-index: 5;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 16px;
  padding: 8px 12px;
  border: 1px solid #d7e5d4;
  border-radius: 12px;
  background: #f5faf1;
  box-shadow: 0 3px 12px #20382508;
  font-size: 13px;
}
.cb-selection > div { min-width: 0; margin-right: auto; }
.cb-selection > div > span { display: block; color: var(--muted); font-size: 11px; }
.cb-selection .text-button { min-height: 44px; padding: 9px 3px; font-size: 13px; }
.cb-selection .primary { min-height: 44px; padding: 10px 15px; font-size: 13px; }
.cb-students {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 24px 14px;
  padding-top: 8px;
}
.cb-student {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  align-items: center;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.cb-student.is-selected {
  border-color: var(--blue);
  background: var(--theme-soft, #edf2fc);
}
.cb-student-check {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
}
.cb-balance {
  position: absolute;
  top: 18px;
  right: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  padding: 5px 8px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #218143;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.cb-student-open {
  display: grid;
  flex: 1;
  align-content: start;
  justify-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 22px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.cb-avatar { display: block; width: 120px; height: 120px; max-width: 100%; }
.cb-avatar svg { display: block; width: 100%; height: 100%; }
.cb-student-open > strong {
  width: 100%;
  min-height: 40px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}
.cb-quick-award {
  width: auto;
  max-width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 10px 13px;
  border: 0;
  border-radius: 999px;
  background: #f1f6ef;
  color: #35663d;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
}
.cb-feedback { margin: 0 0 16px; font-size: 13px; }
.cb-feedback:empty,
.cb-feedback:not(:has(p:not(:empty), button:not([hidden]))),
.cb-feedback p:empty { display: none; }
.cb-feedback p { margin: 0; }
.cb-feedback .cb-message { color: #41663c; font-weight: 600; }
.cb-feedback .error { margin-top: 6px; }
.cb-feedback button { margin-top: 8px; }
.cb-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 30px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: center;
}
.cb-empty-icon { display: block; margin-bottom: 8px; color: var(--muted); font-size: 30px; line-height: 1; }
.cb-empty h2 { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }
.cb-empty p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; }
.cb-empty .primary,
.cb-empty .secondary { margin-top: 18px; }
.cb-loading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0; color: var(--muted); font-size: 14px; }
.cb-history { margin-top: 26px; border-top: 1px solid var(--line); }
.cb-history > summary {
  min-height: 44px;
  padding: 14px 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cb-history > summary span { margin-left: 6px; color: var(--muted); font-size: 12px; font-weight: 400; }
.cb-history ul { margin: 0; padding: 0; list-style: none; }
.cb-history li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.cb-history li + li { border-top: 1px solid var(--line); }
.cb-history li > div { min-width: 0; }
.cb-history li strong { font-size: 13px; }
.cb-history p { margin: 4px 0; font-size: 12px; overflow-wrap: anywhere; }
.cb-history small { color: var(--muted); font-size: 11px; }
.cb-history li .secondary { flex-shrink: 0; padding: 9px 12px; font-size: 12px; }
.class-credit-board :is(button, summary, input, select):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.class-credit-board button:disabled { opacity: .5; cursor: not-allowed; }
@media (hover: hover) {
  .cb-class-tabs > button:hover,
  .cb-new-class:hover,
  .cb-more > summary:hover,
  .cb-options > summary:hover,
  .cb-menu button:hover { background: var(--theme-soft, #edf2fc); }
  .cb-student:hover { background: #f8f9fb; }
  .cb-student.is-selected:hover { background: var(--theme-soft, #edf2fc); }
  .cb-student-open:hover > strong { text-decoration: underline; text-underline-offset: 3px; }
  .cb-quick-award:hover { background: #218143; color: #fff; }
}
@media (max-width: 600px) {
  .class-credit-board { padding: 16px; border-radius: 16px; }
  .cb-class-nav { gap: 6px; margin-bottom: 20px; }
  .cb-class-tabs { gap: 0; }
  .cb-class-tabs > button { max-width: 200px; padding-right: 10px; padding-left: 10px; font-size: 13px; }
  .cb-new-class { padding: 10px; }
  .cb-new-class > span { display: none; }
  .cb-heading { margin-bottom: 14px; gap: 8px; }
  .cb-heading-actions { margin-left: auto; }
  .cb-controls { gap: 4px 12px; margin-bottom: 14px; }
  .cb-search { flex-basis: 100%; max-width: none; margin-bottom: 4px; }
  .cb-search input { font-size: 16px; }
  .cb-students { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 8px; }
  .cb-student { padding: 6px 4px; }
  .cb-balance { right: 0; }
  .cb-selection { gap: 4px 12px; }
  .cb-history li { align-items: flex-start; gap: 10px; }
}
@media (max-width: 380px) {
  .cb-heading-actions { width: 100%; justify-content: flex-end; }
  .cb-heading-actions .secondary { padding: 9px 12px; }
  .cb-students { gap: 16px 6px; }
  .cb-avatar { width: 100px; height: 110px; }
  .cb-balance { min-width: 36px; min-height: 36px; font-size: 13px; }
  .cb-student-open > strong { font-size: 13px; }
  .cb-selection .primary { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .class-credit-board *,
  .class-credit-board *::before,
  .class-credit-board *::after { transition: none; animation: none; }
}

/* Student-view picker shares this stylesheet. */
.student-view-picker{min-width:0}.sv-filters{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:22px 0}.sv-filters label{display:grid;gap:8px;min-width:0}.sv-filters input,.sv-filters select{width:100%;min-width:0}.sv-students{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-height:48vh;overflow:auto;padding:3px}.sv-students button{display:grid;grid-template-columns:52px minmax(0,1fr);gap:4px 12px;text-align:left;align-items:center;padding:12px;background:#fff;border:1px solid var(--line);border-radius:12px;color:var(--ink);font:inherit}.sv-students button>span{width:52px;height:58px;grid-row:span 2}.sv-students button strong,.sv-students button small{overflow-wrap:anywhere}.sv-students button small{color:var(--muted);font-size:11px}.sv-students button:hover{border-color:#8660b2;background:#f5f0fa}.sv-students button:focus-visible{outline:3px solid #a281d5;outline-offset:2px}.student-view-picker .error:empty{display:none}@media(max-width:500px){.sv-filters,.sv-students{grid-template-columns:1fr}}
.cb-archive-link { display: flex; justify-content: flex-end; margin-bottom: .5rem; }
