:root {
  --ink: #15251f;
  --muted: #65716c;
  --line: #d9dfdc;
  --soft: #f3f6f4;
  --paper: #ffffff;
  --green: #176b4b;
  --green-dark: #0f4e37;
  --green-soft: #e7f3ed;
  --gold: #c58d2c;
  --danger: #b44438;
  --shadow: 0 18px 50px rgba(29, 47, 39, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 0%, rgba(197, 141, 44, 0.1), transparent 25rem),
    #eef2ef;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 3rem 1.5rem;
}

.eyebrow,
.step-label {
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.55rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.school-location {
  margin: -0.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.button {
  min-height: 44px;
  padding: 0.7rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--green);
}

.button-primary:hover {
  background: var(--green-dark);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.admin-session-card {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0.15rem 0.65rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid #cfe0d7;
  border-radius: 10px;
  background: var(--green-soft);
}

.admin-session-card span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.admin-session-card strong {
  color: var(--green-dark);
  font-size: 0.82rem;
}

.admin-session-card .text-button {
  padding: 0;
  color: var(--green);
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 3rem 4rem;
}

.editor-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(21, 37, 31, 0.08);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.tab-list {
  display: flex;
  gap: 0.3rem;
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.tab-button {
  padding: 0.75rem 1rem;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 750;
}

.tab-button:hover,
.tab-button.active {
  color: var(--green-dark);
  background: #fff;
}

.settings-header-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  margin: auto 0 auto auto;
  padding: 8px;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  transition:
    color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.settings-header-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.settings-header-button:hover {
  color: var(--green-dark);
  background: #fff;
  transform: rotate(18deg);
}

.settings-header-button.settings-active {
  color: #fff;
  background: var(--green);
}

.settings-header-button:focus-visible {
  outline: 3px solid rgba(38, 104, 76, 0.24);
  outline-offset: 2px;
}

.editor-panel {
  display: none;
  padding: 2.2rem;
}

.editor-panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-right: 1rem;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.score-entry-title-row {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.75rem;
  max-width: 100%;
}

.score-entry-title-row h2 {
  min-width: 0;
  flex: 0 1 auto;
}

.panel-heading > p {
  max-width: 440px;
  margin: 1.25rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  gap: 1.15rem;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.development-details-grid {
  margin-top: 1.15rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field > span {
  color: #34433d;
  font-size: 0.85rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea,
.table-input,
.table-select {
  width: 100%;
  color: var(--ink);
  border: 1px solid #cbd3cf;
  border-radius: 8px;
  outline: none;
  background: #fff;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.field input,
.field select {
  min-height: 44px;
  padding: 0.65rem 0.75rem;
}

.field textarea {
  padding: 0.75rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.table-input:focus,
.table-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 75, 0.12);
}

.field-span-2 {
  grid-column: span 2;
}

.compact-panel-heading {
  margin-bottom: 1.25rem;
}

.heading-class-selector {
  width: min(280px, 100%);
  margin-top: 0.8rem;
}

.heading-class-selector select {
  font-weight: 750;
}

.class-selection-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 420px);
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 180px;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(231, 243, 237, 0.9), rgba(255, 255, 255, 0.96));
}

.class-selection-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  color: #fff;
  border-radius: 18px;
  background: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.class-selection-content .field > span {
  font-size: 0.95rem;
}

.class-selection-content select {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 750;
}

.class-selection-content p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.inline-link-button {
  padding: 0;
  color: var(--green);
  border: 0;
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-section-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.settings-section-card + .settings-section-card,
.settings-admin-grid,
.settings-manual-student,
.settings-maintenance {
  margin-top: 1rem;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.settings-section-heading h3,
.settings-maintenance h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.settings-section-heading > span {
  padding: 0.3rem 0.5rem;
  color: var(--green-dark);
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
}

.settings-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1rem;
}

.settings-admin-grid .settings-section-card {
  margin-top: 0;
}

.settings-rule {
  margin-top: 1.1rem;
  padding: 0.9rem;
  border-radius: 9px;
  background: var(--soft);
}

.settings-rule p {
  margin-bottom: 0.2rem;
}

.settings-rule strong {
  color: var(--green-dark);
  font-size: 0.9rem;
}

.teacher-class-list {
  margin-top: 1rem;
}

.settings-helper {
  margin: -0.35rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.settings-student-database {
  margin-top: 1rem;
}

.admin-student-table th:nth-child(1),
.admin-student-table td:nth-child(1) {
  width: 18%;
  text-align: left;
}

.admin-student-table th:nth-child(2),
.admin-student-table td:nth-child(2) {
  width: 34%;
  text-align: left;
}

.admin-student-table th:nth-child(3),
.admin-student-table td:nth-child(3) {
  width: 12%;
  text-align: left;
}

.admin-student-table th:nth-child(4),
.admin-student-table td:nth-child(4) {
  width: 18%;
  text-align: left;
}

.admin-student-table th:last-child,
.admin-student-table td:last-child {
  width: 90px;
  text-align: right;
}

.admin-student-input {
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 0.6rem;
  color: var(--ink);
  border: 1px solid #cbd3cf;
  border-radius: 7px;
  outline: none;
  background: #fff;
}

.admin-student-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 75, 0.1);
}

.settings-maintenance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--soft);
}

.settings-maintenance p:last-child {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.settings-maintenance-actions {
  display: flex;
  gap: 0.6rem;
}

.danger-button {
  color: var(--danger);
  border-color: #e5c1bd;
}

.section-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.compact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2rem;
  padding: 1.2rem 1.3rem;
}

.compact-card h3 {
  margin-bottom: 0.25rem;
}

.compact-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.weight-controls {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
}

.weight-controls .field {
  width: 120px;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 2rem;
}

.input-suffix > span {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  color: var(--muted);
  transform: translateY(-50%);
}

.weight-total {
  min-width: 112px;
  margin-bottom: 0.1rem;
  padding: 0.75rem;
  color: var(--green-dark);
  border-radius: 8px;
  background: var(--green-soft);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.weight-total.invalid {
  color: var(--danger);
  background: #f9e9e7;
}

.formula-chips {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.formula-chips > span:not(.formula-plus, .formula-equals) {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.65rem 0.8rem;
  color: var(--green-dark);
  border: 1px solid #c8dbd1;
  border-radius: 9px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 750;
}

.formula-chips strong {
  font-size: 1.15rem;
}

.formula-plus,
.formula-equals {
  color: var(--muted);
  font-weight: 800;
}

.roster-workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.class-manager-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.class-manager-card {
  align-self: start;
  background: var(--soft);
}

.inline-create,
.add-student-row {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.inline-create {
  grid-template-columns: minmax(0, 1fr) auto;
}

.add-student-row {
  grid-template-columns: 150px minmax(180px, 1fr) auto;
  margin: 0 0 1rem;
}

.inline-create input,
.add-student-row input,
.roster-input {
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.65rem;
  color: var(--ink);
  border: 1px solid #cbd3cf;
  border-radius: 7px;
  outline: none;
  background: #fff;
}

.inline-create input:focus,
.add-student-row input:focus,
.roster-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 75, 0.1);
}

.text-button,
.icon-button {
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 750;
}

.class-manager-card .text-button {
  margin-top: 0.8rem;
}

.manager-note,
.roster-order-help {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.manager-note {
  margin: 0.8rem 0;
}

.roster-order-help {
  margin: -0.3rem 0 0.8rem;
}

.admin-tools {
  border-top: 1px solid #d5dcd8;
  padding-top: 0.7rem;
}

.admin-tools summary {
  color: #52625b;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.csv-admin-tools {
  margin-bottom: 0.85rem;
}

.csv-importer {
  display: grid;
  gap: 0.75rem;
  padding-top: 0.75rem;
}

.csv-importer > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.csv-file-picker {
  display: grid;
  gap: 0.4rem;
}

.csv-file-picker > span {
  color: #34433d;
  font-size: 0.78rem;
  font-weight: 750;
}

.csv-file-picker input {
  width: 100%;
  padding: 0.5rem;
  color: var(--muted);
  border: 1px dashed #aebcb5;
  border-radius: 8px;
  background: #fff;
  font-size: 0.72rem;
}

.csv-file-picker input::file-selector-button {
  margin-right: 0.55rem;
  padding: 0.45rem 0.6rem;
  color: var(--green-dark);
  border: 1px solid #c8dbd1;
  border-radius: 6px;
  background: var(--green-soft);
  font-weight: 800;
  cursor: pointer;
}

.csv-import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.csv-import-actions .button {
  min-height: 40px;
  padding: 0.55rem;
  font-size: 0.72rem;
}

.csv-import-actions .button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.csv-preview {
  overflow: hidden;
  border: 1px solid #d5dcd8;
  border-radius: 8px;
  background: #fff;
}

.csv-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem;
  border-bottom: 1px solid #e2e7e4;
}

.csv-preview-summary strong {
  width: 100%;
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-preview-summary span {
  padding: 0.22rem 0.4rem;
  border-radius: 999px;
  background: var(--soft);
  font-size: 0.64rem;
  font-weight: 750;
}

.csv-preview-summary .csv-valid-count {
  color: var(--green-dark);
  background: var(--green-soft);
}

.csv-preview-summary .csv-error-count {
  color: #842f27;
  background: #fbe9e7;
}

.csv-error-list {
  padding: 0.6rem;
  color: #842f27;
  background: #fff7f6;
}

.csv-error-list p {
  margin: 0 0 0.25rem;
  font-size: 0.68rem;
  line-height: 1.4;
}

.csv-error-list p:last-child {
  margin-bottom: 0;
}

.csv-preview-table-wrap {
  max-height: 190px;
  overflow: auto;
}

.csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.65rem;
}

.csv-preview-table th,
.csv-preview-table td {
  padding: 0.4rem;
  border-bottom: 1px solid #edf0ee;
  text-align: left;
  white-space: nowrap;
}

.csv-preview-table th {
  color: var(--muted);
  background: var(--soft);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.csv-import-success {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem;
  color: var(--green-dark);
  background: var(--green-soft);
}

.csv-import-success strong {
  font-size: 0.8rem;
}

.csv-import-success span {
  font-size: 0.68rem;
}

.roster-admin-tools {
  margin-bottom: 0.8rem;
}

.danger-text {
  color: var(--danger);
}

.roster-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th {
  padding: 0.6rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.68rem;
  text-align: left;
  text-transform: uppercase;
}

.roster-table th:nth-child(1),
.roster-table td:nth-child(1) {
  width: 52px;
  text-align: center;
}

.roster-table th:nth-child(2),
.roster-table td:nth-child(2) {
  width: 62px;
  text-align: center;
}

.roster-table th:last-child,
.roster-table td:last-child {
  text-align: left;
}

.roster-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #e8ecea;
}

.teacher-roster-table td {
  height: 48px;
}

.teacher-roster-table th:nth-child(2),
.teacher-roster-table td:nth-child(2) {
  width: auto;
  text-align: left;
}

.student-name-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.student-name-heading #studentCountBadge {
  padding: 0.24rem 0.48rem;
  color: var(--green-dark);
  border-radius: 999px;
  background: var(--green-soft);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: none;
  white-space: nowrap;
}

.roster-value {
  color: #46534e;
  font-size: 0.82rem;
}

.roster-student-name {
  font-size: 0.86rem;
}

.roster-table tr:last-child td {
  border-bottom: 0;
}

.selected-roster-row td {
  background: #f0f8f4;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.45rem;
  color: #738078;
  border: 1px solid #d2d9d5;
  border-radius: 5px;
  background: #fff;
  font-weight: 900;
  letter-spacing: -0.08em;
  cursor: grab;
}

.drag-handle span {
  min-width: 1.2rem;
  color: var(--ink);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.drag-handle:active {
  cursor: grabbing;
}

.dragging-roster-row {
  opacity: 0.45;
}

.roster-drop-target td {
  border-top: 2px solid var(--green);
}

.empty-roster {
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.empty-roster[hidden] {
  display: none;
}

.panel-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.class-panel-footer {
  padding-top: 0;
  border-top: 0;
}

.preview-print-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.overall-grid {
  display: grid;
  gap: 1.25rem;
}

.overall-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.overall-card-header {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.overall-card-header h3 {
  margin: 0 0 0.2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.4rem;
  font-weight: 500;
}

.overall-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.overall-table-wrap {
  overflow-x: auto;
}

.overall-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.overall-table th,
.overall-table td {
  min-width: 76px;
  padding: 0.55rem 0.45rem;
  border-right: 1px solid #e1e7e4;
  border-bottom: 1px solid #e1e7e4;
  text-align: center;
  vertical-align: middle;
}

.overall-table th {
  color: #435049;
  background: #f3f6f4;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.overall-table td:first-child,
.overall-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 190px;
  background: #fff;
  text-align: left;
}

.overall-table th:first-child {
  z-index: 2;
  background: #f3f6f4;
}

.overall-table .overall-total-cell,
.overall-table .overall-rank-cell {
  color: var(--green-dark);
  font-weight: 850;
}

.overall-empty {
  padding: 2rem;
  color: var(--muted);
  border: 1px dashed #bcc8c2;
  border-radius: 12px;
  background: #fbfcfb;
  text-align: center;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.marks-editor-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.marks-editor-table th {
  padding: 0.75rem 0.55rem;
  color: #435049;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

.marks-editor-table th:not(:first-child) {
  text-align: center;
}

.marks-editor-table td {
  padding: 0.4rem;
  border-bottom: 1px solid #e5e9e7;
}

.marks-editor-table tr:last-child td {
  border-bottom: 0;
}

.marks-editor-table tr:hover td {
  background: #fbfcfb;
}

.subject-cell {
  min-width: 210px;
  font-weight: 750;
}

.table-input,
.table-select {
  min-width: 68px;
  height: 37px;
  padding: 0.4rem;
  text-align: center;
}

.calculated-cell {
  min-width: 72px;
  color: var(--green-dark);
  font-weight: 800;
  text-align: center;
}

.score-entry-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.subject-entry-sidebar {
  position: sticky;
  top: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-heading small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: none;
}

.subject-entry-nav {
  max-height: 72vh;
  overflow-y: auto;
  padding: 0.35rem;
}

.subject-entry-button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.68rem 0.55rem;
  color: #3f4d47;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.subject-entry-button:hover {
  background: var(--soft);
}

.subject-entry-button.active {
  color: var(--green-dark);
  background: var(--green-soft);
}

.subject-number {
  color: #87918c;
  font-size: 0.68rem;
  font-weight: 800;
}

.subject-button-name {
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-status {
  min-width: 26px;
  padding: 0.18rem 0.3rem;
  color: #77827d;
  border-radius: 999px;
  background: #edf0ee;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
}

.subject-status.started {
  color: #855c12;
  background: #fff1cf;
}

.subject-status.ready {
  color: var(--green-dark);
  background: #cfe8db;
}

.score-entry-mount {
  min-width: 0;
}

.subject-entry-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.subject-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem;
  color: #fff;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.06), transparent 45%),
    var(--green-dark);
}

.subject-entry-header h3 {
  margin: 0 0 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.subject-entry-header .step-label {
  color: #bde0cf;
}

.scheme-badge {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  color: #dcece4;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  font-size: 0.72rem;
}

.completion-badge {
  padding: 0.5rem 0.7rem;
  color: #ffe6ac;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.completion-badge.ready {
  color: #fff;
  background: rgba(110, 205, 158, 0.3);
}

.entry-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.entry-metric {
  min-width: 0;
  padding: 0.9rem 0.7rem;
  border-right: 1px solid var(--line);
  background: #fbfcfb;
  text-align: center;
}

.entry-metric:last-child {
  border-right: 0;
}

.entry-metric span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.entry-metric strong {
  color: var(--green-dark);
  font-size: 1.05rem;
}

.entry-metric.metric-green {
  background: var(--green-soft);
}

.entry-metric.metric-gold {
  background: #fff6df;
}

.entry-metric.metric-dark {
  background: #e3e9e6;
}

.entry-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.entry-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.entry-section-heading h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 500;
}

.entry-section-heading > p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.entry-control-grid {
  display: grid;
  grid-template-columns: 150px 210px minmax(240px, 1fr);
  align-items: end;
  gap: 0.8rem;
}

.class-average-help {
  min-height: 44px;
  padding: 0.65rem 0.8rem;
  color: #58645f;
  border-radius: 8px;
  background: var(--soft);
  font-size: 0.75rem;
  line-height: 1.35;
}

.class-average-help strong {
  display: block;
  color: var(--ink);
}

.ca-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.ca-category-card,
.task-entry-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.category-card-heading,
.task-entry-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.category-card-heading h4,
.task-entry-heading h4 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.category-card-heading p,
.task-entry-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.category-result {
  text-align: right;
  white-space: nowrap;
}

.category-result span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.category-result strong {
  color: var(--green-dark);
  font-size: 0.9rem;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 92px 92px;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.65rem;
  border-bottom: 1px solid #e7ebe9;
}

.score-row:last-child {
  border-bottom: 0;
}

.score-row label {
  font-size: 0.78rem;
  font-weight: 700;
}

.score-row-heading {
  color: var(--muted);
  background: #fbfcfb;
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.score-box,
.compact-field select,
.subskill-rating-controls select {
  width: 100%;
  height: 36px;
  padding: 0.35rem 0.45rem;
  color: var(--ink);
  border: 1px solid #cbd3cf;
  border-radius: 7px;
  outline: none;
  background: #fff;
}

.score-box {
  text-align: center;
}

.score-box:focus,
.compact-field select:focus,
.subskill-rating-controls select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 75, 0.1);
}

.exam-entry-grid {
  display: grid;
  grid-template-columns: 180px 180px minmax(160px, 1fr);
  gap: 0.8rem;
}

.exam-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  color: var(--green-dark);
  border-radius: 8px;
  background: var(--green-soft);
}

.exam-result span,
.exam-result small {
  font-size: 0.72rem;
}

.exam-result strong {
  font-size: 1.15rem;
}

.subskill-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.65rem;
}

.subskill-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem;
  color: #43514b;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.76rem;
  font-weight: 750;
}

.subskill-tab strong {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--green-dark);
  border-radius: 50%;
  background: var(--green-soft);
  font-size: 0.68rem;
}

