/* ── Class Results panel (teacher/class-results.js) ─────────────────────
   The last column of #page-layout, beside the page, as the Help panel is;
   over the page in a narrower window. Its level colours are the gradebook's
   soft palette (gradebook.css scopes it to .cr-panel too). Colour means a
   proficiency level only: comparisons and counts that are not a level are
   neutral grey. */
.cr-panel {
  width: 680px;
  flex-shrink: 0;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: var(--surface);
  border-left: 1px solid var(--divider-medium);
  font-family: var(--font-base);
  font-size: var(--text-base);
  color: var(--text);
}
@media (max-width: 1100px) {
  .cr-panel {
    position: fixed;
    top: var(--dock-h);
    right: 0;
    bottom: 0;
    width: min(680px, 100vw);
    height: auto;
    z-index: var(--z-modal);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
  }
}
@media (max-width: 560px) {
  .cr-panel {
    padding: 16px;
  }
}
@media print {
  .cr-panel {
    display: none !important;
  }
}

/* ── Header ── */
.cr-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cr-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.cr-head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cr-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.cr-head h2:focus {
  outline: none;
}
.cr-head h2:focus-visible {
  outline: 2px solid var(--active);
  outline-offset: 2px;
}
.cr-sub {
  font-size: var(--text-sm);
  color: var(--text-2);
}
.cr-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--overlay-hover);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.cr-close:hover {
  color: var(--text);
}
.cr-head-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cr-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--overlay-hover);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.cr-btn-primary {
  background: var(--active-fill);
  color: #fff;
}
.cr-btn:hover {
  filter: brightness(0.96);
}

