/* Print Grades: the class grade sheet (teacher/grades-print.js).

   The pages render into #grades-print-root, kept off screen, and become the
   only thing on the page while body.grades-print-active is set. Every page
   is a box the size of the paper's printable area, portrait, in inches, and
   every row and column has the height or width grades-print.js gives it, so
   its arithmetic is the layout. Laid out like MyEd's class list with grid.
   Black and white only. */

#grades-print-root {
  position: absolute;
  top: 0;
  left: -30000px;
  pointer-events: none;
  background: #fff;
  color: #000;
}

/* ── Page ─────────────────────────────────────────────────── */
.gp-page {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, 'Liberation Sans', sans-serif;
  line-height: 1.2;
  break-after: page;
  page-break-after: always;
  break-inside: avoid;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.gp-page:last-child {
  break-after: auto;
  page-break-after: auto;
}

/* ── Header ───────────────────────────────────────────────── */
.gp-head {
  flex: 0 0 auto;
  box-sizing: border-box;
  border-top: 1pt solid #000;
  overflow: hidden;
  font-size: 9pt;
}
.gp-head-school {
  height: 0.2in;
  padding-top: 0.03in;
  text-align: right;
  font-size: 10pt;
  font-weight: 700;
  white-space: nowrap;
}
.gp-head-title {
  height: 0.27in;
  text-align: center;
  font-size: 14pt;
  font-weight: 700;
  white-space: nowrap;
}
.gp-head-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 0.2in;
  border-bottom: 1pt solid #000;
  white-space: nowrap;
}
.gp-info {
  display: grid;
  grid-template-columns: 3.4fr 2.4fr 1.6fr;
  column-gap: 0.15in;
  row-gap: 0.03in;
  padding: 0.06in 0.02in 0;
  font-size: 8.5pt;
}
.gp-info-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gp-info-item b {
  font-weight: 700;
}