.subskill-tab.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.subskill-tab.active strong {
  color: var(--green-dark);
  background: #fff;
}

.subskill-task-card {
  margin-top: 0.15rem;
}

.subskill-rating-controls {
  display: grid;
  grid-template-columns: 100px 105px 125px;
  align-items: end;
  gap: 0.55rem;
}

.compact-field,
.computed-achievement {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.compact-field > span,
.computed-achievement > span {
  color: #58645f;
  font-size: 0.68rem;
  font-weight: 750;
}

.computed-achievement strong {
  display: grid;
  height: 36px;
  place-items: center;
  color: var(--green-dark);
  border-radius: 7px;
  background: #dcece4;
}

.task-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.75rem;
}

.task-score-item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.65rem;
  border: 1px solid #e0e5e2;
  border-radius: 8px;
  background: #fbfcfb;
}

.task-score-item > strong {
  grid-column: 1 / -1;
  font-size: 0.77rem;
}

.task-score-item label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.task-score-item label span {
  color: var(--muted);
  font-size: 0.65rem;
}

.task-progress {
  display: flex;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--soft);
  font-size: 0.75rem;
}

.task-progress strong {
  color: var(--green-dark);
}

.parent-ca-summary {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1fr) 150px;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.8rem;
  color: #fff;
  border-radius: 9px;
  background: var(--green-dark);
}