/* ── Summary band ── */
.cr-band {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg);
}
.cr-stats {
  display: grid;
  gap: 12px;
}
.cr-stats-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cr-stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cr-stats-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.cr-stats-pts {
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
}
.cr-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.cr-stat span {
  font-size: var(--text-xs);
  color: var(--text-2);
}
.cr-stat b {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.cr-stat b small {
  font-size: var(--text-sm);
  font-weight: 600;
}
@media (max-width: 560px) {
  .cr-stats-4,
  .cr-stats-pts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.cr-dist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cr-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}
.cr-cnt {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.cr-cnt div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cr-cnt b {
  font-size: var(--text-md);
}
.cr-cnt span {
  font-size: var(--text-xs);
  color: var(--text-2);
  white-space: nowrap;
}
.cr-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-subtle);
  font-size: var(--text-sm);
}
.cr-chip-lead {
  font-weight: 600;
}
.cr-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
.cr-compare:empty,
.cr-compare:has(> .cr-others[hidden]:only-child) {
  display: none;
}
.cr-others,
.cr-earlier {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-subtle);
  min-width: 0;
}
.cr-others[hidden] {
  display: none;
}
.cr-earlier:only-child {
  grid-column: 1 / -1;
  max-width: 50%;
}
@media (max-width: 560px) {
  .cr-compare {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .cr-earlier:only-child {
    max-width: none;
  }
}
.cr-cl {
  font-size: var(--text-xs);
  color: var(--text-2);
}
.cr-cmpr {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px auto;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: var(--text-sm);
}
.cr-cmpr b {
  text-align: right;
  white-space: nowrap;
}
.cr-cmpr > a,
.cr-this {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-this {
  font-weight: 700;
}
.cr-track {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--divider-medium);
  overflow: hidden;
}
.cr-track > span {
  display: block;
  height: 100%;
  background: var(--text-3);
}
.cr-trend {
  display: block;
  color: var(--text-3);
}
.cr-trend-dots {
  position: relative;
  display: grid;
  /* Over the line above it (44px tall, 6px gap), so each dot sits on it. */
  margin-top: -50px;
  padding-top: 50px;
  font-size: 11px;
  color: var(--text-2);
}
.cr-trend-dots > span {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  white-space: nowrap;
  min-width: 0;
}
.cr-trend-dots b {
  font-size: var(--text-xs);
  color: var(--text);
}
.cr-trend-dot {
  position: absolute;
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -50px 0 0 -5.5px;
  border: 2px solid var(--text-3);
  border-radius: 50%;
  background: var(--surface);
  transform: translateY(-50%);
}
.cr-trend-dot.is-now {
  width: 9px;
  height: 9px;
  margin-left: -6.5px;
  background: var(--text-3);
}

/* ── Complete/Incomplete ring ── */
.cr-ring-row {
  display: flex;
  align-items: center;
  gap: 28px;
}
.cr-ring {
  position: relative;
  width: 132px;
  height: 132px;
  flex: none;
}
.cr-ring svg,
.cr-donut svg {
  transform: rotate(-90deg);
}
.cr-ring-mid {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.cr-ring-mid b {
  font-size: 26px;
}
.cr-ring-mid span {
  font-size: var(--text-xs);
  color: var(--text-2);
}
.cr-crows {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
}
.cr-crow {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.cr-crow b {
  font-size: var(--text-md);
}
.cr-mk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  box-sizing: border-box;
}
.cr-mk-done {
  background: var(--score-3-bg);
  color: var(--score-3-text);
}
.cr-mk-not {
  background: var(--score-1-bg);
  color: var(--score-1-text);
}
.cr-mk-blank {
  box-shadow: inset 0 0 0 1.5px var(--text-3);
}
@media (max-width: 560px) {
  .cr-ring-row {
    flex-direction: column;
    align-items: stretch;
  }
  .cr-ring {
    align-self: center;
  }
}

/* ── Sections and lists ── */
.cr-sec {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.cr-sh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
}
.cr-sh h3 {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--text-md);
  font-weight: 700;
}
.cr-sh h3 > span:not(.cr-vmw):not(.cr-vm-static) {
  color: var(--text-2);
  font-weight: 600;
}
.cr-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}
.cr-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.cr-cols-1 {
  grid-template-columns: minmax(0, 1fr);
}
.cr-col {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}
.cr-col:empty {
  display: none;
}
@media (max-width: 640px) {
  .cr-cols,
  .cr-cols-3 {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
}
.cr-rule {
  padding-top: 18px;
  border-top: 1px solid var(--divider-subtle);
}
.cr-list {
  display: flex;
  flex-direction: column;
}
.cr-li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border-bottom: 1px solid var(--divider-subtle);
}
.cr-li:last-child {
  border-bottom: 0;
}
.cr-li-3 {
  grid-template-columns: minmax(0, 1fr) auto 92px;
}
.cr-li b {
  white-space: nowrap;
}
.cr-name {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cr-name .gb-des-tag {
  flex: none;
}
.cr-stu {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--divider-strong);
  text-underline-offset: 3px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-stu:hover {
  color: var(--score-4-text);
  text-decoration-color: currentColor;
}
.cr-lvl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-2);
}
.cr-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}
.cr-link {
  align-self: flex-start;
  border: 0;
  background: none;
  padding: 6px 0;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--score-4-text);
  text-decoration: none;
  cursor: pointer;
}
.cr-act {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-top: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--active-light);
  color: var(--active);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.cr-act-plain {
  background: var(--overlay-hover);
  color: var(--text);
  margin-top: 0;
}
.cr-names {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.cr-names .cr-name-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--overlay-hover);
  font-size: var(--text-sm);
  text-decoration: none;
}
.cr-obs {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: var(--text-sm);
  line-height: 1.4;
}
.cr-obs .cr-obs-name {
  font-weight: 600;
  white-space: normal;
}
.cr-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--overlay-hover);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
}
.cr-muted {
  color: var(--text-2);
}

