:root {
  --primary: #0d4bb0;
  --primary-dark: #082b65;
  --primary-soft: #dce9ff;
  --accent: #f7b733;
  --success: #12a150;
  --danger: #dc2626;
  --ink: #0f172a;
  --muted: #64748b;
  --line: rgba(148, 163, 184, .32);
  --panel: rgba(255, 255, 255, .76);
  --panel-strong: rgba(255, 255, 255, .92);
  --shadow: 0 24px 80px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Outfit, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(13, 75, 176, .22), transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(247, 183, 51, .28), transparent 28%),
    linear-gradient(135deg, #eef5ff 0%, #f8fbff 42%, #edf7f0 100%);
}
a { color: inherit; }
.glass-panel,
.lookup-card,
.result-card,
.admin-card,
.table-wrap {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.eyebrow {
  display: inline-flex;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.muted, small { color: var(--muted); }

/* Public portal */
.public-page { min-height: 100vh; overflow-x: hidden; }
.public-shell { min-height: 100vh; display: flex; flex-direction: column; position: relative; padding: 16px; }
.aurora { position: fixed; width: 460px; height: 460px; border-radius: 999px; filter: blur(20px); opacity: .28; pointer-events: none; }
.aurora-one { left: -140px; top: -130px; background: #0d4bb0; }
.aurora-two { right: -180px; bottom: 20%; background: #f7b733; }
.result-header {
  width: min(1120px, 100%);
  margin: 0 auto;
  border-radius: 22px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark, .lookup-icon {
  width: 46px; height: 46px; border-radius: 16px;
  display: grid; place-items: center;
  color: #fff; font-weight: 900;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 14px 34px rgba(13, 75, 176, .28);
  flex: 0 0 auto;
}
.brand strong { display: block; line-height: 1.1; }
.brand span span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.header-help { color: var(--primary-dark); font-weight: 900; text-decoration: none; white-space: nowrap; }
.result-landing {
  width: min(1120px, 100%);
  margin: auto;
  padding: clamp(24px, 6vw, 64px) 0 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(330px, 430px);
  gap: clamp(20px, 5vw, 42px);
  align-items: center;
}
.hero-copy h1 {
  margin: 10px 0 16px;
  font-size: clamp(2.25rem, 6vw, 5rem);
  line-height: 1;
  letter-spacing: 0;
}
.hero-copy p { margin: 0 0 22px; color: var(--muted); font-size: 1.08rem; line-height: 1.75; max-width: 690px; }
.notice {
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--primary-dark);
  font-weight: 800;
  line-height: 1.55;
}
.lookup-card {
  border-radius: 28px;
  padding: clamp(22px, 4vw, 34px);
  position: relative;
  overflow: hidden;
}
.lookup-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--success));
}
.lookup-card h2 { margin: 18px 0 8px; font-size: 1.75rem; }
.lookup-card p { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.form-grid { display: grid; gap: 15px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, .88);
  color: var(--ink);
}
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(13, 75, 176, .16);
  border-color: var(--primary);
}
.field small { display: block; margin-top: 6px; font-weight: 700; }
.btn {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 11px 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 900;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: progress; opacity: .78; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; box-shadow: 0 14px 34px rgba(13, 75, 176, .25); }
.btn-secondary { background: rgba(220, 233, 255, .88); color: var(--primary-dark); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-wide { width: 100%; }
.btn.is-loading::before {
  content: "";
  width: 16px; height: 16px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.55);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.alert { border-radius: 16px; padding: 12px 14px; margin: 16px 0; font-weight: 800; line-height: 1.5; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #ecfdf5; border: 1px solid #bbf7d0; color: #065f46; }
.footer-help {
  width: min(1120px, 100%);
  margin: 0 auto;
  border-radius: 20px;
  padding: 13px 16px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
}

/* Result modal */
.result-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .58);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 999;
}
.result-modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 30px;
  position: relative;
}
.modal-close {
  position: sticky;
  top: 14px;
  float: right;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .16);
}
.result-card { border-radius: 30px; overflow: hidden; background: var(--panel-strong); }
.result-banner {
  padding: 30px clamp(20px, 5vw, 34px);
  background:
    radial-gradient(circle at 88% 20%, rgba(247, 183, 51, .4), transparent 32%),
    linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
}
.result-banner .eyebrow { color: rgba(255,255,255,.82); }
.result-banner h2 { margin: 10px 0; font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.05; }
.result-banner p { margin: 0; color: rgba(255,255,255,.88); line-height: 1.7; }
.result-body { padding: clamp(18px, 4vw, 28px); display: grid; gap: 16px; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric, .instruction-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(245, 248, 255, .86);
}
.metric span, .instruction-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.metric strong { display: block; font-size: 1.12rem; margin-top: 8px; line-height: 1.3; overflow-wrap: anywhere; }
.instruction-box p { margin: 9px 0 0; color: #334155; line-height: 1.65; }
.scholarship {
  border: 1px solid rgba(247, 183, 51, .42);
  border-left: 5px solid var(--accent);
  background: #fff8e5;
  border-radius: 18px;
  padding: 16px;
}
.scholarship strong { display: block; font-size: 1.05rem; }
.scholarship p { margin: 8px 0 0; color: #6b4b00; line-height: 1.6; }
.result-actions .btn { flex: 1 1 150px; }

/* Admin */
.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background:
    radial-gradient(circle at 78% 8%, rgba(247, 183, 51, .16), transparent 28%),
    linear-gradient(135deg, #f4f8ff, #eef7f3);
}
.admin-sidebar {
  background: linear-gradient(180deg, #071c43, #0f172a);
  color: #cbd5e1;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.admin-sidebar .brand { color: #fff; margin-bottom: 26px; }
.admin-sidebar .brand span span { color: #9fb2d1; max-width: 150px; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 12px 13px;
  border-radius: 14px;
  font-weight: 850;
}
.admin-nav a.active,
.admin-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.admin-main { padding: clamp(18px, 3vw, 30px); min-width: 0; }
.admin-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.admin-top h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.7rem); }
.cards, .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.admin-card {
  border-radius: 22px;
  padding: 18px;
}
.admin-card > span, .stat-card span { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 900; }
.admin-card > strong, .stat-card strong { display: block; font-size: 2rem; margin-top: 4px; }
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
  content: "";
  position: absolute;
  width: 82px; height: 82px; border-radius: 999px;
  right: -22px; top: -22px;
  background: rgba(13, 75, 176, .11);
}
.dashboard-hero {
  border-radius: 26px;
  padding: clamp(20px, 4vw, 30px);
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.dashboard-hero h2 { margin: 8px 0; font-size: clamp(1.8rem, 4vw, 3rem); }
.dashboard-hero p { margin: 0; color: var(--muted); }
.portal-status {
  min-width: 140px;
  text-align: center;
  padding: 13px 16px;
  border-radius: 999px;
  font-weight: 900;
}
.portal-status.open { background: #dcfce7; color: #166534; }
.portal-status.closed { background: #fee2e2; color: #991b1b; }
.quick-actions {
  border-radius: 24px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.action-tile {
  text-decoration: none;
  border-radius: 18px;
  padding: 15px;
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(255,255,255,.8);
}
.action-tile strong { display: block; }
.action-tile span { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 16px; margin-bottom: 18px; }
.section-title { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; }
.section-title h2 { margin: 4px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; align-items: end; }
.toolbar .field { min-width: 170px; }
.table-wrap {
  overflow: auto;
  border-radius: 18px;
}
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: rgba(248, 250, 252, .78); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0; }
.compact-table table { min-width: 620px; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 9px; border-radius: 999px; font-weight: 900; font-size: 12px; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #e2e8f0; color: #334155; }
.pagination { display: flex; justify-content: center; gap: 10px; align-items: center; padding: 14px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #eef5ff, #fff7e0); }
.login-card { width: min(430px, 100%); }
.check-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  font-weight: 800;
}
.import-form { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(180px, auto) minmax(180px, auto) auto; gap: 12px; align-items: end; }
.confirm-import { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.timeline { display: grid; gap: 10px; }
.timeline-item { border: 1px solid var(--line); border-radius: 16px; padding: 13px; background: rgba(255,255,255,.64); }
.timeline-item strong, .timeline-item span, .timeline-item small { display: block; }
.timeline-item span { color: var(--muted); margin: 5px 0; }
.empty-state, .notice-preview { color: var(--muted); line-height: 1.7; }

@media print {
  .result-header, .lookup-card, .footer-help, .result-actions, .modal-close { display: none !important; }
  body { background: #fff; }
  .result-modal-backdrop { position: static; display: block; background: #fff; padding: 0; }
  .result-modal { max-height: none; width: 100%; box-shadow: none; border: 0; }
  .result-card { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 1000px) {
  .result-landing { grid-template-columns: 1fr; margin: 0 auto; }
  .cards, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid, .two-col, .import-form { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: relative; height: auto; }
  .admin-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-top, .dashboard-hero, .section-title, .confirm-import { align-items: stretch; flex-direction: column; }
}
@media (max-width: 640px) {
  .public-shell { padding: 10px; }
  .result-header { border-radius: 18px; }
  .brand span span { max-width: 42vw; }
  .header-help { font-size: 14px; }
  .hero-copy h1 { font-size: clamp(2rem, 11vw, 3.05rem); }
  .hero-copy p { font-size: 1rem; }
  .lookup-card { border-radius: 22px; }
  .footer-help { align-items: stretch; flex-direction: column; text-align: center; gap: 4px; }
  .result-modal-backdrop {
    padding: 0;
    align-items: stretch;
    place-items: stretch;
  }
  .result-modal {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .modal-close {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    width: 40px;
    height: 40px;
  }
  .result-card {
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .result-banner {
    flex: 0 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 64px 16px 18px;
  }
  .result-banner h2 {
    font-size: clamp(1.65rem, 8vw, 2.25rem);
    margin: 8px 0;
  }
  .result-banner p {
    font-size: .95rem;
    line-height: 1.45;
  }
  .result-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 12px calc(16px + env(safe-area-inset-bottom));
    gap: 10px;
  }
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .metric,
  .instruction-box,
  .scholarship {
    border-radius: 14px;
    padding: 10px 11px;
  }
  .metric span,
  .instruction-box span {
    font-size: 10px;
  }
  .metric strong {
    font-size: .98rem;
    margin-top: 5px;
  }
  .instruction-box p,
  .scholarship p {
    margin-top: 6px;
    line-height: 1.42;
    font-size: .92rem;
  }
  .result-actions {
    position: static;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px;
    margin-top: 2px;
    gap: 7px;
  }
  .result-actions .btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 9px 12px;
    font-size: .95rem;
  }
  .cards, .summary-grid, .quick-actions { grid-template-columns: 1fr; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn { width: 100%; }
  .admin-main { padding: 14px; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  table { min-width: 700px; }
}