.parent-ca-summary div {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: baseline;
}

.parent-ca-summary span {
  font-size: 0.7rem;
}

.parent-ca-summary strong {
  font-size: 1rem;
}

.parent-ca-summary p {
  margin: 0;
  color: #c7d9d1;
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
}

.rating-only-card {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 320px;
  align-items: center;
  gap: 2rem;
  min-height: 330px;
  padding: 2rem;
}

.rating-only-card h3 {
  margin-bottom: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.rating-only-card p:last-child {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.rating-only-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.subject-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: #fbfcfb;
}

.subject-entry-footer > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.subject-entry-footer button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.marks-summary-table td {
  text-align: center;
}

.marks-summary-table .subject-cell {
  text-align: left;
}

.summary-ready td {
  background: #fcfdfc;
}

.summary-incomplete td {
  background: #fffcf5;
}

.summary-subskill td {
  color: #57645e;
  background: #fafbfa;
  font-size: 0.78rem;
}

.incomplete-label {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.35rem;
  color: #8a6016;
  border-radius: 999px;
  background: #fff0c9;
  font-size: 0.58rem;
  text-transform: uppercase;
}

.class-entry-toolbar {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(210px, 1fr) minmax(210px, 1fr) minmax(180px, 0.75fr);
  align-items: end;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.heading-entry-toolbar {
  grid-template-columns: minmax(180px, 0.75fr) minmax(300px, 1.25fr);
  width: min(540px, 100%);
  margin: 0.8rem 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.class-entry-toolbar .field[hidden] {
  display: none;
}

.database-save-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 66px;
  padding: 0.6rem 0.8rem;
  color: var(--green-dark);
  border-radius: 8px;
  background: var(--green-soft);
}

.database-save-card span,
.database-save-card small {
  color: #587068;
  font-size: 0.66rem;
}

.database-save-card strong {
  margin: 0.1rem 0;
  font-size: 0.82rem;
}

.database-save-card strong[data-mode="error"] {
  color: var(--danger);
}

.database-save-card strong[data-mode="warning"] {
  color: #8a6016;
}

.class-gradebook-mount {
  min-height: 340px;
}

.gradebook-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.gradebook-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.1rem;
  color: #fff;
  background: var(--green-dark);
}

.gradebook-heading-tools {
  display: grid;
  min-width: 360px;
  justify-items: end;
  gap: 0.75rem;
}

.gradebook-settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.gradebook-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 0.65rem;
  width: min(100%, 420px);
}

