/* Gradebook module: grid, mark entry, exams, report cards, analysis. */

.gb-toolbar { flex-wrap: wrap; gap: .5rem; }
.gb-scroll { overflow: auto; max-height: 72vh; }
.gb-grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.gb-grid th, .gb-grid td { white-space: nowrap; }
.gb-grid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; vertical-align: bottom; }
.gb-grid thead tr:nth-child(2) th { top: 2.05rem; }
.gb-grid .gb-sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 12rem; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); }
.gb-grid thead .gb-sticky { z-index: 3; background: var(--surface-2); }
.gb-grid tfoot td { background: var(--surface-2); position: sticky; bottom: 0; }
.gb-grid tfoot .gb-sticky { z-index: 2; background: var(--surface-2); }
.gb-grid .gb-cat { text-align: center; border-bottom: 2px solid var(--accent); font-size: .78rem; }
.gb-grid .gb-col { min-width: 5.2rem; max-width: 9rem; white-space: normal; font-size: .8rem; line-height: 1.2; }
.gb-grid .gb-col a { color: var(--text); font-weight: 600; }
.gb-colmeta { color: var(--muted); font-weight: 400; font-size: .72rem; margin-top: .15rem; }
.gb-flags { color: var(--muted); display: flex; gap: .2rem; margin-top: .15rem; min-height: 12px; }
.gb-flags .gb-src { color: var(--purple); }
.gb-grid .gb-summary { background: var(--accent-soft); }
.gb-grid thead .gb-summary { background: #dcebf5; }
.gb-grid tbody tr:hover td { background: #f3f7fb; }
.gb-grid tbody tr:hover .gb-summary { background: #d6e8f4; }
.gb-cell { text-align: right; font-variant-numeric: tabular-nums; }
.gb-cell sup { color: var(--purple); }
.gb-cell.tone-red { background: var(--red-soft); }
.gb-cell.tone-amber { background: var(--amber-soft); }
.gb-in { width: 4.6rem; padding: .22rem .35rem !important; text-align: right; font-variant-numeric: tabular-nums; }
.gb-in.gb-bad { border-color: var(--red) !important; background: var(--red-soft); }
.gb-in.gb-changed { background: #fffbe6; border-color: var(--amber); }

.gb-marks .gb-mark { width: 6rem; text-align: right; font-size: 1rem; font-variant-numeric: tabular-nums; }
.gb-marks .gb-mark.gb-bad { border-color: var(--red); background: var(--red-soft); }
.gb-marks .gb-status { width: 9.5rem; }
.gb-marks .gb-comment { width: 100%; min-width: 12rem; }
.gb-marks tr.gb-row-changed td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.gb-marks tr.gb-row-focus td { background: var(--accent-soft); }
kbd { font-family: inherit; font-size: .78rem; background: var(--grey-soft); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; }

/* grade distribution bar */
.gb-dist { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: var(--grey-soft); font-size: .68rem; line-height: 16px; color: #fff; text-align: center; font-weight: 600; }
.gb-dist span { display: block; min-width: 2px; }
.gb-dist-0 { background: #0f7a4a; } .gb-dist-1 { background: #178a55; } .gb-dist-2 { background: #3aa574; } .gb-dist-3 { background: #1f6fd1; }
.gb-dist-4 { background: #6b8fd6; } .gb-dist-5 { background: #d98a1a; } .gb-dist-6 { background: #cf3f3f; }

/* exams */
.exam-table input[type=date] { width: 9.2rem; }
.exam-table input[type=time] { width: 6.4rem; }
.exam-table tr.exam-clash td { background: var(--red-soft); }

/* report cards */
.rc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
.rc-layout .rc-edit { position: sticky; top: 1rem; }
.rc-preview .rc-sheet { margin: 0; }
.rc-bank { margin-top: .3rem; font-size: .82rem; max-width: 100%; }
.rc-comment-table textarea { width: 100%; min-height: 4.2rem; }
.rc-conduct-row { display: flex; justify-content: space-between; gap: .4rem; align-items: center; margin-bottom: .2rem; }
.rc-conduct-row select { width: auto; padding: .15rem .3rem; font-size: .8rem; }
@media (max-width: 1100px) { .rc-layout { grid-template-columns: 1fr; } .rc-layout .rc-edit { position: static; } }

/* portal trend */
.gb-trend { display: flex; gap: .8rem; align-items: flex-end; justify-content: space-around; text-align: center; }
.gb-trend-col { flex: 1; }
.gb-trend-bar-wrap { height: 110px; display: flex; align-items: flex-end; justify-content: center; background: var(--surface-2); border-radius: 6px; }
.gb-trend-bar { width: 60%; border-radius: 5px 5px 0 0; background: var(--accent); }
.gb-trend-bar.tone-bg-green { background: var(--green); } .gb-trend-bar.tone-bg-blue { background: var(--blue); }
.gb-trend-bar.tone-bg-amber { background: var(--amber); } .gb-trend-bar.tone-bg-red { background: var(--red); } .gb-trend-bar.tone-bg-grey { background: var(--faint); }

.gb-broadsheet td, .gb-broadsheet th { white-space: nowrap; }

@media print {
    .gb-scroll { max-height: none; overflow: visible; }
    .gb-grid thead th, .gb-grid .gb-sticky, .gb-grid tfoot td { position: static; }
    .rc-layout { display: block; } .rc-edit { display: none; }
}
