:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #343a40;
  --muted: #7d8790;
  --line: #dfe5ea;
  --accent: #ef3b2d;
  --blue: #28a9e0;
  --green: #2fb879;
  --red: #d95d55;
  --gold: #f0b64f;
  --purple: #8e44ad;
  --warning: #9a6400;
  --danger: #b42318;
  --success: #16794c;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.main-shell {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  color: #4a5158;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--red), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  font-size: clamp(1.25rem, 2.2vw, 2.2rem);
  line-height: 1.14;
  font-weight: 800;
  -webkit-text-fill-color: transparent;
}

h2 {
  color: #3f464d;
  font-size: 1.12rem;
  font-weight: 600;
}

h3 {
  color: #2f363d;
  font-size: 1.08rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.school-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  flex: 0 0 auto;
}

.status-panel,
.criteria-row,
.records-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.status-panel {
  display: grid;
  grid-template-columns: minmax(220px, auto) 1fr;
  gap: 16px;
  align-items: center;
  margin: 18px 24px 0;
  padding: 16px;
}

.source-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 3px;
}

.source-card p {
  margin: 0;
  color: #46505a;
}

.source-card p.error {
  color: var(--danger);
}

small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin: 18px 24px 0;
}

.stat-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 104px;
  overflow: hidden;
  padding: 18px 18px 14px;
  color: #fff;
  border-radius: 2px;
  box-shadow: var(--shadow);
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -42px;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.stat-card span,
.stat-card small,
.stat-card strong {
  position: relative;
  z-index: 1;
}

.stat-card span {
  font-size: 0.86rem;
  opacity: 0.94;
}

.stat-card strong {
  font-size: 2rem;
  line-height: 1;
}

.stat-card small {
  color: rgba(255, 255, 255, 0.84);
}

.stat-blue {
  background: var(--blue);
}

.stat-green {
  background: var(--green);
}

.stat-red {
  background: var(--red);
}

.stat-gold {
  background: var(--gold);
}

.criteria-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 18px 24px 0;
  background: var(--line);
}

.criteria-row div {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  background: var(--surface);
}

.criteria-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.criteria-row strong {
  color: #424950;
  font-size: 1.05rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin: 18px 24px 28px;
  align-items: start;
}

.records-panel,
.detail-panel {
  padding: 16px;
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

label {
  display: grid;
  gap: 6px;
  color: #4c555e;
  font-weight: 700;
}

.search-box span {
  font-size: 0.84rem;
}

input {
  width: 100%;
  border: 1px solid #cfd8df;
  border-radius: 3px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 169, 224, 0.16);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(4, auto);
  gap: 0;
  border: 1px solid #cfd8df;
  border-radius: 3px;
  overflow: hidden;
  background: #f5f7f9;
}

.segmented button {
  min-height: 38px;
  padding: 0 12px;
  color: #59636d;
  font-weight: 700;
  border: 0;
  border-right: 1px solid #cfd8df;
  background: transparent;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: #fff;
  background: var(--accent);
}

.secondary-button,
.icon-button,
.text-button {
  min-height: 38px;
  border: 1px solid #cfd8df;
  border-radius: 3px;
  font-weight: 700;
  color: #46505a;
  background: #fff;
}

.secondary-button {
  padding: 0 14px;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 1.12rem;
}

.secondary-button:hover,
.icon-button:hover,
.text-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

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

th {
  color: #4c555e;
  font-size: 0.78rem;
  text-transform: uppercase;
  background: #f3f5f7;
}

td {
  color: #303840;
  font-size: 0.92rem;
}

tr:hover td {
  background: #fafcfd;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status.eligible {
  color: var(--success);
  background: #dff5e9;
}

.status.not-eligible {
  color: var(--danger);
  background: #ffe3e0;
}

.status.incomplete {
  color: var(--warning);
  background: #fff1c9;
}

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

.text-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.selected-card {
  display: grid;
  gap: 14px;
}

.selected-card p {
  margin: 0;
  color: var(--muted);
}

.selected-card dl {
  display: grid;
  gap: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
}

.selected-card dl div {
  display: grid;
  grid-template-columns: minmax(116px, 0.9fr) 1fr;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.selected-card dl div:last-child {
  border-bottom: 0;
}

.selected-card dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.selected-card dd {
  margin: 0;
  color: #333b43;
  font-weight: 700;
}

.empty-state {
  display: none;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.hidden {
  display: none;
}

.credit-caption {
  color: #66717b;
  font-size: 12px;
  font-style: italic;
  text-align: right;
  pointer-events: none;
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

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

@media (max-width: 820px) {
  .topbar,
  .status-panel,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions {
    justify-content: start;
  }
}

@media (max-width: 620px) {
  .status-panel,
  .dashboard-grid,
  .criteria-row,
  .content-grid {
    margin-left: 12px;
    margin-right: 12px;
  }

  .topbar {
    padding: 18px 12px;
  }

  .dashboard-grid,
  .criteria-row {
    grid-template-columns: 1fr;
  }

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

  .segmented button {
    border-right: 0;
    border-bottom: 1px solid #cfd8df;
  }

  .segmented button:last-child {
    border-bottom: 0;
  }

  .selected-card dl div {
    grid-template-columns: 1fr;
  }
}