.gradebook-action-buttons .button {
  min-height: 40px;
  color: var(--green-dark);
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.96);
}

.gradebook-action-buttons .button:hover {
  background: #fff;
}

.score-entry-progress {
  display: inline-flex;
  width: auto;
  padding: 0.16rem 0.48rem;
  border: 1px solid #efb9b2;
  border-radius: 999px;
  background: #fde8e6;
}

.score-entry-progress-copy {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.35rem;
  white-space: nowrap;
}

.score-entry-progress-copy span,
.score-entry-progress small {
  color: #8b332b;
  font-size: 0.78rem;
  font-weight: 700;
}

.score-entry-progress-copy strong {
  color: #8b332b;
  font-size: 0.78rem;
}

.score-entry-progress-track {
  height: 7px;
  margin: 0.45rem 0 0.35rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.score-entry-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #bde0cf;
  transition: width 160ms ease;
}

.score-entry-progress-top {
  width: auto;
  min-width: 0;
  margin-top: 0.28rem;
}

.score-entry-progress-top .score-entry-progress {
  width: auto;
  border-color: #efb9b2;
  background: #fde8e6;
}

.score-entry-progress-top .score-entry-progress-copy span,
.score-entry-progress-top .score-entry-progress small {
  color: #8b332b;
}

.score-entry-progress-top .score-entry-progress-copy strong {
  color: #8b332b;
}

.score-entry-progress-top .score-entry-progress-track {
  background: rgba(23, 107, 75, 0.14);
}

.score-entry-progress-top .score-entry-progress-track span {
  background: var(--green);
}

.gradebook-heading h3 {
  margin: 0 0 0.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 500;
}

.gradebook-heading p:last-child {
  margin: 0;
  color: #c8dcd3;
  font-size: 0.78rem;
}

.gradebook-heading .step-label {
  color: #bde0cf;
}

.gradebook-setting {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.gradebook-setting span {
  color: #d4e2dc;
  font-size: 0.72rem;
}

.gradebook-setting select {
  min-width: 70px;
  height: 36px;
  color: var(--ink);
  border: 0;
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.mobile-card-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gradebook-scroll {
  max-height: 68vh;
  overflow: auto;
}

.mobile-gradebook {
  display: none;
}

.mobile-card-modal {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(0.55rem, 2.4vw, 1.5rem);
  place-items: center;
}

.mobile-card-modal[hidden] {
  display: none;
}

.mobile-card-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(11, 26, 19, 0.46);
  backdrop-filter: blur(4px);
}

.mobile-card-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(720px, 100%);
  height: min(92vh, 780px);
  height: min(92dvh, 780px);
  max-height: calc(100vh - 1.1rem);
  max-height: calc(100dvh - 1.1rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 22px;
  background: #fbfdfc;
  box-shadow: 0 28px 90px rgba(15, 31, 24, 0.28);
}

.mobile-card-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.15rem 0.85rem;
  border-bottom: 1px solid #dfe8e3;
  background:
    linear-gradient(135deg, rgba(231, 243, 237, 0.96), rgba(255, 255, 255, 0.98));
}

.mobile-card-dialog-header p {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-card-dialog-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
}

.mobile-card-close {
  min-height: 36px;
  padding: 0.45rem 0.7rem;
  color: var(--green-dark);
  border: 1px solid #c8dbd1;
  border-radius: 999px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 850;
}

#mobileGradebookModalBody {
  min-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-card-dialog .mobile-gradebook {
  display: block;
  min-height: 100%;
  padding: 0.9rem 1rem 1.35rem;
  background: transparent;
}

