:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #627084;
  --line: #d7dee8;
  --surface: #ffffff;
  --soft: #f2f6f9;
  --brand: #0a6f7b;
  --brand-strong: #084f58;
  --accent: #d61f2c;
  --gold: #f3c400;
  --panel: #182033;
  --ok-bg: #e8f7ef;
  --ok-ink: #176b3a;
  --warn-bg: #fff3e0;
  --warn-ink: #8a4b00;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(243, 196, 0, 0.13), transparent 26%),
    radial-gradient(circle at top right, rgba(10, 111, 123, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eef3f7 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  min-height: 34px;
  padding: 0 12px;
}

button:hover {
  background: var(--brand-strong);
}

button.secondary {
  background: #e9eef2;
  color: var(--ink);
}

button.secondary:hover {
  background: #dce5ea;
}

input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.16);
  outline: 0;
}

.app-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 3px 0 14px;
}

.school-header {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2px 0 9px;
  position: relative;
  text-align: center;
}

.school-brand {
  display: grid;
  justify-items: center;
  gap: 1px;
}

.school-logo {
  width: clamp(46px, 6vw, 68px);
  height: auto;
  filter: drop-shadow(0 8px 11px rgba(17, 24, 39, 0.14));
}

.school-name {
  color: var(--panel);
  font-size: clamp(12px, 1.5vw, 16px);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-toggle {
  align-self: start;
  min-height: 32px;
  border: 1px solid rgba(24, 32, 51, 0.14);
  background: rgba(255, 255, 255, 0.95);
  color: var(--panel);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.14);
  white-space: nowrap;
}

.admin-toggle:hover,
.admin-toggle.is-open {
  background: var(--panel);
  color: #fff;
}

.admin-toggle.is-active {
  background: var(--ok-ink);
  color: #fff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: stretch;
  padding: clamp(13px, 2vw, 18px);
  background:
    linear-gradient(90deg, rgba(10, 111, 123, 0.94), rgba(24, 32, 51, 0.96)),
    linear-gradient(135deg, #ffffff 0%, #eaf6f5 58%, #fff0e9 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(17, 24, 39, 0.14);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid var(--gold);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 6px;
  color: #ffe36f;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3.5vw, 38px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 3px;
  font-size: 19px;
}

.hero-title-row {
  margin-bottom: 5px;
}

.lede {
  max-width: none;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.32;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.hero-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  text-align: center;
}

.hero-panel strong {
  font-size: 34px;
  line-height: 1;
}

.stat-label,
.stat-caption {
  color: rgba(255, 255, 255, 0.78);
}

.hint,
.section-heading p {
  color: var(--muted);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.search-section,
.admin-section,
.manage-section {
  margin-top: 8px;
  padding: clamp(11px, 1.6vw, 15px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.07);
}

.search-section {
  border-top: 4px solid var(--accent);
  background: #eefaf1;
}

.admin-section {
  border-top: 4px solid var(--gold);
  margin-top: 7px;
  margin-bottom: 8px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.manage-section {
  border-top: 4px solid var(--brand);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 7px;
}

.search-section {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(300px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.search-section .section-heading {
  grid-column: 1 / -1;
  margin-bottom: -4px;
}

.compact-heading {
  margin-bottom: 10px;
}

.toolbar,
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-form label,
.admin-form label,
.student-form label,
.import-box label {
  display: grid;
  gap: 3px;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 3px;
}

.search-section .search-row {
  grid-template-columns: minmax(0, 1fr) 150px;
}

.hint {
  margin: 4px 0 0;
  font-size: 12px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.admin-status.is-active {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

#adminLogout {
  margin-top: 14px;
}

.result-panel {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: linear-gradient(180deg, #f9fbfd 0%, var(--soft) 100%);
  box-shadow: inset 0 1px 0 #fff;
  min-height: 96px;
}

.result-panel.is-empty {
  color: var(--muted);
}

.result-panel.is-warning {
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-color: #ffd89b;
}

.result-card h3 {
  margin: 5px 0 7px;
  color: var(--accent);
  font-size: 18px;
  text-align: center;
}

.result-card {
  padding: 9px;
  border: 1px solid rgba(10, 111, 123, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 247, 239, 0.62)),
    #ffffff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 6px;
  background: var(--ok-bg);
  color: var(--ok-ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

dl > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid rgba(10, 111, 123, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

dt {
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 900;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

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

.form-actions {
  margin-top: 12px;
}

.import-box {
  margin-top: 14px;
  padding: 12px;
  background: #f9fbfd;
  border: 1px dashed #b9c7d0;
  border-radius: 8px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: #fff;
}

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

th {
  background: var(--panel);
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
}

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

.action-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-cell button {
  min-height: 32px;
  padding: 0 12px;
}

.danger {
  background: #b83232;
}

.danger:hover {
  background: #8f2424;
}

tbody tr:hover {
  background: #fbfdff;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.site-footer {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 820px) {
  .hero,
  .section-heading,
  .search-section,
  .search-row,
  .form-grid,
  dl,
  dl > div {
    grid-template-columns: 1fr;
  }

  .hero {
    text-align: left;
  }

  .lede {
    white-space: normal;
  }

  .school-header {
    align-items: center;
    padding-top: 12px;
  }

  .admin-toggle {
    width: auto;
    margin-left: 0;
  }

  .section-heading {
    display: grid;
  }

  .hero {
    padding: 24px;
  }

  .search-section,
  .admin-section,
  .manage-section {
    padding: 20px;
  }

  button {
    width: 100%;
  }

  .admin-toggle {
    width: auto;
  }
}

@media (max-width: 560px) {
  .school-header {
    display: grid;
    gap: 14px;
    justify-items: center;
  }

  .admin-toggle {
    margin-left: 0;
    width: 100%;
  }
}
