:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --ink: #17231f;
  --muted: #66736e;
  --brand: #116149;
  --brand-dark: #0b4635;
  --brand-2: #d7efe5;
  --line: #dce4df;
  --card: #ffffff;
  --danger: #b42318;
  --warn: #986400;
  --shadow: 0 10px 30px rgba(19, 35, 30, 0.07);
}

body[data-theme="navy"] {
  --bg: #f4f7fb;
  --brand: #173b68;
  --brand-dark: #0f2a4b;
  --brand-2: #dfeaf7;
  --line: #d8e1ee;
  --ink: #122033;
  --muted: #627086;
  --shadow: 0 10px 30px rgba(18, 32, 51, 0.08);
}

body[data-theme="maroon"] {
  --bg: #f8f5f5;
  --brand: #7a1f32;
  --brand-dark: #541523;
  --brand-2: #f3dfe4;
  --line: #ead8dd;
  --ink: #27191d;
  --muted: #75676b;
  --shadow: 0 10px 30px rgba(82, 21, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  padding: 0.8rem 1rem;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.95);
}

button:disabled {
  cursor: not-allowed;
  filter: none;
  opacity: 0.58;
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 72%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--brand-dark);
  color: white;
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.secondary-button {
  background: var(--brand-2);
  color: var(--brand);
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  padding: 0.75rem 0.85rem;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  background: #f8fbf9;
}

tbody tr:hover td {
  background: #fbfdfc;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  padding: 1rem clamp(1rem, 4vw, 2rem);
  backdrop-filter: blur(10px);
}

.topbar h1,
.section-heading h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-group,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.role-switcher {
  grid-template-columns: auto minmax(140px, 170px);
  align-items: center;
  gap: 0.45rem;
}