.mobile-card-dialog .mobile-gradebook-nav {
  position: sticky;
  z-index: 2;
  bottom: 0;
  margin: 1rem -0.15rem 0;
  padding: 0.85rem 0 0.05rem;
  border-top: 1px solid #e2e9e5;
  background:
    linear-gradient(rgba(251, 253, 252, 0), #fbfdfc 18%),
    #fbfdfc;
}

.mobile-card-dialog .mobile-gradebook-fields,
.mobile-card-dialog .mobile-gradebook-results,
.mobile-card-dialog .mobile-maximum-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.mobile-card-dialog .gradebook-input,
.mobile-card-dialog .gradebook-select {
  min-height: 42px;
  font-size: 1rem;
}

.mobile-gradebook-modal-content {
  will-change: opacity, transform;
}

.mobile-gradebook-slide-out-left {
  animation: mobileCardSlideOutLeft 180ms ease forwards;
}

.mobile-gradebook-slide-out-right {
  animation: mobileCardSlideOutRight 180ms ease forwards;
}

.mobile-gradebook-slide-in-left {
  animation: mobileCardSlideInLeft 220ms ease both;
}

.mobile-gradebook-slide-in-right {
  animation: mobileCardSlideInRight 220ms ease both;
}

@keyframes mobileCardSlideOutLeft {
  to {
    opacity: 0;
    transform: translateX(-18%);
  }
}

@keyframes mobileCardSlideOutRight {
  to {
    opacity: 0;
    transform: translateX(18%);
  }
}

@keyframes mobileCardSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(-18%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes mobileCardSlideInRight {
  from {
    opacity: 0;
    transform: translateX(18%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.mobile-card-dialog .mobile-gradebook-card {
  border-color: #d4e1da;
  box-shadow: 0 12px 30px rgba(29, 47, 39, 0.08);
  touch-action: pan-y;
}

.mobile-card-dialog .mobile-maximum-panel {
  background: #fff;
}

.ocr-modal {
  position: fixed;
  z-index: 35;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.ocr-modal[hidden] {
  display: none;
}

.ocr-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 31, 24, 0.58);
  backdrop-filter: blur(5px);
}

.ocr-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(98vw, 1480px);
  max-height: min(96dvh, 980px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: #fbfdfc;
  box-shadow: 0 24px 70px rgba(15, 31, 24, 0.28);
}

.ocr-dialog-header,
.ocr-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #dfe8e3;
  background: #fff;
}

.ocr-dialog-footer {
  border-top: 1px solid #dfe8e3;
  border-bottom: 0;
}

.ocr-dialog-header p {
  margin: 0 0 0.25rem;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ocr-dialog-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  font-weight: 500;
}

.ocr-dialog-body {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.15rem 1.25rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.ocr-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}

.ocr-file-picker {
  display: grid;
  gap: 0.45rem;
}

.ocr-file-picker > span {
  color: #34433d;
  font-size: 0.85rem;
  font-weight: 750;
}

.ocr-file-picker input {
  width: 100%;
  padding: 0.6rem;
  color: var(--muted);
  border: 1px dashed #aebcb5;
  border-radius: 9px;
  background: #fff;
}

.ocr-file-picker input::file-selector-button {
  margin-right: 0.6rem;
  padding: 0.5rem 0.7rem;
  color: var(--green-dark);
  border: 1px solid #c8dbd1;
  border-radius: 7px;
  background: var(--green-soft);
  font-weight: 800;
  cursor: pointer;
}

.ocr-helper,
.ocr-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.ocr-status[data-mode="error"] {
  color: var(--danger);
  font-weight: 800;
}

.ocr-status[data-mode="success"] {
  color: var(--green-dark);
  font-weight: 800;
}

.ocr-image-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.ocr-image-preview img {
  display: block;
  max-height: 220px;
  max-width: 100%;
  margin: 0 auto;
  object-fit: contain;
}

.ocr-preview {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.ocr-preview:not(:empty) {
  max-height: min(58dvh, 560px);
  min-height: 260px;
  padding: 0.8rem;
  border: 1px solid #cfded6;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(13, 87, 58, 0.03);
}

.ocr-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.ocr-preview-summary span {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.ocr-preview-summary .ocr-ok-count {
  color: var(--green-dark);
  background: var(--green-soft);
}

.ocr-preview-summary .ocr-review-count {
  color: #842f27;
  background: #fbe9e7;
}

.ocr-preview-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.95rem;
}

.ocr-preview-table th,
.ocr-preview-table td {
  padding: 0.75rem 0.8rem;
  border: 1px solid #dfe8e3;
  text-align: center;
  vertical-align: middle;
}

.ocr-preview-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #435049;
  background: var(--soft);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ocr-preview-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  text-align: left;
  font-weight: 750;
  background: #fff;
}

.ocr-preview-table th:first-child {
  left: 0;
  z-index: 3;
  min-width: 210px;
}

.ocr-cell-empty {
  color: #8d9692;
}

.ocr-cell-review {
  color: #842f27;
  background: #fff1f0;
  font-weight: 850;
}

.ocr-cell-low {
  background: #fff8df;
}

body.mobile-card-modal-open,
body.ocr-modal-open {
  overflow: hidden;
}

.class-gradebook {
  width: 100%;
  min-width: 850px;
  border-collapse: separate;
  border-spacing: 0;
}

.class-gradebook th,
.class-gradebook td {
  min-width: 88px;
  height: 48px;
  padding: 0.35rem;
  border-right: 1px solid #dfe4e1;
  border-bottom: 1px solid #dfe4e1;
  background: #fff;
  font-size: 0.77rem;
  text-align: center;
  vertical-align: middle;
}

.class-gradebook thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  height: 42px;
  color: #44534d;
  background: var(--soft);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.class-gradebook thead .maximum-row th {
  top: 42px;
  height: 43px;
  color: #64716c;
  background: #e8eeeb;
  text-transform: none;
}

.class-gradebook .sticky-name {
  position: sticky;
  z-index: 2;
  left: 0;
  min-width: 190px;
  max-width: 190px;
  text-align: left;
}

.class-gradebook thead .sticky-name {
  z-index: 5;
}

.student-name-cell strong,
.student-name-cell small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-name-cell small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.65rem;
}

.class-gradebook td.selected-gradebook-cell {
  position: relative;
  background: #dff1e7 !important;
  box-shadow: inset 0 0 0 2px var(--green);
}

.class-gradebook td.selected-gradebook-cell .gradebook-input,
.class-gradebook td.selected-gradebook-cell .gradebook-select {
  background: #f5fbf8;
}

.selecting-gradebook-cells {
  user-select: none;
}

.gradebook-input,
.maximum-input,
.gradebook-select {
  width: 100%;
  height: 34px;
  padding: 0.3rem 0.35rem;
  color: var(--ink);
  border: 1px solid #cbd3cf;
  border-radius: 6px;
  outline: none;
  background: #fff;
  text-align: center;
}

.maximum-input {
  height: 30px;
  color: var(--green-dark);
  border-color: #b9cac1;
  font-size: 0.72rem;
  font-weight: 800;
}

.gradebook-input:focus,
.maximum-input:focus,
.gradebook-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(23, 107, 75, 0.12);
}

.gradebook-input:required:invalid,
.maximum-input:required:invalid,
.gradebook-select:required:invalid {
  border-color: #d88ca4;
  background: #fde7ee;
}

.gradebook-input:required:invalid:focus,
.maximum-input:required:invalid:focus,
.gradebook-select:required:invalid:focus {
  border-color: #bd597b;
  box-shadow: 0 0 0 2px rgba(189, 89, 123, 0.15);
}

.class-gradebook tbody tr:hover td {
  background: #f8fbf9;
}

.class-gradebook tbody tr:hover .sticky-name {
  background: #f0f8f4;
}

.result-grade {
  color: var(--green-dark);
  background: #f1f8f4 !important;
  font-size: 0.95rem !important;
  font-weight: 900;
}

.wide-gradebook {
  min-width: 980px;
}

.structured-gradebook {
  min-width: 1980px;
}

.structured-gradebook th,
.structured-gradebook td {
  min-width: 78px;
}

.compact-gradebook {
  min-width: 560px;
}

.compact-gradebook th:not(.sticky-name),
.compact-gradebook td:not(.sticky-name) {
  min-width: 160px;
}

.mobile-gradebook {
  padding: 0.9rem;
  background: #f7faf8;
}

.mobile-maximum-panel {
  margin: 1rem 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.mobile-maximum-panel summary {
  padding: 0.8rem 0.9rem;
  color: var(--green-dark);
  font-weight: 850;
  cursor: pointer;
}

.mobile-maximum-grid,
.mobile-gradebook-fields,
.mobile-gradebook-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mobile-maximum-grid {
  padding: 0 0.9rem 0.9rem;
}

.mobile-gradebook-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.mobile-gradebook-nav > span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.mobile-gradebook-nav button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.mobile-gradebook-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.mobile-gradebook-student {
  display: grid;
  gap: 0.18rem;
  margin-bottom: 0.95rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #dbe7e1;
  border-radius: 12px;
  background: #f3f8f5;
  text-align: center;
}

.mobile-gradebook-student strong {
  overflow: hidden;
  color: var(--green-dark);
  font-size: 1.08rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-gradebook-student span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mobile-gradebook-fields {
  margin-bottom: 1rem;
}

.mobile-gradebook-field,
.mobile-maximum-field {
  display: grid;
  gap: 0.4rem;
}

.mobile-gradebook-field span,
.mobile-maximum-field span,
.mobile-gradebook-result span {
  color: #52615b;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mobile-gradebook-result {
  display: grid;
  gap: 0.25rem;
  min-height: 58px;
  padding: 0.65rem 0.7rem;
  border: 1px solid #dfe8e3;
  border-radius: 10px;
  background: #f3f8f5;
}

.mobile-gradebook-result strong {
  color: var(--green-dark);
  font-size: 1rem;
}

.empty-gradebook {
  display: grid;
  min-height: 340px;
  place-items: center;
  align-content: center;
  gap: 0.5rem;
  padding: 2rem;
  color: var(--muted);
  border: 1px dashed #bcc8c2;
  border-radius: 12px;
  background: #fbfcfb;
  text-align: center;
}

.empty-gradebook h3 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 500;
}

.empty-gradebook p {
  margin: 0 0 0.5rem;
}

.heading-student-selector {
  width: min(360px, 100%);
  margin-top: 0.8rem;
  padding: 0;
}

.heading-student-selector .field {
  width: 100%;
}

.marks-student-selector {
  width: min(360px, 100%);
}

.class-chooser {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  padding: 1rem;
  place-items: center;
  background: rgba(14, 31, 24, 0.72);
  backdrop-filter: blur(5px);
}

.class-chooser[hidden] {
  display: none;
}

.class-chooser-card {
  width: min(520px, 100%);
  padding: 1.5rem;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(5, 18, 12, 0.3);
}

.class-chooser-card h2 {
  margin-bottom: 0.4rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.class-chooser-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.5;
}

.class-chooser-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.class-chooser-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--soft);
  text-align: left;
}

