* {
  box-sizing: border-box;
}

:root {
  --bg: #eef4ff;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: #ffffff;
  --border: #dbe5f4;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #15803d;
  --danger: #dc2626;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, "Helvetica Neue", Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
}

.layout {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px;
}

.hero {
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 28px;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 55%, #60a5fa 100%);
  color: #ffffff;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 18px;
  box-shadow: 0 24px 64px rgba(37, 99, 235, 0.25);
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 4px;
  font-size: 24px;
}

h3 {
  margin-bottom: 14px;
  font-size: 18px;
}

.subtext {
  margin-bottom: 0;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.55;
  font-size: 15px;
}

.subtext.emphasis {
  margin-top: 12px;
  font-weight: 700;
  color: #ffffff;
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.hero-stat {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.hero-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.5;
}

.stat-label,
.summary-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.74;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title.compact {
  align-items: center;
}

.section-title span,
.toolbar-note {
  color: var(--muted);
  font-size: 14px;
}

.toolbar-note {
  margin: 0;
  line-height: 1.5;
}

.search-shell {
  position: relative;
}

.admin-entry-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.admin-entry-link {
  min-height: auto;
  padding: 4px 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-entry-link:hover {
  color: #1d4ed8;
  transform: none;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

input,
select,
textarea,
button {
  font: inherit;
}

.secondary-button {
  background: #e2e8f0;
  color: #0f172a;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 13px 15px;
  font-size: 14px;
  background: var(--surface-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(59, 130, 246, 0.16);
  border-color: #60a5fa;
}

button {
  min-height: 46px;
  padding: 0 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.suggestion-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.suggestion-item,
.suggestion-empty {
  width: 100%;
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--text);
  box-shadow: none;
}

.suggestion-item strong,
.suggestion-item span,
.suggestion-item small {
  display: block;
}

.suggestion-item span,
.suggestion-item small,
.suggestion-empty {
  color: var(--muted);
  font-size: 13px;
}

.single-column {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

.review-banner {
  margin-bottom: 16px;
  border: 1px solid #dbeafe;
  border-radius: 20px;
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.08);
  outline: 3px solid rgba(37, 99, 235, 0.08);
}

.review-progress-track {
  width: 100%;
  height: 12px;
  margin-top: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbeafe, #bfdbfe);
  overflow: hidden;
}

.review-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #1d4ed8, #2563eb, #60a5fa);
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
  transition: width 0.2s ease;
}

.review-complete-badge {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 13px;
  font-weight: 700;
}

.section-stack {
  display: grid;
  gap: 12px;
}

.info-section {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfdff;
  overflow: hidden;
}

.info-section summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 700;
  position: relative;
}

.info-section summary::-webkit-details-marker {
  display: none;
}

.info-section summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 22px;
}

.info-section[open] summary::after {
  content: "–";
}

.section-grid,
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 18px 18px;
}

.compact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #ffffff;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.readonly-field input {
  background: #f8fafc;
}

.review-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
}

.review-check.changed {
  color: #dc2626;
}

.review-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2563eb;
}

.meta-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fbfdff;
  padding: 18px;
}

.full-width {
  grid-column: 1 / -1;
}

.actions {
  margin-top: 18px;
}

.draft-status {
  margin-top: 10px;
  min-height: 18px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.admin-login-form {
  display: grid;
  gap: 14px;
}

.last-update-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff1f2, #fff7f7);
  border: 1px solid #fda4af;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
}

.history-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  z-index: 61;
  width: min(92vw, 520px);
  margin: 8vh auto 0;
  background: #ffffff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.message {
  margin-top: 12px;
  min-height: 20px;
  font-weight: 600;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  line-height: 1.6;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.history-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.history-student {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.history-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.history-badge.changed {
  background: #dbeafe;
  color: #1d4ed8;
}

.history-badge.confirmed {
  background: #dcfce7;
  color: #15803d;
}

.history-body {
  display: grid;
  gap: 10px;
}

.history-change-row {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  background: #f8fbff;
}

.history-field-name {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-values {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.history-old,
.history-new {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.history-old {
  background: #fee2e2;
  color: #b91c1c;
}

.history-new {
  background: #dcfce7;
  color: #15803d;
}

.history-arrow {
  font-size: 16px;
  font-weight: 800;
  color: #64748b;
}

.history-confirm-box {
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #dcfce7, #ecfdf5);
  color: #166534;
  border: 1px solid #bbf7d0;
  font-weight: 600;
}

.history-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
  color: #334155;
}

.history-note-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

@media (max-width: 900px) {
  .hero,
  .compact-grid,
  .section-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .layout {
    padding: 14px;
  }

  .hero,
  .card {
    padding: 16px;
    border-radius: 20px;
  }

  .hero {
    gap: 14px;
  }

  .hero-copy {
    display: grid;
    gap: 10px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.2;
    margin-bottom: 0;
  }

  .subtext,
  .subtext.emphasis {
    font-size: 14px;
    line-height: 1.55;
    margin-top: 0;
  }

  .hero-panel {
    gap: 10px;
  }

  .hero-stat {
    padding: 14px;
  }

  .hero-stat strong {
    font-size: 15px;
    line-height: 1.45;
  }

  .section-title,
  .section-title.compact {
    flex-direction: column;
    align-items: stretch;
  }

  .section-title.compact button,
  .actions button,
  .suggestion-item {
    width: 100%;
  }

  .suggestion-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-grid,
  .meta-grid,
  .compact-grid {
    padding: 0 16px 16px;
  }

  .field-card {
    padding: 12px;
  }

  .review-banner {
    position: sticky;
    top: 10px;
    z-index: 20;
    padding: 14px 14px 14px 24px;
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(10px);
  }

  .review-progress-track {
    position: absolute;
    left: 8px;
    top: 16px;
    bottom: 16px;
    width: 6px;
    height: auto;
    margin-top: 0;
    border-radius: 999px;
  }

  .review-progress-bar {
    width: 100% !important;
    height: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    transition: height 0.2s ease;
  }

  .review-banner strong {
    font-size: 14px;
    line-height: 1.4;
  }

  .history-top {
    flex-direction: column;
  }

  .history-badge {
    white-space: normal;
  }

  .history-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-entry-wrap {
    justify-content: flex-start;
  }
}


.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
  padding: 24px;
}

.loading-box {
  width: min(100%, 320px);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25);
  padding: 24px 22px;
  display: grid;
  gap: 10px;
  text-align: center;
  color: #0f172a;
}

.loading-box strong {
  font-size: 18px;
}

.loading-box span {
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}

.loading-spinner {
  width: 54px;
  height: 54px;
  margin: 0 auto 4px;
  border-radius: 50%;
  border: 5px solid #dbeafe;
  border-top-color: #2563eb;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