/* ── View menus ── */
.cr-vmw {
  position: relative;
}
.cr-vm,
.cr-vm-static {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  margin-left: -2px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-2);
}
.cr-vm {
  cursor: pointer;
}
.cr-vm:hover {
  background: var(--overlay-hover);
  color: var(--text);
}
.cr-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--z-popover);
  min-width: 170px;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.cr-menu button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.cr-menu button:hover,
.cr-menu button:focus {
  outline: none;
  background: var(--active-fill);
  color: #fff;
}

/* ── Results grid ── */
.cr-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, 84px) 84px;
  gap: 4px;
  align-items: center;
}
@media (max-width: 640px) {
  .cr-grid {
    grid-template-columns: minmax(0, 1fr) repeat(4, 44px) 64px;
  }
  /* Too narrow for the level names: the dots stay; each name is still read out and shown on hover. */
  .cr-gh-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}
.cr-gh {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-bottom: 2px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
}
.cr-gh-avg {
  justify-content: flex-end;
}
.cr-gl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cr-cell {
  height: 38px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: var(--text-md);
  font-weight: 700;
  cursor: pointer;
}
.cr-cell-empty {
  display: block;
  background: var(--bg);
  cursor: default;
}
button.cr-cell:hover {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 35%, transparent);
}
.cr-cell.is-on,
.cr-bin.is-on,
.cr-seg.is-on,
.cr-lg.is-on {
  box-shadow: inset 0 0 0 2px var(--text);
}
.cr-gavg {
  text-align: right;
  white-space: nowrap;
}

/* ── Score Spread (points) ── */
.cr-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: var(--text-xs);
  color: var(--text-2);
}
.cr-key > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cr-bars-wrap,
.cr-dots-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 22px;
}
.cr-median-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
}
.cr-bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  border-bottom: 1px solid var(--divider-strong);
}
.cr-bin {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 3px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 4px 4px 0 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.cr-bin b {
  font-size: var(--text-xs);
  text-align: center;
}
.cr-bin-empty {
  cursor: default;
}
.cr-stack {
  display: flex;
  flex-direction: column;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.cr-stack i {
  display: block;
}
.cr-median-line {
  position: absolute;
  top: -6px;
  bottom: 0;
  border-left: 2px dashed var(--text);
  pointer-events: none;
}
.cr-bin-labels {
  display: flex;
  gap: 6px;
}
.cr-bin-labels span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
}
.cr-donut-row {
  display: flex;
  align-items: center;
  gap: 32px;
}
.cr-donut {
  position: relative;
  width: 168px;
  height: 168px;
  flex: none;
}
.cr-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cr-lg {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.cr-lg:hover:not(:disabled) {
  background: var(--overlay-hover);
}
.cr-lg:disabled {
  cursor: default;
  opacity: 0.6;
}
.cr-lg .cr-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.cr-lg > span:last-child {
  text-align: right;
}
@media (max-width: 560px) {
  .cr-donut-row {
    flex-direction: column;
    align-items: stretch;
  }
  .cr-donut {
    align-self: center;
  }
}
.cr-dots {
  position: relative;
  height: 150px;
  margin: 0 8px;
  border-bottom: 1px solid var(--divider-strong);
}
.cr-dotp {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--surface);
  cursor: pointer;
}
.cr-ticks {
  position: relative;
  height: 16px;
  margin: 0 8px;
}
.cr-ticks span {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-2);
}

/* ── DIBELS ── */
.cr-win {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
@media (max-width: 560px) {
  .cr-win {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}
.cr-segs {
  display: flex;
  gap: 2px;
  border-radius: 6px;
  overflow: hidden;
}
.cr-seg {
  min-width: 28px;
  height: 36px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.cr-win-empty {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px var(--divider-strong);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-2);
}
.cr-moved {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 6px 0 0 144px;
  font-size: var(--text-sm);
}
.cr-moved > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cr-moved b {
  font-size: var(--text-md);
}
@media (max-width: 560px) {
  .cr-moved {
    padding-left: 0;
  }
}
.cr-move {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
}