.class-chooser-list button:hover {
  color: var(--green-dark);
  border-color: #a9caba;
  background: var(--green-soft);
}

.class-chooser-list span {
  color: var(--muted);
  font-size: 0.72rem;
}

.admin-auth-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 31, 24, 0.58);
  backdrop-filter: blur(5px);
}

.admin-auth-modal[hidden] {
  display: none;
}

.admin-auth-card {
  width: min(100%, 430px);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 31, 24, 0.28);
}

.admin-auth-card h2 {
  margin-bottom: 0.45rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.admin-auth-card > p:not(.eyebrow, .admin-auth-error) {
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.admin-auth-card .field + .field {
  margin-top: 0.85rem;
}

.admin-auth-card .field[hidden] {
  display: none;
}

.admin-auth-error {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  color: var(--danger);
  font-size: 0.76rem;
  font-weight: 700;
}

.admin-auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.65rem;
}

.development-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.4rem;
}

.rating-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.rating-card h3 {
  margin: 0;
  padding: 1rem 1.1rem;
  color: #fff;
  background: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.rating-editor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 152px;
  align-items: center;
  gap: 0.8rem;
  min-height: 58px;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.rating-editor-row:last-child {
  border-bottom: 0;
}

.rating-editor-row p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
}

.rating-options {
  display: flex;
  gap: 0.25rem;
}

.rating-option {
  display: grid;
  width: 46px;
  height: 34px;
  place-items: center;
  color: var(--muted);
  border: 1px solid #cad3ce;
  border-radius: 7px;
  background: #fff;
  font-size: 0.73rem;
  font-weight: 800;
  cursor: pointer;
}

.rating-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.rating-option:has(input:checked) {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.development-grid + .field,
.development-grid + .field + .field {
  margin-top: 1rem;
}

.development-student-selector {
  margin-bottom: 0;
}

.report-pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.report-page {
  position: relative;
  min-height: 297mm;
  padding: 12mm;
  color: #17201d;
  border: 1px solid #d5d9d7;
  background: var(--paper);
  box-shadow: 0 10px 30px rgba(28, 42, 36, 0.1);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9.5px;
}

.report-letterhead {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid #173f31;
  text-align: center;
}

.school-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  border-radius: 50%;
  background: #176b4b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
}

.report-letterhead h2 {
  margin: 0 0 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 600;
}

.report-letterhead p {
  margin: 0;
  color: #4c5a55;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-title {
  margin: 10px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  text-align: center;
  text-transform: uppercase;
}

.student-summary {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4px 16px;
  margin-bottom: 8px;
  padding: 7px 8px;
  border: 1px solid #66736e;
  background: #f5f7f6;
}

.student-summary p {
  margin: 0;
  line-height: 1.35;
}

.student-summary strong {
  display: inline-block;
  min-width: 58px;
  color: #33423c;
}

.report-section-title {
  margin: 8px 0 4px;
  padding: 4px 6px;
  color: #fff;
  background: #173f31;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.report-table th,
.report-table td {
  height: 18px;
  padding: 2px 3px;
  border: 1px solid #4c5753;
  text-align: center;
  vertical-align: middle;
}

.report-table th {
  background: #e9eeeb;
  font-size: 7.6px;
  line-height: 1.1;
}

.report-table td:first-child,
.report-table .text-left {
  text-align: left;
}

.report-table .subject-name {
  font-weight: 700;
  text-transform: uppercase;
}

.report-table .subskill {
  padding-left: 10px;
  font-size: 8px;
}

.report-table .subskill::before {
  content: "• ";
}

.grade-key {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr);
  margin-top: 8px;
  border: 1px solid #4c5753;
}

.grade-key > div {
  display: grid;
  min-height: 24px;
  place-items: center;
  padding: 3px;
  border-right: 1px solid #4c5753;
  font-size: 8px;
  text-align: center;
}

.grade-key > div:last-child {
  border-right: 0;
}

.grade-key .key-label {
  padding-inline: 7px;
  color: #fff;
  background: #173f31;
  font-weight: 700;
}

.grade-key strong {
  display: block;
}

.rating-report-table th:first-child {
  width: 54%;
}

.rating-report-table td {
  height: 22px;
}

.rating-report-table td:first-child {
  padding-left: 5px;
}

.rating-tick {
  color: #0f4e37;
  font-size: 13px;
  font-weight: 900;
}

.report-note-box {
  min-height: 48px;
  padding: 6px;
  border: 1px solid #4c5753;
  line-height: 1.45;
  white-space: pre-wrap;
}

