:root {
  --primary: #1a3c6e;
  --primary-light: #2563a8;
  --accent: #e8a020;
  --accent-light: #f5c860;
  --success: #2ecc71;
  --danger: #e74c3c;
  --bg: #f4f7fc;
  --card: #ffffff;
  --text: #1a2340;
  --text-muted: #6b7a99;
  --border: #dde3ef;
  --shadow: 0 4px 20px rgba(26,60,110,0.10);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Helvetica Neue', 'PingFang HK', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

/* ===== HEADER ===== */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(26,60,110,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo img { height: 36px; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.logo-sub { font-size: 11px; opacity: 0.75; margin-top: 1px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.header-btn:hover { background: rgba(255,255,255,0.25); }

/* ===== LAYOUT ===== */
.container { max-width: 900px; margin: 0 auto; padding: 32px 20px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 32px 20px; }

/* ===== CARD ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  margin-bottom: 24px;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon { font-size: 20px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,60,110,0.25); }
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,160,32,0.35); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 15px 36px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ===== FORM ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 7px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border 0.2s;
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.10);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M6 8L0 0h12z' fill='%236b7a99'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Radio / Checkbox groups */
.radio-group, .check-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-item, .check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
}
.radio-item:hover, .check-item:hover { border-color: var(--primary-light); }
.radio-item.selected, .check-item.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.radio-item input, .check-item input { display: none; }

/* Grade inputs table */
.grades-table { width: 100%; border-collapse: collapse; }
.grades-table th {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}
.grades-table td { padding: 8px 10px; border: 1px solid var(--border); }
.grades-table tr:nth-child(even) td { background: #f8f9fb; }
.grades-table input {
  width: 80px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  text-align: center;
  font-size: 13px;
}

/* ===== STEP PROGRESS ===== */
.progress-bar {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  gap: 0;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 17px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.step.done:not(:last-child)::after { background: var(--primary); }
.step-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  z-index: 1;
  transition: all 0.3s;
}
.step.active .step-circle { background: var(--primary); border-color: var(--primary); color: white; }
.step.done .step-circle { background: var(--success); border-color: var(--success); color: white; }
.step-label { font-size: 11px; color: var(--text-muted); margin-top: 5px; text-align: center; white-space: nowrap; }
.step.active .step-label { color: var(--primary); font-weight: 600; }

/* ===== ASSESSMENT QUESTIONS ===== */
.question-block {
  background: #fafbfd;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 14px;
}
.question-num { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.question-text { font-size: 15px; font-weight: 600; margin-bottom: 14px; line-height: 1.5; }
.question-image { max-width: 100%; margin-bottom: 12px; border-radius: 6px; }
.options-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
}
.option-item:hover { border-color: var(--primary-light); background: #f0f5ff; }
.option-item.selected { border-color: var(--primary); background: #e8f0fe; }
.option-item.correct { border-color: var(--success); background: #e8f8ee; }
.option-item.wrong { border-color: var(--danger); background: #fef0ee; }
.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.option-item.selected .option-letter { background: var(--primary); color: white; }

/* ===== RESULTS ===== */
.results-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 32px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  text-align: center;
}
.results-hero h2 { font-size: 24px; margin-bottom: 8px; }
.results-hero p { opacity: 0.85; font-size: 15px; }

.tier-section { margin-bottom: 28px; }
.tier-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 16px;
}
.tier-safe { background: linear-gradient(135deg,#27ae60,#2ecc71); color: white; }
.tier-target { background: linear-gradient(135deg,#2980b9,#3498db); color: white; }
.tier-reach { background: linear-gradient(135deg,#e67e22,#f39c12); color: white; }

.school-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s;
}
.school-card:hover { box-shadow: 0 4px 16px rgba(26,60,110,0.10); }
.school-rank {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--primary);
}
.school-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.school-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
}
.badge-grade { background: #e8f0fe; color: var(--primary); }
.badge-band { background: #e8f8ee; color: #1a7a4a; }
.badge-dist { background: #fff3e0; color: #b36200; }
.badge-type { background: #f3e8ff; color: #6b21a8; }
.school-score {
  text-align: center;
  min-width: 60px;
}
.score-num { font-size: 22px; font-weight: 800; color: var(--primary); }
.score-label { font-size: 11px; color: var(--text-muted); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.login-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 780px;
  width: 100%;
}
.login-card {
  background: white;
  border-radius: 18px;
  padding: 40px 32px;
  text-align: center;
  cursor: pointer;
  border: 2px solid var(--border);
  transition: all 0.25s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.login-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(26,60,110,0.15);
  transform: translateY(-3px);
}
.login-icon { font-size: 52px; margin-bottom: 18px; }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; color: var(--primary); }
.login-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; }

/* ===== WAITING PAGE ===== */
.waiting-page { text-align: center; padding: 60px 20px; }
.waiting-icon { font-size: 72px; margin-bottom: 20px; }
.waiting-title { font-size: 26px; font-weight: 700; color: var(--primary); margin-bottom: 12px; }
.waiting-sub { color: var(--text-muted); font-size: 16px; line-height: 1.7; max-width: 500px; margin: 0 auto 28px; }

/* ===== STAFF PORTAL ===== */
.portal-layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.sidebar {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  height: fit-content;
  position: sticky;
  top: 84px;
}
.sidebar-title { font-weight: 700; font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  margin-bottom: 4px;
  text-decoration: none;
  color: var(--text);
}
.sidebar-item:hover, .sidebar-item.active { background: #e8f0fe; color: var(--primary); }
.sidebar-item .icon { font-size: 16px; }

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-info { background: #e8f0fe; color: var(--primary); border-left: 4px solid var(--primary); }
.alert-success { background: #e8f8ee; color: #1a7a4a; border-left: 4px solid var(--success); }
.alert-warning { background: #fff8e1; color: #7a4a00; border-left: 4px solid var(--accent); }

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.section-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.divider { border: none; border-top: 1.5px solid var(--border); margin: 24px 0; }

/* Fee range slider */
.fee-display {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
input[type=range] { width: 100%; accent-color: var(--primary); }

@media (max-width: 680px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .login-cards { grid-template-columns: 1fr; }
  .portal-layout { grid-template-columns: 1fr; }
  .card { padding: 20px 18px; }
  .school-card { grid-template-columns: 40px 1fr; }
  .school-score { display: none; }
}