/* ── Grid ─────────────────────────────────────────────────── */
.gp-grid {
  flex: 0 0 auto;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.gp-grid th,
.gp-grid td {
  box-sizing: border-box;
  border: 0.75pt solid #000;
  padding: 0 0.04in;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
}

/* The band of categories over the columns. */
.gp-band th {
  padding: 0 0.04in;
  font-size: var(--gp-head-pt);
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
}
.gp-band .gp-corner {
  border-top: none;
  border-left: none;
  border-right: none;
}
.gp-band .gp-band-blank {
  border-top: none;
  border-right: none;
}
/* Over a grid with no assessments the band row is empty: no rule at all. */
.gp-band .gp-band-blank:not(.gp-cat-start) {
  border-left: none;
}

/* Column heads: the title reads up the column; date and out of below. */
.gp-colhead th {
  padding: 0;
  vertical-align: bottom;
  font-size: var(--gp-head-pt);
  font-weight: 400;
}
.gp-ch-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: var(--gp-colhead);
  padding: 0.04in 0.01in 0.03in;
  box-sizing: border-box;
  line-height: 1.1;
}
.gp-ch-turn {
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  overflow: hidden;
  text-align: start;
}
.gp-ch-turn div {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gp-ch-below {
  flex: 0 0 auto;
  height: 1.1em;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
.gp-rh {
  padding: 0 0.05in 0.04in !important;
  text-align: left;
  vertical-align: bottom !important;
  font-size: 8.5pt !important;
  font-weight: 700 !important;
}
.gp-rh-no {
  text-align: right !important;
}

/* Rows. */
.gp-row td,
.gp-avg td {
  height: var(--gp-row);
  line-height: 1.15;
}
.gp-no {
  text-align: right;
}
.gp-name {
  text-overflow: ellipsis;
}
.gp-cell {
  text-align: center;
}
.gp-late {
  margin-left: 0.02in;
  font-size: 0.85em;
  font-weight: 700;
}
.gp-sub {
  font-size: 0.85em;
}

/* The class average row. */
.gp-avg td {
  border-top: 1.5pt solid #000;
  font-weight: 700;
}
.gp-avg-label {
  text-align: left;
}

/* Heavier verticals between categories. */
.gp-grid .gp-block-start {
  border-left: 1.25pt solid #000;
}
.gp-grid .gp-cat-start {
  border-left: 1.25pt solid #000;
}
/* Attendance: a clear break between weeks, and dates a size up. */
.gp-attendance .gp-grid .gp-cat-start {
  border-left-width: 2pt;
}
.gp-attendance .gp-ch-turn {
  font-size: 8pt;
}
.gp-grid .gp-final {
  border-left: 2pt solid #000;
  text-align: center;
  font-weight: 700;
}
.gp-band .gp-final {
  border-top: none;
}

/* ── Key ──────────────────────────────────────────────────── */
.gp-key {
  margin-top: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  font-size: 7pt;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Options dialog ───────────────────────────────────────── */
/* The box is One Print Box (teacher/print-box.css). Here: the page picture
   and the on/off switch other screens share. */

/* The page picture. Paper is white in either theme, so its greys are fixed
   like the printed sheet's. */
.gpd-thumb {
  --gpd-ink: #1d1d1f;
  --gpd-line: #c7c7cc;
  --gpd-rule: #e5e5ea;
  --gpd-mark: #8e8e93;
  --gpd-head: #ececf0;
  height: 274px;
  box-sizing: border-box;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 14px 12px;
  background: #fff;
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}
.gpd-thumb i {
  display: block;
  border-radius: 1px;
}
.gpd-t-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.gpd-t-title {
  width: 40%;
  height: 5px;
  background: var(--gpd-ink);
}
.gpd-t-date {
  width: 18%;
  height: 3px;
  background: var(--gpd-mark);
}
.gpd-t-row {
  display: grid;
  grid-template-columns: var(--gpd-t-cols);
  column-gap: 1px;
  align-items: center;
}
.gpd-t-colhead {
  margin-top: 4px;
  column-gap: 2px;
}
.gpd-t-colhead .gpd-t-cell {
  height: 10px;
  align-items: flex-end;
  background: var(--gpd-head);
}
/* A titled column's title, turned to read up the column. */
.gpd-t-colhead .gpd-t-cell i {
  width: 1px;
  max-width: none;
  height: 7px;
  margin-bottom: 1px;
  background: var(--gpd-mark);
}
/* The heavier rule where a category or an attendance week begins. */
.gpd-t-brk {
  box-shadow: -1px 0 0 var(--gpd-ink);
}
.gpd-t-rows {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--gpd-line);
}
.gpd-t-rows .gpd-t-row {
  flex: 1 1 0;
  min-height: 0;
  border-bottom: 1px solid var(--gpd-rule);
}
.gpd-t-cell,
.gpd-t-name {
  min-width: 0;
  display: flex;
  justify-content: center;
}
.gpd-t-name {
  justify-content: flex-start;
}
.gpd-t-name i {
  height: 3px;
  background: var(--gpd-mark);
}
.gpd-t-cell i {
  width: 50%;
  max-width: 5px;
  height: 2px;
  background: var(--gpd-line);
}
.gpd-t-final i {
  max-width: 7px;
  background: var(--gpd-mark);
}
.gpd-t-rows .gpd-t-avg {
  border-top: 1px solid var(--gpd-mark);
}
.gpd-t-avg .gpd-t-name i {
  width: 70%;
  background: var(--gpd-ink);
}
.gpd-t-avg .gpd-t-cell i {
  background: var(--gpd-mark);
}
.gpd-t-foot {
  display: flex;
  justify-content: space-between;
}
.gpd-t-foot i {
  width: 28%;
  height: 3px;
  background: var(--gpd-line);
}
.gpd-t-foot i + i {
  width: 10%;
}

/* The switch: one control for every on or off choice here. */
.gpd-switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
}
.gpd-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.gpd-switch input:disabled {
  cursor: default;
}
.gpd-switch-ui {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border-2);
  transition: background var(--duration-micro) var(--ease-out);
  pointer-events: none;
}
.gpd-switch-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform var(--duration-micro) var(--ease-out);
}
.gpd-switch input:checked + .gpd-switch-ui {
  background: var(--active);
}
.gpd-switch input:checked + .gpd-switch-ui::after {
  transform: translateX(16px);
}
.gpd-switch input:focus-visible + .gpd-switch-ui {
  outline: 2px solid var(--active);
  outline-offset: 2px;
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
  body.grades-print-active {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.grades-print-active > :not(#grades-print-root) {
    display: none !important;
  }
  body.grades-print-active #grades-print-root {
    position: static;
    left: auto;
    pointer-events: auto;
  }
}