.report-footer-fields {
  margin-top: 10px;
}

.signature-line {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: end;
  min-height: 28px;
}

.signature-line span:last-child {
  min-height: 18px;
  padding: 0 3px 2px;
  border-bottom: 1px dotted #4c5753;
}

.report-page-number {
  position: absolute;
  right: 12mm;
  bottom: 7mm;
  color: #6c7772;
  font-size: 8px;
}

.empty-value {
  color: #8d9692;
}

.original-report-page {
  padding: 12mm 10mm;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
}

.landscape-report-sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7mm;
  width: 297mm;
  height: 210mm;
  padding: 7mm;
  color: #111;
  border: 1px solid #d5d9d7;
  background: #fff;
  box-shadow: 0 10px 30px rgba(28, 42, 36, 0.1);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 6.5px;
}

.report-half {
  position: relative;
  min-width: 0;
}

.report-half-right {
  padding-left: 3mm;
  border-left: 1px solid #bbb;
}

.landscape-report-sheet .original-report-header {
  min-height: 18mm;
}

.landscape-report-sheet .original-report-header h2 {
  margin-bottom: 1px;
  font-size: 10px;
}

.landscape-report-sheet .original-report-header > p {
  margin-bottom: 4px;
  font-size: 6px;
}

.landscape-report-sheet .original-student-meta {
  gap: 2px 6px;
  padding: 3px 0;
  font-size: 5.8px;
}

.landscape-report-sheet .original-academic-table th,
.landscape-report-sheet .original-academic-table td {
  height: 12.5px;
  padding: 1px 2px;
  font-size: 5.7px;
}

.landscape-report-sheet .original-academic-table th {
  font-size: 5.4px;
}

.landscape-report-sheet
  .original-academic-table
  .overall-title-row
  th:last-child {
  height: 11px;
  font-size: 6.5px;
}

.landscape-report-sheet .skill-name::before,
.landscape-report-sheet .math-skill::before {
  font-size: 4px;
}

.landscape-report-sheet .grading-key-label {
  margin: 5px 0 2px 2px;
  font-size: 5.5px;
}

.landscape-report-sheet .original-grading-key th,
.landscape-report-sheet .original-grading-key td {
  height: 15px;
  padding: 1px;
  font-size: 5.5px;
}

.landscape-report-sheet .primary-grading-key {
  gap: 1px 6px;
  margin-top: 6mm;
  font-size: 6px;
}

.landscape-report-sheet .original-section-heading {
  margin: 4px 0 2px;
  font-size: 7px;
}

.landscape-report-sheet .original-rating-table th,
.landscape-report-sheet .original-rating-table td {
  height: 14px;
  padding: 1px 2px;
  font-size: 6px;
}

.landscape-report-sheet .original-rating-table .rating-tick {
  font-size: 7px;
}

.landscape-report-sheet .social-heading {
  margin-top: 7px;
}

.landscape-report-sheet .original-service-heading {
  margin: 5px 0 2px;
  font-size: 6.5px;
}

.landscape-report-sheet .original-writing-area {
  min-height: 10mm;
  padding: 2px;
  font-size: 6px;
}

.landscape-report-sheet .service-area {
  min-height: 4.8mm;
}

.landscape-report-sheet .original-comment-area {
  min-height: 19mm;
  padding-top: 3mm;
}

.landscape-report-sheet .original-comment-area .original-writing-area {
  min-height: 16mm;
}

.landscape-report-sheet .original-signature-fields {
  margin-top: 3mm;
}

.landscape-report-sheet .original-signature-fields p {
  grid-template-columns: 68px 1fr;
  min-height: 18px;
  font-size: 6px;
}

.landscape-report-sheet .original-signature-fields span {
  min-height: 12px;
  padding-bottom: 1px;
}

.report-pages:has(.landscape-report-sheet) {
  display: block;
  overflow-x: auto;
}

#previewMount {
  padding-bottom: 1rem;
}

#previewMount .report-pages {
  padding: 0.5rem;
}

#previewMount .landscape-report-sheet {
  zoom: var(--preview-zoom, 1.75);
}

.original-report-header {
  min-height: 24mm;
  text-align: center;
}

