/* School examinations nominal roll
   Typography: Arial and Helvetica only.
   Layout: flat panels, 1px rules, no gradients. */

:root {
  /* RVTTI blue, blue 500 is the institute colour */
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --blue-soft: #dbeafe;
  --blue-tint: #eff6ff;
  --blue-line: #bfdbfe;
  --ink: #1c2430;
  --muted: #5b6675;
  --line: #d3d8e0;
  --line-strong: #b3bac6;
  --bg: #f1f5fb;
  --panel: #ffffff;
  --focus: #2563eb;
  --green: #1e6b3a;
  --green-bg: #e6f2ea;
  --amber: #7a5c12;
  --amber-bg: #fbf1de;
  --red: #922b21;
  --red-bg: #fbeceb;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px; }
a { color: var(--focus); }
a:hover { color: var(--blue-dark); }

.mono {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header --------------------------------------------------------- */

.site-header {
  background: var(--blue);
  border-bottom: 4px solid var(--blue-dark);
  color: #ffffff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
  padding: 8px 0;
}

.brand-emblem {
  display: block;
  width: 46px;
  height: 42px;
  padding: 2px;
  background: #ffffff;
  border: 1px solid var(--blue-line);
  border-radius: 3px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-school {
  font-weight: 700;
  font-size: 16px;
}

.brand-unit {
  font-size: 12px;
  color: var(--blue-soft);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.main-nav a {
  display: inline-block;
  padding: 8px 12px;
  color: #ffffff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 3px;
}

.main-nav a:hover {
  background: var(--blue-dark);
  color: #ffffff;
}

.main-nav a.active {
  background: #ffffff;
  color: var(--blue-dark);
  font-weight: 700;
}

.nav-signout {
  display: inline;
  margin-left: 6px;
}

.link-button {
  background: none;
  border: 1px solid #ffffff;
  color: #ffffff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 3px;
  cursor: pointer;
}

.link-button:hover {
  background: var(--blue-dark);
}

.nav-badge {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 0 5px;
  background: #dc2626;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
}

/* Main ------------------------------------------------------------ */

main.wrap {
  padding-top: 24px;
  padding-bottom: 40px;
}

.page-intro {
  margin-bottom: 20px;
}

.page-intro p {
  color: var(--muted);
  max-width: 760px;
  margin-bottom: 0;
}

.page-intro-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-bottom: 22px;
  overflow: hidden;
}

.panel-narrow { max-width: 560px; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--blue-tint);
  border-bottom: 1px solid var(--line);
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.panel-body { padding: 16px; }

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
}

.two-col .panel { margin-bottom: 22px; }

.two-col-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

/* Forms ----------------------------------------------------------- */

.field { margin-bottom: 14px; }

.field label,
.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-dark);
}

.field input[type="text"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="file"],
.field input[type="email"],
.field select,
.field textarea,
.inline-form input[type="text"],
.inline-form select {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
}

.field textarea { resize: vertical; min-height: 90px; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.inline-form input:focus,
.inline-form select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field-button { display: flex; align-items: flex-end; }

.search-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field-grow { flex: 1 1 320px; }

.stack-form > .field:last-child { margin-bottom: 0; }

fieldset.field {
  border: 1px solid var(--line);
  padding: 12px;
  margin: 0 0 14px;
}

fieldset.field legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue-dark);
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 14px;
  font-size: 15px;
  cursor: pointer;
}

/* Checkboxes stay large and obvious on every screen size. */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}

input[type="checkbox"].unit-check,
input#tick-all {
  width: 24px;
  height: 24px;
}

.checkbox-line input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.btn-primary:hover { background: var(--blue-dark); color: #ffffff; }

.btn-secondary {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--blue-dark);
}

.btn-secondary:hover { background: var(--blue-soft); color: var(--blue-dark); }

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

.btn-danger:hover { background: #75241c; color: #ffffff; }

.btn-large { padding: 12px 26px; font-size: 15px; }
.btn-small { padding: 5px 10px; font-size: 13px; }

.btn:disabled {
  background: #e4e7ec;
  border-color: var(--line-strong);
  color: #8b95a3;
  cursor: not-allowed;
}

/* Tables ---------------------------------------------------------- */

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.data th,
table.data td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data thead th {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--blue);
  white-space: nowrap;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f3f8ff; }

.cell-centre { text-align: center; }
.actions { white-space: nowrap; }
.empty-cell { color: var(--muted); text-align: center; padding: 22px; }
.empty-row:hover { background: transparent; }

.pager {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  margin-top: -6px;
}

/* Badges, alerts, tabs ------------------------------------------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
}

.badge-open { background: var(--green-bg); color: var(--green); border-color: #b6d8c3; }
.badge-closed { background: #eceef1; color: var(--muted); border-color: var(--line); }
.badge-signed { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue-line); }
.badge-pending { background: var(--amber-bg); color: var(--amber); border-color: #e6d3a8; }
.badge-complaint { background: var(--red-bg); color: var(--red); border-color: #eabbb6; }

.alert-stack { margin-bottom: 16px; }

.alert {
  padding: 11px 14px;
  margin-bottom: 10px;
  border: 1px solid;
  border-radius: 3px;
  font-size: 14px;
  transition: opacity 350ms ease;
}

.alert.is-hiding { opacity: 0; }

.alert ul { margin: 8px 0 0; padding-left: 20px; }
.tight-list { margin: 6px 0 0; padding-left: 20px; max-height: 220px; overflow-y: auto; }

.alert-success { background: var(--green-bg); border-color: #b6d8c3; color: #15532d; }
.alert-error { background: var(--red-bg); border-color: #eabbb6; color: #7a231b; }
.alert-warn { background: var(--amber-bg); border-color: #e6d3a8; color: #66490f; }
.alert-info { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-dark); }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.tab {
  padding: 7px 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
  border-bottom: none;
}

.tab:hover { color: var(--blue-dark); background: #e8f1fe; }

.tab-active {
  background: #ffffff;
  border-color: var(--line);
  color: var(--blue-dark);
  font-weight: 700;
}

.live-indicator {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-indicator::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  background: var(--green);
  border-radius: 50%;
  vertical-align: middle;
}

.live-indicator.is-offline { color: var(--red); }
.live-indicator.is-offline::before { background: var(--red); }

/* Stats ----------------------------------------------------------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stats-row-compact { margin-bottom: 16px; }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 3px;
  padding: 14px 16px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.1;
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.stat-small .stat-value { font-size: 22px; }

/* Student pages --------------------------------------------------- */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
}