.role-switcher select {
  padding-block: 0.5rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.warn {
  background: #fff2cc;
  color: var(--warn);
}

.pill.danger {
  background: #fee4e2;
  color: var(--danger);
}

.compact-button {
  width: auto;
  padding: 0.5rem 0.75rem;
}

.guide-link {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.guide-link:hover {
  filter: brightness(0.95);
}

.hidden {
  display: none !important;
}

.parent-learner-card details {
  margin-top: 18px;
}

.parent-learner-card summary {
  cursor: pointer;
  font-weight: 800;
  padding: 10px 0;
}

.parent-finance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.status-pill {
  align-self: start;
  background: #e8f5ed;
  border: 1px solid #b8dec6;
  border-radius: 999px;
  color: #17653a;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 7px 10px;
}

.onboarding-journey {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
  margin-bottom: 20px;
}

.onboarding-head {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.onboarding-head > strong {
  color: var(--brand);
  font-size: 1.5rem;
}

.onboarding-progress {
  background: var(--brand-2);
  border-radius: 999px;
  height: 9px;
  margin: 14px 0 18px;
  overflow: hidden;
}

.onboarding-progress span {
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  display: block;
  height: 100%;
  transition: width 240ms ease;
}

.onboarding-steps {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboarding-steps li {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 12px;
}

.onboarding-steps li > span {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.onboarding-steps li.complete > span {
  background: #17653a;
  border-color: #17653a;
  color: white;
}

.onboarding-steps p {
  margin: 4px 0 0;
}

.onboarding-steps small {
  color: #17653a;
  font-weight: 800;
}

.onboarding-steps.compact p {
  display: none;
}

@media (max-width: 760px) {
  .parent-finance-grid {
    grid-template-columns: 1fr;
  }

  .onboarding-steps li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .onboarding-steps button,
  .onboarding-steps small {
    grid-column: 2;
    justify-self: start;
  }
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 82px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 1rem;
}

.nav-item {
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
  background: #f3f7f5;
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--brand-2);
  color: var(--brand);
}

.content {
  min-width: 0;
  padding: clamp(1rem, 4vw, 2rem);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.compact-heading {
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metrics article,
.panel,
.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.metrics article {
  min-width: 0;
}

.metrics span {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1.05;
}

.metrics p,
.panel p {
  color: var(--muted);
}

.split-grid,
.settings-grid,
.setup-grid,
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.curriculum-panel ul { margin: .5rem 0 0 1.1rem; padding: 0; }
.curriculum-subject-chooser { margin: .8rem 0; max-height: 18rem; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
.curriculum-subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .8rem; }
.curriculum-subject-grid label { display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.support-panel a, .site-footer a { color: var(--brand); font-weight: 700; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 2rem 1.5rem; color: var(--muted); font-size: .9rem; }
.danger-panel { border-color: #b42318; }
.search-results-heading { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; }
.exam-paper-preview { min-height: 8rem; }
.exam-paper-header { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid var(--primary); padding-bottom: 1rem; }
.exam-paper-header img { width: 64px; height: 64px; object-fit: contain; }
.exam-paper-content { white-space: pre-wrap; font: inherit; line-height: 1.55; margin: 1rem 0; }
.assessment-builder-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, .8fr); gap: 1rem; align-items: start; }
.assessment-meta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.assessment-tips { position: sticky; top: 1rem; }
.assessment-tips ul { display: grid; gap: .8rem; padding-left: 1.2rem; color: var(--muted); }
.assessment-paper { max-width: 850px; margin: 1rem auto 0; }
.assessment-paper-meta { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.assessment-instructions { margin: 1rem 0; padding: .8rem 1rem; background: var(--surface-soft); border-radius: 10px; }
.assessment-instructions p { margin: .35rem 0 0; }
.assessment-question-list { display: grid; gap: 1.25rem; padding-left: 1.5rem; }
.assessment-question-list li { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; padding-left: .35rem; }
.assessment-guide-list { display: grid; gap: 1rem; padding-left: 1.5rem; }
.assessment-guide-list li { display: grid; grid-template-columns: 1fr auto; gap: 1rem; border-bottom: 1px solid var(--border); padding: 0 0 .8rem .35rem; }
.assessment-guide-list p { margin: .35rem 0 0; white-space: pre-wrap; }
.demo-marks-panel { margin-top: 1rem; }

.class-analysis-report {
  margin-bottom: 1rem;
}

.analysis-report-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.8rem;
  margin-bottom: 0.9rem;
}

.analysis-report-head > div:last-child {
  text-align: right;
}

.analysis-report-head h3,
.analysis-report-head p {
  margin: 0.15rem 0;
}

.analysis-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.analysis-summary-grid-secondary { margin-top: 1rem; }
.analysis-visuals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.analysis-visuals > div { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: var(--surface); }
.analysis-bars { display: grid; gap: .55rem; }
.analysis-bar-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 2fr auto; align-items: center; gap: .5rem; font-size: .85rem; }
.analysis-bar-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis-bar-track { height: .55rem; border-radius: 99px; background: var(--soft); overflow: hidden; }
.analysis-bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }

.analysis-summary-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 0.55rem;
  font-weight: 800;
}

.analysis-summary-grid b {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--brand);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analysis-two-column {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

.analysis-two-column h4 {
  margin: 0 0 0.5rem;
}

.fee-quick-panel {
  margin-bottom: 1rem;
}

.fee-quick-panel input {
  width: 100%;
}

.fee-search-results {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.fee-search-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  text-align: left;
}

.fee-search-card:hover {
  border-color: var(--brand);
  background: var(--brand-2);
}

.fee-search-card span,
.fee-search-card b {
  display: block;
}

.fee-search-card strong {
  color: var(--brand);
  white-space: nowrap;
}

.stack-form {
  display: grid;
  gap: 1rem;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list span {
  border: 1px solid #bde3d4;
  border-radius: 999px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.theme-preview {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.theme-dot {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.theme-dot.primary {
  background: var(--brand);
}

.theme-dot.soft {
  background: var(--brand-2);
}

.theme-dot.ink {
  background: var(--ink);
}

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

.branding-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.branding-preview div {
  border: 1px dashed var(--line);
  border-radius: 8px;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

.branding-preview span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.branding-preview img {
  max-width: 150px;
  max-height: 90px;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid.assessment-meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

.admission-form {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admission-form fieldset {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  margin: 0;
  padding: 1rem;
}

.admission-form legend {
  color: var(--brand);
  font-weight: 900;
  padding: 0 0.4rem;
}

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

.finance-panel {
  margin-bottom: 1rem;
}

.access-banner {
  border: 1px solid #f6c56f;
  border-radius: 8px;
  background: #fff7e6;
  color: #7a4b00;
  font-weight: 800;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.access-banner.hidden {
  display: none;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.toolbar-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(170px, 0.6fr) minmax(170px, 0.6fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.mini-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mini-metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0.75rem;
}

.mini-metrics span {
  color: var(--brand);
  font-size: 1.35rem;
  font-weight: 900;
}

.mini-metrics p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.learner-profile {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.import-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.import-panel h3 {
  margin: 0 0 0.2rem;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.import-actions input {
  max-width: 280px;
}

.import-actions select {
  max-width: 170px;
}

.import-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.import-preview:empty {
  display: none;
}

.import-preview div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 0.75rem;
}

.import-preview p {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.pagination-bar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:12px 0 24px; }
.pagination-bar .page-actions { display:flex; gap:8px; }
.pagination-bar button:disabled { opacity:.45; cursor:not-allowed; }
.stream-groups { display:grid; gap:8px; }
.stream-groups > div { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.stream-groups strong { min-width:90px; }

.message-output {
  width: 100%;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 1rem;
  resize: vertical;
}

.learner-profile h3,
.learner-profile p {
  margin: 0.2rem 0;
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-stats span {
  border-radius: 999px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.selected-row td {
  background: #eef7f3;
}

#learnersTable tr[data-learner-id] {
  cursor: pointer;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.mark-input {
  max-width: 110px;
  padding: 0.5rem;
}

#marksheetTable table,
#marksTable table,
#meritResult table {
  min-width: 980px;
}

.merit-print-header {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.85rem;
}

.merit-school-line {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.merit-logo {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--brand);
  font-weight: 900;
  overflow: hidden;
  background: #f8fbfa;
}

.merit-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.merit-school-line h3 {
  margin: 0;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.merit-school-line p,
.merit-school-line strong {
  display: block;
  margin: 0.15rem 0 0;
}

.merit-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.merit-meta-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fbfdfc;
  font-size: 0.86rem;
}

.merit-meta-grid b {
  display: block;
  color: var(--brand);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#marksheetTable th:nth-child(1),
#marksheetTable td:nth-child(1),
#marksTable th:nth-child(1),
#marksTable td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: white;
}

#marksheetTable th:nth-child(2),
#marksheetTable td:nth-child(2),
#marksTable th:nth-child(2),
#marksTable td:nth-child(2) {
  position: sticky;
  left: 92px;
  z-index: 1;
  min-width: 180px;
  background: white;
}

#marksheetTable th,
#marksTable th {
  white-space: nowrap;
}

.legacy-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  margin: 1rem 0;
  padding: 0.8rem;
}

.edit-learner-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  padding: 0.9rem;
}

.legacy-entry summary,
.edit-learner-panel summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
}

.legacy-entry form,
.edit-learner-panel form {
  margin-top: 1rem;
}

.list {
  display: grid;
  gap: 0.65rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.65rem;
}

.list-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e5ebe8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.term-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.report-card {
  position: relative;
  max-width: 900px;
  margin-inline: auto;
  overflow: hidden;
  border-top: 8px solid var(--brand);
  box-shadow: 0 18px 50px rgba(17, 97, 73, 0.08);
  font-size: 0.92rem;
}

.report-watermark {
  position: absolute;
  right: 1rem;
  top: 7rem;
  color: rgba(17, 97, 73, 0.05);
  font-size: 8rem;
  font-weight: 900;
  pointer-events: none;
}

.report-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}

.report-head h2,
.report-head p {
  margin: 0.1rem 0;
}

.school-mark {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.report-term {
  display: grid;
  gap: 0.2rem;
  min-width: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  text-align: center;
}

.report-term strong {
  color: var(--brand);
}

.learner-strip,
.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.learner-strip div,
.summary-band div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 0.55rem;
}

.learner-strip span,
.summary-band span,
.summary-band small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.summary-band {
  grid-template-columns: 1.2fr 1.4fr 1fr 1.2fr;
}

.summary-band div {
  background: var(--brand-2);
  border-color: #bde3d4;
}

.summary-band strong {
  display: block;
  color: var(--brand);
  font-size: 1.05rem;
  margin-top: 0.25rem;
}

.report-section {
  margin-top: 0.75rem;
}

.report-section h3,
.report-notes h3 {
  margin: 0 0 0.35rem;
  color: var(--brand);
  font-size: 0.95rem;
}

.report-table th {
  background: #eef7f3;
  color: var(--brand);
}

.report-table td:first-child {
  font-weight: 700;
}

.compact-report-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.mini-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 0.65rem;
}

.mini-panel h3 {
  margin: 0 0 0.35rem;
  color: var(--brand);
  font-size: 0.92rem;
}

.mini-panel p {
  margin: 0;
}

.competency-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.competency-chips span {
  border-radius: 999px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.competency-chips strong {
  margin-right: 0.35rem;
}

.report-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.report-notes div,
.attendance-box,
.report-admin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem;
  background: #fbfdfc;
}

.report-notes p {
  margin: 0;
}

.attendance-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.report-admin-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.signature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.signature-row div {
  border-top: 1px solid var(--ink);
  padding-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.report-footnote {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.kcpe-report {
  position: relative;
  border: 2px solid var(--brand);
  border-radius: 6px;
  background: white;
  padding: 0.9rem;
}

.official-head {
  display: grid;
  grid-template-columns: 72px 1fr 140px;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 3px double var(--brand);
  padding-bottom: 0.7rem;
}

.school-seal {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border: 2px solid var(--brand);
  border-radius: 50%;
  color: var(--brand);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.school-seal img {
  max-width: 54px;
  max-height: 54px;
  object-fit: contain;
}

.school-title {
  text-align: center;
}

.school-title h2 {
  margin: 0;
  color: var(--brand);
  font-size: 1.45rem;
  text-transform: uppercase;
}

.school-title p,
.school-title strong {
  display: block;
  margin: 0.12rem 0;
}

.term-box-official {
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 0.55rem;
  text-align: center;
}

.term-box-official span,
.term-box-official small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.term-box-official strong {
  display: block;
  color: var(--brand);
  margin: 0.2rem 0;
}

.bio-line {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.9fr 1fr;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0.7rem 0;
  overflow: hidden;
}

.bio-line div {
  border-right: 1px solid var(--line);
  padding: 0.48rem 0.6rem;
}

.bio-line div:last-child {
  border-right: 0;
}

.bio-line span,
.summary-score span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-main-grid {
  display: grid;
  grid-template-columns: 1fr 165px;
  gap: 0.7rem;
}

.results-panel,
.summary-panel,
.competency-panel,
.comment-grid div,
.admin-strip {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfc;
}

.results-panel {
  overflow: hidden;
}

.results-panel h3,
.competency-panel h3,
.comment-grid h3 {
  margin: 0;
  background: var(--brand);
  color: white;
  padding: 0.4rem 0.55rem;
  font-size: 0.86rem;
}

.summary-panel {
  display: grid;
  gap: 0.45rem;
  padding: 0.5rem;
}

.summary-score {
  border: 1px solid #bde3d4;
  border-radius: 6px;
  background: white;
  padding: 0.45rem;
  text-align: center;
}

.summary-score strong {
  display: block;
  color: var(--brand);
  font-size: 1.1rem;
}

.summary-score.highlight {
  background: var(--brand-2);
}

.lower-report-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1.05fr;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.competency-panel p {
  margin: 0;
  padding: 0.55rem;
}

.competency-mini-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.5rem;
}

.competency-mini-list span {
  border-radius: 4px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.3rem 0.4rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.comment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.comment-grid p {
  margin: 0;
  min-height: 2.2rem;
  padding: 0.55rem;
}

.admin-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 0;
  margin-top: 0.7rem;
  overflow: hidden;
}

.admin-strip span {
  border-right: 1px solid var(--line);
  padding: 0.5rem;
}

.admin-strip span:last-child {
  border-right: 0;
}

.official-signatures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.8rem;
}

.official-signatures span {
  border-top: 1px solid var(--ink);
  color: var(--muted);
  padding-top: 0.35rem;
  text-align: center;
  font-size: 0.8rem;
  min-height: 48px;
}

.stamp-image {
  display: block;
  max-width: 90px;
  max-height: 42px;
  object-fit: contain;
  margin: 0.2rem auto 0;
}

.official-signatures b {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink);
  font-size: 0.72rem;
}

.bulk-print-panel {
  margin-bottom: 1rem;
}

.bulk-report-cards {
  display: none;
}

.ledger-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.receipt {
  padding: 1rem;
}

.receipt-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.8rem;
  margin-bottom: 0.8rem;
}

.receipt-head h3,
.receipt-head p {
  margin: 0.15rem 0;
}

.receipt-number {
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  text-align: center;
}

.receipt-number span,
.receipt-totals span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.receipt-strip {
  margin-bottom: 0.8rem;
}

.receipt-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.receipt-totals div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-2);
  padding: 0.7rem;
}

.receipt-totals strong {
  color: var(--brand);
  font-size: 1.1rem;
}

.receipt-signatures {
  margin-top: 2.5rem;
}

.form-note {
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.error-text {
  color: var(--danger);
  font-weight: 700;
}

.invite-code {
  border: 1px dashed var(--brand);
  border-radius: 8px;
  background: var(--brand-2);
  color: var(--brand);
  padding: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(10, 20, 16, 0.68);
  padding: 1rem;
}

.lock-screen.hidden {
  display: none;
}

.lock-panel {
  width: min(100%, 430px);
  border-radius: 8px;
  background: white;
  padding: 1.5rem;
}

@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  @page merit-list {
    size: A4 landscape;
    margin: 6mm;
  }

  @page class-analysis {
    size: A4;
    margin: 8mm;
  }

  body {
    background: white;
  }

  .trial-banner {
    display: none !important;
  }
  .site-footer { display: none !important; }

  .topbar,
  .sidebar,
  .section-heading,
  .metrics,
  .panel:not(#reportCard) {
    display: none !important;
  }

  body:has(#fees.active) .topbar,
  body:has(#fees.active) .sidebar,
  body:has(#fees.active) .section-heading,
  body:has(#fees.active) .metrics,
  body:has(#fees.active) #fees > *:not(.finance-panel),
  body:has(#fees.active) .finance-panel:not(:has(#learnerLedger)) {
    display: none !important;
  }

  .app-shell,
  .content {
    display: block;
    padding: 0;
  }

  .view {
    display: none !important;
  }

  #reports.active {
    display: block !important;
  }

  #merit.active {
    display: block !important;
  }

  body.printing-assessment-paper #examBuilder.active,
  body.printing-assessment-guide #examBuilder.active { display: block !important; }
  body.printing-assessment-paper #examBuilder > *:not(#assessmentPaper),
  body.printing-assessment-guide #examBuilder > *:not(#assessmentMarkingGuide) { display: none !important; }
  body.printing-assessment-paper #assessmentPaper,
  body.printing-assessment-guide #assessmentMarkingGuide { display: block !important; border: 0; box-shadow: none; margin: 0; max-width: none; }
  .no-print { display: none !important; }

  body.printing-analysis #analytics.active {
    display: block !important;
    page: class-analysis;
  }

  body.printing-merit #merit.active {
    page: merit-list;
  }

  body:has(#merit.active) #reports {
    display: none !important;
  }

  body:has(#merit.active) .topbar,
  body:has(#merit.active) .sidebar,
  body:has(#merit.active) .section-heading button,
  body:has(#merit.active) #meritControls {
    display: none !important;
  }

  body.printing-analysis .topbar,
  body.printing-analysis .sidebar,
  body.printing-analysis .section-heading,
  body.printing-analysis .metrics,
  body.printing-analysis .analysis-grid,
  body.printing-analysis #analytics > *:not(#classAnalysisReport) {
    display: none !important;
  }

body.printing-analysis #classAnalysisReport {
    display: block !important;
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  body.printing-analysis .analysis-report-head {
    align-items: flex-start;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }

  body.printing-analysis .analysis-summary-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
  }

  body.printing-analysis .analysis-summary-grid span {
    padding: 5px;
    border-radius: 5px;
    font-size: 8pt;
  }

  body.printing-analysis .analysis-two-column {
    grid-template-columns: 2fr 1fr;
    gap: 8px;
  }

  body.printing-analysis table {
    width: 100%;
    font-size: 8pt;
  }

  body.printing-analysis th,
  body.printing-analysis td {
    padding: 4px;
  }

  body:has(#merit.active) .section-heading {
    display: none !important;
  }

  body.printing-merit .merit-print-header {
    display: grid !important;
    gap: 5px;
    margin-bottom: 7px;
    padding-bottom: 5px;
    border-bottom: 1.5px solid #0b5d48;
  }

  body.printing-merit .merit-school-line {
    gap: 7px;
  }

  body.printing-merit .merit-logo {
    width: 38px;
    height: 38px;
    border-radius: 6px;
    font-size: 9pt;
  }

  body.printing-merit .merit-school-line h3 {
    font-size: 14pt;
  }

  body.printing-merit .merit-school-line p,
  body.printing-merit .merit-school-line strong {
    font-size: 8pt;
  }

  body.printing-merit .merit-meta-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  body.printing-merit .merit-meta-grid span {
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 7pt;
  }

  body.printing-merit .merit-meta-grid b {
    font-size: 5.8pt;
  }

  body:has(#merit.active) #merit .panel {
    display: block !important;
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  body.printing-merit #merit .split-grid,
  body.printing-merit #merit .table-wrap,
  body.printing-merit #meritResult {
    display: block !important;
    overflow: visible !important;
    width: 100% !important;
  }

  body.printing-merit #meritResult table {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 6.6pt;
  }

  body.printing-merit #meritResult th,
  body.printing-merit #meritResult td {
    padding: 2px 3px;
    line-height: 1.08;
    white-space: normal;
    word-break: break-word;
  }

  body.printing-merit #meritResult th:nth-child(1),
  body.printing-merit #meritResult td:nth-child(1) {
    width: 22px;
  }

  body.printing-merit #meritResult th:nth-child(2),
  body.printing-merit #meritResult td:nth-child(2) {
    width: 40px;
  }

  body.printing-merit #meritResult th:nth-child(3),
  body.printing-merit #meritResult td:nth-child(3) {
    width: 84px;
  }

  body.printing-merit #meritResult th:nth-child(n + 4),
  body.printing-merit #meritResult td:nth-child(n + 4) {
    text-align: center;
  }

  .bulk-print-panel {
    display: none !important;
  }

  .bulk-report-cards {
    display: block;
  }

  .report-page {
    break-after: page;
    page-break-after: always;
  }

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

  body:has(#fees.active) #fees {
    display: block !important;
  }

  body:has(#fees.active) .finance-panel:has(#learnerLedger) {
    display: block !important;
    border: 0;
    padding: 0;
  }

  body:has(#fees.active) .ledger-card {
    border: 0;
  }

  body:has(#fees.active) .receipt {
    padding: 0;
  }

  .report-card {
    border: 0;
    border-top: 0;
    box-shadow: none;
    max-width: none;
    padding: 0;
    font-size: 8.5pt;
    line-height: 1.18;
  }

  .kcpe-report {
    border-width: 1.5px;
    padding: 5mm;
    min-height: 270mm;
  }

  .report-watermark {
    color: rgba(17, 97, 73, 0.035);
  }

  th,
  td {
    padding: 0.28rem 0.35rem;
    font-size: 8.3pt;
  }

  .school-mark {
    width: 48px;
    height: 48px;
    font-size: 0.8rem;
  }

  .school-seal {
    width: 48px;
    height: 48px;
  }

  .official-head {
    grid-template-columns: 52px 1fr 112px;
    gap: 0.5rem;
    padding-bottom: 0.45rem;
  }

  .school-title h2 {
    font-size: 13pt;
  }

  .bio-line,
  .lower-report-grid,
  .comment-grid,
  .admin-strip {
    margin-top: 0.45rem;
  }

  .bio-line {
    grid-template-columns: 1.45fr 0.75fr 0.9fr 1fr;
  }

  .report-main-grid {
    grid-template-columns: 1fr 150px;
    gap: 0.45rem;
  }

  .lower-report-grid {
    grid-template-columns: 1.35fr 1fr 1.05fr;
    gap: 0.45rem;
  }

  .comment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

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

  .summary-panel {
    gap: 0.25rem;
    padding: 0.35rem;
  }

  .summary-score,
  .competency-panel p,
  .comment-grid p,
  .admin-strip span {
    padding: 0.32rem;
  }

  .competency-mini-list {
    gap: 0.25rem;
    padding: 0.35rem;
  }

  .report-term,
  .learner-strip div,
  .summary-band div,
  .mini-panel,
  .report-notes div,
  .report-admin-row {
    padding: 0.38rem;
  }

  .signature-row {
    margin-top: 1.4rem;
  }

  .report-footnote {
    font-size: 7.6pt;
  }

  .receipt-signatures {
    margin-top: 2rem;
  }

  .official-signatures {
    margin-top: 1.35rem;
  }
}

.progress-chart svg { width: 100%; min-height: 150px; overflow: visible; }
.progress-chart line { stroke: #d9b8c0; stroke-width: 1; }
.progress-chart polyline { fill: none; stroke: #8b1e3f; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.progress-chart circle { fill: #fff; stroke: #8b1e3f; stroke-width: 2; }
.progress-chart text { fill: #765d66; font-size: 10px; }
.progress-chart-latest { color: #765d66; font-size: .9rem; margin-top: .25rem; }
body.printing-broadsheet .topbar, body.printing-broadsheet .sidebar, body.printing-broadsheet .section-heading, body.printing-broadsheet .metrics, body.printing-broadsheet .analysis-grid, body.printing-broadsheet #analytics > *:not(#classAnalysisReport) { display: none !important; }
body.printing-broadsheet #analytics, body.printing-broadsheet #classAnalysisReport { display: block !important; }
body.printing-broadsheet #classAnalysisReport { border: 0; box-shadow: none; max-width: none; }
.broadsheet-report { overflow-x: auto; }
.broadsheet-report table { min-width: 900px; font-size: .78rem; }
.admin-console { max-width: 680px; margin: 5rem auto; padding: 2rem; background: #fff; border: 1px solid #ead5dc; border-radius: 18px; box-shadow: 0 18px 50px rgba(75, 20, 38, .12); }
.admin-console h1 { color: #8b1e3f; margin-top: 0; }
@media print { .progress-chart svg { max-height: 150px; } }

@media screen and (max-width: 1200px) and (min-width: 901px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(190px, 1fr));
  }
}

@media screen and (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 78px;
    z-index: 1;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-item {
    white-space: nowrap;
  }

  .metrics,
  .split-grid,
  .settings-grid,
  .setup-grid,
  .analysis-grid,
  .term-grid,
  .learner-strip,
  .summary-band,
  .bio-line,
  .report-main-grid,
  .lower-report-grid,
  .compact-report-grid,
  .comment-grid,
  .admin-strip,
  .official-head,
  .report-notes,
  .attendance-box,
  .report-admin-row,
  .receipt-totals,
  .signature-row {
    grid-template-columns: 1fr;
  }

  .receipt-head {
    flex-direction: column;
  }

  .school-title {
    text-align: left;
  }

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

  .admission-form fieldset {
    grid-template-columns: 1fr;
  }

  .compact-form {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .branding-grid,
  .branding-preview {
    grid-template-columns: 1fr;
  }

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

  .assessment-builder-grid,
  .assessment-meta-grid {
    grid-template-columns: 1fr;
  }

  .assessment-tips { position: static; }

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

  .learner-profile {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-actions {
    justify-content: flex-start;
  }

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

  .topbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .role-switcher {
    grid-template-columns: 1fr;
  }

  .status-group {
    width: 100%;
  }

  .status-group > :is(label, a, button) {
    flex: 1 1 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
.trial-banner { padding: 9px 18px; text-align: center; background: #fff3cd; color: #654b00; font-weight: 700; font-size: .9rem; }
.trial-banner.live { background: #dff6e9; color: #075d3a; }
.trial-banner a { color: inherit; font-weight: 900; text-underline-offset: 3px; }
.premium-action { background: linear-gradient(135deg, #8a5b16, #c69234); }
.learner-avatar { width: 96px; height: 96px; border-radius: 24px; object-fit: cover; background: #e8efec; border: 3px solid white; box-shadow: 0 6px 22px #102e221f; }
.photo-placeholder { display:grid; place-items:center; font-size:2rem; font-weight:800; color:#386957; }
.learner-identity { display:flex; gap:18px; align-items:center; }
.school-analysis-report { margin-top: 18px; border: 1px solid color-mix(in srgb, var(--primary) 25%, white); }
.analysis-alerts { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:12px; margin:16px 0; }
.analysis-alerts article { padding:14px; background:var(--surface-soft); border-radius:12px; }