.original-report-header h2 {
  margin: 0 0 2px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.original-report-header > p {
  margin: 0 0 7px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.original-student-meta {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3px 12px;
  padding: 5px 0;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  text-align: left;
}

.original-student-meta span {
  white-space: nowrap;
}

.original-academic-table,
.original-grading-key,
.original-rating-table {
  width: 100%;
  color: #111;
  border-collapse: collapse;
  table-layout: fixed;
}

.original-academic-table th,
.original-academic-table td {
  height: 19px;
  padding: 2px 3px;
  border: 1px solid #222;
  text-align: center;
  vertical-align: middle;
}

.original-academic-table th {
  font-size: 8px;
  font-weight: 500;
  line-height: 1.05;
}

.original-academic-table th.report-header-spacer {
  border: 0 !important;
  background: transparent;
}

.original-academic-table td.report-not-applicable {
  border-top: 0 !important;
  border-right: 0 !important;
  border-bottom: 0 !important;
  border-left: 1px solid #222 !important;
  background: #fff;
}

.original-academic-table .overall-title-row th:first-child {
  border-top-color: transparent;
  border-left-color: transparent;
}

.original-academic-table .overall-title-row th:last-child {
  height: 17px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.academic-section-row td:first-child,
.standard-subject-row td:first-child,
.single-skill,
.skill-group {
  font-weight: 800;
  text-align: left;
}

.skill-name,
.math-skill {
  text-align: left !important;
}

.skill-name::before,
.math-skill::before {
  content: "● ";
  font-size: 6px;
}

.single-skill,
.standard-subject-row td:first-child {
  text-transform: uppercase;
}

.grading-key-label {
  margin: 11px 0 3px 3px;
  font-size: 8px;
}

.original-grading-key {
  width: 62%;
}

.original-grading-key th,
.original-grading-key td {
  height: 25px;
  padding: 3px;
  border: 1px solid #222;
  font-size: 8px;
  font-weight: 400;
  text-align: center;
}

.primary-grading-key {
  display: grid;
  grid-template-columns: auto 22px 1fr;
  gap: 2px 12px;
  width: 70%;
  margin: 12mm 0 0 3mm;
  font-size: 12px;
  line-height: 1.2;
}

.primary-grading-key strong {
  grid-row: span 5;
  align-self: start;
  font-weight: 800;
}

.primary-grading-key span,
.primary-grading-key b {
  font-weight: 800;
}

.primary-skill-group {
  text-transform: none;
}

.original-section-heading {
  margin: 7px 0 4px;
  font-size: 10px;
  font-weight: 800;
}

.original-section-heading:first-of-type {
  margin-top: 4px;
}

.original-rating-table th,
.original-rating-table td {
  height: 22px;
  padding: 2px 4px;
  border: 1px solid #222;
  font-size: 8.5px;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
}

.original-rating-table th:first-child,
.original-rating-table td:first-child {
  width: 54%;
  text-align: left;
}

.original-rating-table .rating-tick {
  color: #111;
  font-size: 10px;
  font-weight: 800;
}

.social-heading {
  margin-top: 14px;
}

.original-service-heading {
  margin: 8px 0 3px;
  font-size: 9.5px;
  font-weight: 800;
}

.original-service-heading span {
  font-weight: 400;
}

.original-writing-area {
  min-height: 25mm;
  padding: 4px 3px;
  border-bottom: 1px solid #222;
  font-size: 8.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.service-area {
  min-height: 7mm;
}

.original-comment-area {
  min-height: 38mm;
  padding-top: 5mm;
}

.original-comment-area .original-writing-area {
  min-height: 30mm;
  border-top: 0;
}

.original-signature-fields {
  margin-top: 7mm;
}

.original-signature-fields p {
  display: grid;
  grid-template-columns: 95px 1fr;
  align-items: end;
  min-height: 28px;
  margin: 0;
}

.original-signature-fields span {
  min-height: 18px;
  padding: 0 4px 2px;
  border-bottom: 1px dotted #222;
}

.print-only {
  display: none;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 1.5rem;
  bottom: 1.5rem;
  padding: 0.8rem 1rem;
  color: #fff;
  border-radius: 9px;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1050px) {
  .roster-workspace {
    grid-template-columns: 1fr;
  }

  .class-entry-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .score-entry-layout {
    grid-template-columns: 1fr;
  }

  .subject-entry-sidebar {
    position: static;
  }

  .subject-entry-nav {
    display: flex;
    max-height: none;
    overflow-x: auto;
  }

  .subject-entry-button {
    grid-template-columns: auto minmax(110px, 1fr) auto;
    min-width: 190px;
  }

  .entry-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .entry-metric:nth-child(3) {
    border-right: 0;
  }

  .entry-metric:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }

  .report-pages {
    grid-template-columns: 1fr;
  }

  .report-page {
    width: min(100%, 210mm);
    margin: 0 auto;
  }

  .development-grid {
    grid-template-columns: 1fr;
  }

  .settings-admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 2rem 1rem 1rem;
  }

  main {
    padding: 0 1rem 2rem;
  }

  .tab-list {
    overflow-x: auto;
  }

  .tab-button {
    white-space: nowrap;
  }

  .score-entry-title-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .score-entry-progress-top {
    width: auto;
    min-width: 0;
    margin-top: 0.28rem;
  }

  .mobile-gradebook-nav {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.55rem;
  }

  .mobile-card-modal {
    align-items: stretch;
    padding: 0.45rem;
  }

  .mobile-card-dialog {
    width: 100%;
    height: calc(100vh - 0.9rem);
    height: calc(100dvh - 0.9rem);
    max-height: none;
    border-radius: 18px;
  }

  .mobile-card-dialog-header {
    padding: 0.85rem 0.9rem 0.7rem;
  }

  .mobile-card-dialog-header h2 {
    font-size: 1.35rem;
  }

  .mobile-card-dialog .mobile-gradebook {
    padding: 0.75rem 0.75rem 1.2rem;
  }

  .mobile-gradebook-nav button {
    width: 100%;
    padding-right: 0.65rem;
    padding-left: 0.65rem;
  }

  .ocr-modal {
    align-items: stretch;
    padding: 0.45rem;
  }

  .ocr-dialog {
    width: 100%;
    max-height: none;
    height: calc(100vh - 0.9rem);
    height: calc(100dvh - 0.9rem);
    border-radius: 18px;
  }

  .ocr-upload-grid,
  .ocr-dialog-footer {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ocr-dialog-footer {
    display: grid;
  }

  .ocr-preview:not(:empty) {
    max-height: 48dvh;
    min-height: 220px;
    padding: 0.55rem;
  }

  .ocr-preview-table {
    min-width: 820px;
    font-size: 0.86rem;
  }

  .ocr-preview-table th,
  .ocr-preview-table td {
    padding: 0.62rem;
  }

  .ocr-preview-table td:first-child,
  .ocr-preview-table th:first-child {
    min-width: 160px;
  }

  .mobile-gradebook-fields,
  .mobile-gradebook-results,
  .mobile-maximum-grid {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    padding: 1.2rem;
  }

  .panel-heading,
  .compact-card,
  .settings-maintenance {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-heading > p {
    margin-top: 0;
  }

  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
  }

  .add-student-row,
  .inline-create,
  .class-entry-toolbar {
    grid-template-columns: 1fr;
  }

  .csv-import-actions {
    grid-template-columns: 1fr;
  }

  .class-selection-card {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 1.5rem;
    text-align: center;
  }

  .class-selection-content {
    width: 100%;
  }

  .class-selection-content .field {
    text-align: left;
  }

  .settings-maintenance-actions {
    width: 100%;
    flex-direction: column;
  }

  .gradebook-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .gradebook-heading-tools {
    min-width: 0;
    justify-items: stretch;
  }

  .gradebook-settings {
    justify-content: stretch;
  }

  .gradebook-action-buttons {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .score-entry-progress {
    width: auto;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .weight-controls {
    flex-wrap: wrap;
  }

  .formula-chips {
    flex-wrap: wrap;
  }

  .entry-section-heading,
  .subject-entry-header,
  .task-entry-heading {
    flex-direction: column;
  }

  .entry-control-grid,
  .exam-entry-grid,
  .ca-category-grid,
  .rating-only-card,
  .parent-ca-summary {
    grid-template-columns: 1fr;
  }

  .entry-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-metric,
  .entry-metric:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .entry-metric:nth-child(2n) {
    border-right: 0;
  }

  .subskill-rating-controls {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .subskill-rating-controls .compact-field:last-child {
    grid-column: 1 / -1;
  }

  .task-score-grid {
    grid-template-columns: 1fr;
  }

  .rating-only-card {
    min-height: 0;
    padding: 1.25rem;
  }

  .rating-only-controls {
    grid-template-columns: 1fr;
  }

  .subject-entry-footer {
    flex-wrap: wrap;
  }

  .rating-editor-row {
    grid-template-columns: 1fr;
  }
}

@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  html,
  body {
    width: 297mm;
    height: 210mm;
    margin: 0;
    background: #fff;
  }

  .app-header,
  main,
  .toast {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .print-only .report-pages {
    display: block;
    overflow: visible;
  }

  .print-only .landscape-report-sheet {
    width: 297mm;
    height: 210mm;
    margin: 0;
    border: 0;
    box-shadow: none;
    break-after: auto;
    page-break-after: auto;
  }

  .print-only.print-class-reports .report-pages {
    break-after: page;
    page-break-after: always;
  }

  .print-only.print-class-reports .report-pages:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-only .report-page {
    width: 210mm;
    height: 297mm;
    min-height: 297mm;
    margin: 0;
    border: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .print-only .report-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}
