:root {
  --ink: #0f1c2e;
  --ink-soft: #3d4f66;
  --muted: #6b7c90;
  --line: #e2e8f0;
  --paper: #ffffff;
  --bg: #f4f6f9;
  --navy: #1a365d;
  --navy-2: #234876;
  --blue: #2563eb;
  --teal: #0d9488;
  --gold: #b45309;
  --ok: #15803d;
  --warn: #c2410c;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(15, 28, 46, 0.04), 0 8px 24px rgba(15, 28, 46, 0.06);
  --radius: 14px;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --display: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
body { position: relative; }

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(37, 99, 235, 0.07), transparent 60%),
    radial-gradient(700px 380px at 100% 0%, rgba(13, 148, 136, 0.05), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

#publicApp, #adminApp, .modal, .toast, .present, .confetti-layer {
  position: relative;
  z-index: 1;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.top-gap { margin-top: 16px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: 1px solid var(--line);
}
.brand-logo.sm { width: 40px; height: 40px; }
.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.brand-title {
  margin: 2px 0 0;
  font-size: 1.15rem;
  font-family: var(--display);
  color: var(--navy);
}
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #eff6ff;
  color: var(--navy-2);
  border: 1px solid #dbeafe;
}
.chip-muted { background: #f8fafc; color: var(--ink-soft); border-color: var(--line); }
.chip.syncing { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 20px;
  padding: 28px 0 8px;
}
.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.hero-copy h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  line-height: 1.25;
  color: var(--navy);
}
.lead {
  margin: 14px 0 0;
  color: var(--ink-soft);
  line-height: 1.65;
  max-width: 36rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.trust-row li {
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.hero-aside { display: grid; gap: 12px; }
.aside-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.aside-label {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.aside-value {
  margin: 8px 0 4px;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.aside-meta { margin: 0; font-size: 0.85rem; color: var(--muted); }
.school-list { margin: 10px 0 0; padding: 0; list-style: none; }
.school-list li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.86rem;
}
.school-list li:last-child { border-bottom: 0; }
.school-list span { color: var(--muted); }
.school-list strong { font-weight: 600; color: var(--ink); }

/* Nav / panels */
.public-nav {
  display: flex;
  gap: 8px;
  margin: 18px 0 14px;
  flex-wrap: wrap;
}
.nav-pill {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}
.nav-pill:hover { transform: translateY(-1px); border-color: #cbd5e1; }
.nav-pill.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.view-panel { display: none; }
.view-panel.active { display: block; animation: rise 0.28s ease; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h3, .panel h4 { margin: 0 0 8px; color: var(--navy); }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.split-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.muted { color: var(--muted); }
.tiny { font-size: 0.82rem; }
.feedback { min-height: 20px; margin: 8px 0 0; font-size: 0.88rem; color: var(--muted); }

.stack { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(15, 28, 46, 0.1); }
.btn:active { transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--navy-2), var(--navy)); color: #fff; }
.btn-secondary { background: #eff6ff; color: var(--navy); border: 1px solid #bfdbfe; }
.btn-ghost { background: #fff; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-danger { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.flow-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.flow-steps li {
  counter-increment: step;
  padding: 6px 10px 6px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.flow-steps li::before {
  content: counter(step);
  display: inline-flex;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: #fff;
  font-size: 0.7rem;
}

.status-pair { display: flex; gap: 6px; flex-wrap: wrap; }
.status-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.status-pill.done { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi span { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.kpi em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.kpi-ok strong { color: var(--ok); }
.kpi-warn strong { color: var(--warn); }

.progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  transition: width 0.45s ease;
}
.bar-blue { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.bar-teal { background: linear-gradient(90deg, #14b8a6, #0f766e); }
.bar-gold { background: linear-gradient(90deg, #f59e0b, #b45309); }

.chart-bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 160px) 1fr 78px;
  gap: 8px;
  align-items: center;
  font-size: 0.84rem;
}
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #1e40af);
  transition: width 0.4s ease;
}

.donut-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.donut {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: conic-gradient(#cbd5e1 0deg, #cbd5e1 360deg);
  box-shadow: inset 0 0 0 28px #fff;
  border: 8px solid #f8fafc;
}
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 0.82rem; color: var(--ink-soft); }
.legend-item { display: flex; gap: 8px; align-items: center; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.banner-ok {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: var(--ok);
  font-size: 0.88rem;
  font-weight: 600;
}
.notice { text-align: center; padding: 28px; }
.watermark {
  margin-top: 14px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.site-footer {
  padding: 28px 20px 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.check {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: 500 !important;
}
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.span-2 { grid-column: 1 / -1; }

.list-stack { display: flex; flex-direction: column; gap: 8px; }
.candidate-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fafbfc;
}
.candidate-item p { margin: 3px 0; font-size: 0.82rem; color: var(--muted); font-weight: 500; }

.table-scroll {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: #f8fafc; position: sticky; top: 0; color: var(--ink-soft); }

/* Admin shell */
#adminApp {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
#adminApp.hidden { display: none !important; }

.admin-sidebar {
  background: linear-gradient(180deg, #0f1c2e 0%, #1a365d 100%);
  color: #e2e8f0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.admin-brand strong { display: block; font-size: 0.95rem; color: #fff; }
.admin-brand span { display: block; font-size: 0.72rem; color: #94a3b8; margin-top: 2px; }
.admin-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.admin-nav-btn {
  text-align: left;
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 11px 12px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.admin-nav-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.admin-nav-btn.active { background: rgba(37, 99, 235, 0.35); color: #fff; }
.admin-side-foot { display: flex; flex-direction: column; gap: 8px; }

.admin-main {
  padding: 18px 22px 28px;
  overflow-x: hidden;
}
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-topbar h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  color: var(--navy);
}
.admin-view { display: none; }
.admin-view.active { display: block; animation: rise 0.25s ease; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gauge-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 8px auto;
}
.gauge-wrap canvas { width: 100% !important; height: 100% !important; }
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gauge-center strong { font-size: 2rem; color: var(--navy); }
.gauge-center span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.mini-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--ink-soft);
}
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }

.meter { margin: 14px 0; }
.meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

/* Modal / toast / present */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 28, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: 0 24px 48px rgba(15, 28, 46, 0.2);
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 60;
  background: var(--navy);
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15, 28, 46, 0.25);
  max-width: 320px;
  font-size: 0.88rem;
}
.present {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: #f8fafc;
  padding: 18px;
  overflow: auto;
}
.present-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.present-bar h2 { margin: 0; font-family: var(--display); color: var(--navy); }
.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
}
.confetti {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 12px;
  animation: fall 2.6s linear forwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(620deg); opacity: 0; }
}

@media (max-width: 980px) {
  .hero, .split, .dash-grid, .form-grid, .split-inner, .kpi-row, .donut-row {
    grid-template-columns: 1fr;
  }
  #adminApp { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
  }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .header-row { flex-direction: column; align-items: flex-start; }
  .bar-row { grid-template-columns: 110px 1fr 64px; }
}