.meta-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}

.meta-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.steps {
  margin: 0 0 16px;
  padding-left: 22px;
}

.steps li { margin-bottom: 5px; }

.signature-block {
  margin: 16px 0;
  padding: 14px;
  background: var(--blue-tint);
  border: 1px solid var(--line);
  border-radius: 3px;
}

#signature-pad {
  display: block;
  width: 100%;
  max-width: 640px;
  /* Keeps the 640 x 200 drawing surface in proportion at any width. */
  height: auto;
  background: #ffffff;
  border: 1px dashed var(--blue-line);
  cursor: crosshair;
  touch-action: none;
}

.signature-display {
  margin: 14px 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 3px;
  display: inline-block;
}

.signature-display img {
  display: block;
  margin-top: 8px;
  max-width: 340px;
  width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--line);
}

.complaint-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.complaint-box summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--red);
  padding: 6px 0;
}

.complaint-box form { margin-top: 12px; padding-left: 14px; border-left: 3px solid var(--red); }

.callout {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--blue-tint);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.callout h3 { font-size: 14px; margin-bottom: 6px; }
.callout p { margin-bottom: 6px; }

.centre-panel {
  max-width: 560px;
  margin: 60px auto;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
}

/* No results pop up ---------------------------------------------- */

.popup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 36, 48, 0.55);
}

.popup-card {
  width: 100%;
  max-width: 380px;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 3px;
  text-align: center;
}

.popup-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
}

.popup-card p { color: var(--muted); }

.popup-card .btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 20px 10px;
  color: var(--muted);
}

.empty-state strong { color: var(--ink); }

.prose h2 {
  font-size: 16px;
  margin-top: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 16px;
  margin: 0;
}

.detail-list dt {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.detail-list dd { margin: 0; }

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 6px 0;
}

.inline-form input[type="text"] { width: 190px; }
.inline-form select { width: 120px; }

.confirm-form {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

/* Footer ---------------------------------------------------------- */

.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  padding-bottom: 16px;
  flex-wrap: wrap;
}

/* Import progress ------------------------------------------------- */

.progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-track {
  flex: 1;
  height: 16px;
  background: var(--blue-tint);
  border: 1px solid var(--blue-line);
  border-radius: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0;
  background: var(--blue);
  border-radius: 7px;
  transition: width 0.5s ease;
}

.progress-pct {
  min-width: 48px;
  text-align: right;
  font-weight: 600;
  color: var(--blue-dark);
}

.progress-phase {
  margin: 12px 0 4px;
}

@media (max-width: 720px) {
  h1 { font-size: 22px; }
  .header-inner { padding: 8px 0; }
  .detail-list { grid-template-columns: 1fr; gap: 2px 0; }
  .detail-list dd { margin-bottom: 8px; }
  .inline-form input[type="text"] { width: 100%; }
  .stat-value { font-size: 24px; }

  /* One column, tighter gutters, nothing pushed off the right edge. */
  .wrap { padding: 0 14px; }
  main.wrap { padding-top: 16px; padding-bottom: 28px; }
  .panel-body { padding: 14px; }
  .panel-header { padding: 10px 14px; }
  .meta-grid { grid-template-columns: 1fr; gap: 10px; }
  .signature-block { padding: 10px; }

  /* Search and every button go full width, so no sideways scrolling. */
  .search-form { display: block; }
  .search-form .field { margin-bottom: 12px; }
  .search-form .field-button { display: block; }
  .search-form .btn { width: 100%; padding: 12px; font-size: 16px; }
  .button-row .btn { display: block; width: 100%; margin-bottom: 0; }
  .button-row { gap: 10px; }

  /* Tighter cells keep the units table on screen with its checkboxes. */
  table.data th,
  table.data td { padding: 8px; }
  #units-table th:first-child,
  #units-table td:first-child { display: none; }

  /* Wide tables become stacked cards instead of scrolling sideways. */
  table.data.stackable,
  table.data.stackable tbody,
  table.data.stackable tr,
  table.data.stackable td { display: block; }
  table.data.stackable thead { display: none; }
  table.data.stackable tr {
    border: 1px solid var(--line);
    border-radius: 3px;
    margin: 10px 12px;
  }
  table.data.stackable td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 14px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }
  table.data.stackable td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
  }
  table.data.stackable tr td:last-child { border-bottom: none; }
  table.data.stackable td.empty-cell { display: block; }
  table.data.stackable td.empty-cell::before { content: none; }
  table.data.stackable td.actions { display: block; padding-top: 10px; }
  table.data.stackable td.actions::before { content: none; }
  table.data.stackable td.actions .btn { display: block; width: 100%; padding: 11px; font-size: 15px; }
}
