/* ============================================================
   Mwendo Fellowship — Design System
   Lato · Brand palette · Premium finish
   ============================================================ */

:root {
  --blue:        #1A5F7A;
  --blue-dark:   #134d63;
  --blue-light:  #2278a0;
  --green:       #57A773;
  --green-dark:  #429a5e;
  --accent-bg:   #E8F4F0;
  --text:        #1E2A32;
  --text-muted:  #6b7a85;
  --text-light:  #9aaab6;
  --bg:          #f8f5ee;
  --surface:     #ffffff;
  --border:      #e4eaee;
  --border-mid:  #cdd8e0;
  --error:       #c0392b;
  --error-bg:    #fdf3f2;
  --success:     #2e7d52;
  --warning:     #b45309;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow-xs:   0 1px 3px rgba(26,47,50,.06);
  --shadow-sm:   0 2px 8px rgba(26,47,50,.09);
  --shadow:      0 4px 20px rgba(26,47,50,.10);
  --shadow-lg:   0 12px 40px rgba(26,47,50,.14);

  --max-w:       680px;
  --transition:  0.18s ease;
}

/* ---- Dark mode ---- */
[data-theme="dark"] .logo-wordmark { color: #4ade80; }

[data-theme="dark"] {
  --blue:        #4db8d4;
  --blue-dark:   #3aa0bc;
  --blue-light:  #6ecde3;
  --green:       #6dcf8a;
  --green-dark:  #57b873;
  --accent-bg:   #1a2e35;
  --text:        #e8edf0;
  --text-muted:  #8fa4b0;
  --text-light:  #5a7280;
  --bg:          #0f1a1f;
  --surface:     #162028;
  --border:      #1e2e38;
  --border-mid:  #2a3d4a;
  --error:       #f87171;
  --error-bg:    #2a1a1a;
  --success:     #6ee7a0;
  --shadow-xs:   0 1px 3px rgba(0,0,0,.3);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.4);
  --shadow:      0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:   0 12px 40px rgba(0,0,0,.6);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', 'Lato', sans-serif;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-light); text-decoration: underline; }
img { display: block; max-width: 100%; }

/* ---- Header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-link:hover { text-decoration: none; }
.site-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.logo-wordmark {
  font-family: 'Lato', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #00566a;
  line-height: 1;
}

/* ---- Header right slot ---- */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---- Dark mode toggle ---- */
.theme-toggle {
  background: none;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition),
              background var(--transition);
  flex-shrink: 0;
  font-size: 1rem;
}
.theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--accent-bg);
}
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }

/* ---- Header resume button ---- */
.header-resume-btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  min-height: 38px;
  border-color: var(--border-mid);
  color: var(--blue);
}
.header-resume-btn:hover {
  border-color: var(--blue);
  background: var(--accent-bg);
  color: var(--blue);
  text-decoration: none;
}

/* ---- Flash messages ---- */
.flash-container { padding: 0.75rem 1.5rem; }
.flash {
  background: var(--blue);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 400;
  max-width: var(--max-w);
  margin: 0 auto;
}

/* ---- Layout ---- */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}
.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-light);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.center-card {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
}
.card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.6rem;
}
.card-subtitle {
  font-size: 1rem;
  color: var(--text);
  font-weight: 400;
  line-height: 1.65;
  margin-bottom: 2rem;
  opacity: 0.75;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-family: 'Lato', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  min-height: 46px;
  white-space: nowrap;
  -webkit-appearance: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.985); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: #fff;
  box-shadow: 0 4px 14px rgba(26,95,122,.35);
}

.btn-green {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-green:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--blue);
  color: var(--blue);
}

.btn-full { width: 100%; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; min-height: 34px; }
.btn-danger-ghost { border-color: var(--error); color: var(--error); }
.btn-danger-ghost:hover { background: var(--error-bg); }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-danger:hover { background: #a93226; border-color: #a93226; }
.inline-status-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

/* ---- Alerts ---- */
.alert {
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  font-weight: 400;
}
.alert-error {
  background: var(--error-bg);
  border-left: 3px solid var(--error);
  color: var(--error);
}
.alert-success {
  background: var(--surface);
  border-left: 3px solid var(--green);
  color: var(--text);
}
[data-theme="dark"] .alert-error { color: #f87171; }
[data-theme="dark"] .alert-success { background: var(--surface); color: var(--text); }

/* ---- Form fields ---- */
.simple-form { display: flex; flex-direction: column; gap: 1.1rem; }
.field-row { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.4rem; }
.field-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  display: block;
}
.field-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 0.4rem;
  line-height: 1.5;
}
.required { color: var(--error); margin-left: 1px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  font-family: 'Lato', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,95,122,.12);
}
textarea { resize: vertical; min-height: 130px; line-height: 1.65; }
input.error, textarea.error, input.highlight-missing, textarea.highlight-missing,
select.highlight-missing {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(192,57,43,.1);
}
input::placeholder, textarea::placeholder { color: var(--text-light); font-weight: 300; }

/* select chevron */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a85' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.4rem;
}

/* ---- Radio options ---- */
fieldset { border: none; padding: 0; margin: 0 0 1rem; }
fieldset legend { display: block; width: 100%; margin-bottom: 1.2rem; }
.radio-group { display: flex; flex-direction: column; gap: 0.55rem; margin: 0 0 1.75rem; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.radio-option:hover { border-color: var(--blue-light); background: #f4fafd; }
[data-theme="dark"] .radio-option:hover { background: #1e3040; border-color: var(--blue); }
.radio-option input[type="radio"] {
  width: 18px; height: 18px;
  accent-color: var(--blue);
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  box-shadow: none;
  margin: 0;
  padding: 0;
}
.radio-option:has(input:checked) {
  border-color: var(--blue);
  background: #eef6fa;
  box-shadow: 0 0 0 3px rgba(26,95,122,.08);
}
[data-theme="dark"] .radio-option:has(input:checked) { background: #1a3040; box-shadow: 0 0 0 3px rgba(77,184,212,.12); }
.radio-option:has(input:checked) span { font-weight: 700; color: var(--blue-dark); }
[data-theme="dark"] .radio-option:has(input:checked) span { color: var(--blue); }

/* ---- Eligibility / info pages ---- */
.resume-hint { text-align: center; margin-top: 1.75rem; font-size: 0.9rem; color: var(--text-muted); font-weight: 300; }
.ineligible-icon { font-size: 3rem; text-align: center; margin-bottom: 1.25rem; }

.callout {
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin: 1.5rem 0;
}
.callout h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.callout p { font-size: 0.95rem; font-weight: 300; line-height: 1.65; }
.callout-warm { background: #fdf6ee; border-left: 4px solid #e3943a; color: var(--text); }
[data-theme="dark"] .callout-warm { background: #2a1f12; border-left-color: #c47a2a; }
.callout-neutral { background: var(--accent-bg); border-left: 4px solid var(--blue); }
.callout-warm .btn, .callout-neutral .btn { margin-top: 1.1rem; }

.muted-text { color: var(--text-muted); font-size: 0.88rem; font-weight: 300; margin-top: 1.25rem; }

/* ---- Progress stepper ---- */
.progress-bar-wrap {
  max-width: var(--max-w);
  margin: 0 auto 0.5rem;
  padding: 1.5rem 0 0;
}
.progress-bar {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding-bottom: 2.75rem;
}
.progress-bar::before {
  content: '';
  position: absolute;
  top: 11px;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  position: relative;
  z-index: 1;
  flex: 1;
}
.progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}
.progress-step.active .progress-dot {
  background: var(--blue);
  box-shadow: 0 0 0 2px var(--blue);
}
.progress-step.current .progress-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(87,167,115,.3);
}
.progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
  text-align: center;
}
.progress-step.active .progress-label { color: var(--blue); }
.progress-step.current .progress-label { color: var(--green-dark); }

/* ---- Form sections ---- */
.form-section { display: none; max-width: var(--max-w); margin: 0 auto; }
.form-section.active { display: block; animation: fadeUp 0.22s ease; }

.section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.section-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 300;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.section-note strong { font-weight: 700; color: var(--blue-dark); }

/* ---- Essay fields ---- */
.essay-field { margin-bottom: 2rem; }
.essay-label {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.word-count-row { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; }
.word-count { font-size: 0.78rem; color: var(--text-light); font-weight: 400; }
.word-count.under-min  { color: var(--text-muted); font-weight: 400; }
.word-count.in-range   { color: var(--success); font-weight: 700; }
.word-count.near-limit { color: var(--warning); font-weight: 700; }
.word-count.over-limit { color: var(--error);   font-weight: 700; }
.word-target { font-size: 0.78rem; color: var(--text-light); font-weight: 300; }
textarea.over-limit  { border-color: var(--error); }
textarea.under-min   { border-color: var(--border-mid); }

/* ---- Step nav ---- */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  gap: 1rem;
}

/* ---- Submit error list ---- */
.submit-errors {
  background: var(--error-bg);
  border-left: 4px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.5rem;
}
.submit-errors-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--error);
  margin-bottom: 0.6rem;
}
.submit-errors ul { padding-left: 1.2rem; margin: 0; }
.submit-errors li { font-size: 0.9rem; color: var(--error); margin-bottom: 0.3rem; line-height: 1.5; }

/* ---- Review section ---- */
.review-content { display: flex; flex-direction: column; gap: 1.75rem; margin-top: 1.5rem; }
.review-section-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.review-section-heading {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.review-row {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.5;
}
.review-row:last-child { border-bottom: none; }
.review-label { color: var(--text-muted); font-weight: 400; flex: 0 0 160px; }
.review-value { color: var(--text); font-weight: 400; flex: 1; }
.review-empty { color: var(--text-light); font-style: italic; }
.review-essay {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.review-essay:last-child { border-bottom: none; }
.review-essay-prompt {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.review-essay-text {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 0.5rem;
}
.review-word-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  display: inline-block;
}
.review-word-count.ok    { background: #f0fdf4; color: var(--success); }
.review-word-count.under { background: var(--error-bg); color: var(--error); }
.review-word-count.over  { background: var(--error-bg); color: var(--error); }

/* ---- Applicant code banner ---- */
.applicant-banner {
  background: #134d63;
  padding: 1rem 1.5rem;
}
[data-theme="dark"] .applicant-banner { background: #0d2d3a; }
.applicant-banner-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.applicant-banner-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-shrink: 0;
}
.applicant-banner-label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.applicant-code-display {
  font-family: 'Courier New', monospace;
  font-size: 2.4rem;
  letter-spacing: 0.32em;
  color: #fff;
  background: rgba(255,255,255,0.13);
  padding: 0.25rem 0.9rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  display: inline-block;
}
.applicant-banner-note {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  font-weight: 300;
  line-height: 1.5;
  max-width: 380px;
  margin: 0;
}

/* ---- Fellowship intro bullets ---- */
.fellowship-intro-card {
  border-left: 4px solid var(--blue);
  margin-bottom: 1.25rem;
}
.fellowship-bullets {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.fellowship-bullets li {
  padding-left: 1.4rem;
  position: relative;
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--text);
}
.fellowship-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ---- Save status ---- */
.save-status-wrap { display: flex; align-items: center; }
.save-status { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Applicant code input ---- */
.applicant-code-input {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

/* ---- Confirmation page ---- */
.confirmation-card { text-align: center; padding: 2.5rem 2rem; }
.confirmation-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 6px 24px rgba(87,167,115,.35);
}
.ref-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  margin: 1.1rem 0;
}
.ref-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-muted);
}
.ref-number {
  font-size: 1.5rem;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue-dark);
}
.next-steps { text-align: left; padding-left: 1.2rem; margin: 0.6rem 0; }
.next-steps li { font-size: 0.9rem; font-weight: 300; color: var(--text-muted); margin-bottom: 0.4rem; }

/* ---- Admin / Reviewer nav ---- */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}
.admin-nav-link {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  letter-spacing: 0.01em;
}
.admin-nav-link:hover { background: var(--bg); color: var(--blue); text-decoration: none; }
.admin-nav-logout { color: var(--error); }
.admin-nav-logout:hover { background: var(--error-bg); color: var(--error); }

/* ---- Admin container ---- */
.admin-container { max-width: 1100px; margin: 0 auto; }
.admin-section { margin-bottom: 3rem; }
.admin-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border);
}
.page-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 2rem;
}

/* ---- Filter form ---- */
.filter-form { margin-bottom: 1.25rem; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.filter-input {
  font-family: 'Lato', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-height: 40px;
  -webkit-appearance: none;
  appearance: none;
}
.filter-input:focus { outline: none; border-color: var(--blue); }
.filter-score { width: 110px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.table-count { font-size: 0.82rem; color: var(--text-muted); font-weight: 300; margin-bottom: 0.75rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table th {
  background: var(--bg);
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: #f8fbfd; }
.ref-link { font-family: 'Courier New', monospace; font-size: 0.875rem; color: var(--blue); font-weight: 700; }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; }
.date-cell { white-space: nowrap; color: var(--text-muted); font-size: 0.82rem; font-weight: 300; }
.empty-state { color: var(--text-muted); padding: 3rem; text-align: center; font-size: 0.95rem; font-weight: 300; }

/* ---- Status badges ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status-badge-lg { padding: 0.4rem 1.1rem; font-size: 0.9rem; }
.status-submitted    { background: #eff6ff; color: #1d4ed8; }
.status-under_review { background: #fefce8; color: #92400e; }
.status-accepted     { background: #f0fdf4; color: var(--success); }
.status-waitlisted   { background: #fff7ed; color: #9a3412; }
.status-rejected     { background: #fef2f2; color: #991b1b; }

.flag-badge { color: var(--error); font-size: 0.85rem; font-weight: 700; }
.wildcard-badge { font-size: 0.9rem; }

/* ---- Application detail ---- */
.app-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.app-ref {
  font-size: 1.5rem;
  font-weight: 900;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.04em;
  color: var(--text);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.detail-item { display: flex; flex-direction: column; gap: 0.2rem; }
.detail-label {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}
.detail-value { font-size: 0.95rem; font-weight: 400; color: var(--text); }

.badge-private {
  font-size: 0.68rem;
  font-weight: 700;
  background: #fef9c3;
  color: #713f12;
  padding: 0.12rem 0.55rem;
  border-radius: 100px;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.badge-reviewer {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--accent-bg);
  color: var(--blue-dark);
  padding: 0.12rem 0.55rem;
  border-radius: 100px;
  vertical-align: middle;
}

.essay-block {
  margin-bottom: 2.25rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.essay-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.essay-prompt {
  font-weight: 700;
  color: var(--blue-dark);
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.essay-body {
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text);
}
.word-count-small { margin-top: 0.6rem; font-size: 0.78rem; }
.inline-status-form { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

/* ---- Scores ---- */
.scores-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.6rem;
}
.scores-header .admin-section-title { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.scores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.score-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.score-card-flagged { border-color: var(--error); background: var(--error-bg); }
.score-reviewer { font-weight: 700; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; }
.score-total { font-size: 2.25rem; font-weight: 900; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.score-unit { font-size: 1rem; font-weight: 300; color: var(--text-muted); }
.score-breakdown { display: flex; gap: 0.6rem; font-size: 0.75rem; margin-top: 0.6rem; color: var(--text-muted); font-weight: 700; flex-wrap: wrap; }
.score-flag { font-size: 0.82rem; margin-top: 0.6rem; color: var(--error); font-weight: 400; }
.score-wildcard { font-size: 0.82rem; margin-top: 0.5rem; color: var(--warning); font-weight: 400; }
.avg-score-summary { font-size: 0.9rem; margin-top: 1.25rem; color: var(--text-muted); font-weight: 300; }

/* ---- Reviewer management ---- */
.reviewer-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.reviewer-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}
.reviewer-name { font-weight: 700; font-size: 0.9rem; }
.reviewer-email { flex: 1; font-size: 0.85rem; color: var(--text-muted); font-weight: 300; }
.create-reviewer-form summary { cursor: pointer; display: inline-flex; }
.inline-form { max-width: 420px; margin-top: 1.25rem; }

/* ---- Analytics ---- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.1rem;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-number { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-top: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
.chart-wrap { position: relative; max-height: 320px; }
.chart-wrap-sm { max-width: 460px; }

/* ---- Reviewer queue ---- */
.queue-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  flex-wrap: wrap;
  transition: box-shadow var(--transition);
}
.queue-item:hover { box-shadow: var(--shadow-sm); }
.queue-item-done { opacity: 0.65; }
.queue-ref { font-family: 'Courier New', monospace; font-weight: 700; font-size: 0.95rem; color: var(--blue); }
.queue-date { font-size: 0.8rem; color: var(--text-light); font-weight: 300; margin-left: 0.6rem; }
.score-chip {
  display: inline-flex;
  align-items: center;
  background: var(--blue);
  color: #fff;
  padding: 0.18rem 0.65rem;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 0.6rem;
}

/* ---- Blind review layout ---- */
.review-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .review-layout { grid-template-columns: 1fr 360px; align-items: start; }
}
.review-essays { display: flex; flex-direction: column; }
.review-ref-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.review-ref { font-family: 'Courier New', monospace; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.blind-notice {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-bg);
  color: var(--blue-dark);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  letter-spacing: 0.02em;
}

/* ---- Scoring panel ---- */
.scoring-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: sticky;
  top: 76px;
  box-shadow: var(--shadow);
}
.scoring-title {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.existing-score-notice {
  background: #f0fdf4;
  border-left: 3px solid var(--green);
  padding: 0.7rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  font-weight: 300;
  margin-bottom: 1.5rem;
  color: var(--success);
}
.scoring-form { display: flex; flex-direction: column; gap: 1.5rem; }
.rubric-dimension { display: flex; flex-direction: column; gap: 0.35rem; }
.rubric-header { display: flex; justify-content: space-between; align-items: baseline; }
.rubric-label { font-weight: 700; font-size: 0.88rem; color: var(--text); }
.rubric-weight { font-size: 0.72rem; color: var(--text-muted); font-weight: 700; letter-spacing: 0.04em; }
.rubric-desc { font-size: 0.78rem; color: var(--text-muted); font-weight: 300; line-height: 1.5; }
.score-buttons { display: flex; gap: 0.35rem; margin-top: 0.35rem; }
.score-btn-wrap { flex: 1; }
.score-btn-wrap input[type="radio"] { display: none; }
.score-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 2px solid var(--border-mid);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 900;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  user-select: none;
}
.score-btn-wrap input[type="radio"]:checked + .score-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}
.score-btn:hover { border-color: var(--blue-light); background: #eef6fa; color: var(--blue); }
.score-anchors {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}
.weighted-total-display {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.weighted-total-display strong {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ---- Auth pages ---- */
.auth-page .main-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 180px);
}
.auth-card { padding: 2.5rem; }

/* ---- Dashboard search ---- */
.dash-search-form { margin-bottom: 1.25rem; }
.dash-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.dash-search-input {
  flex: 1;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition);
}
.dash-search-input:focus {
  outline: none;
  border-color: var(--blue);
}

/* ---- Application card list ---- */
.app-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.app-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.app-card-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.app-card-name {
  font-weight: 600;
  font-size: 0.97rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.app-card-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.app-card-email {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.app-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.app-card-ref { font-size: 0.8rem; }
.app-card-score {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue);
}
.app-card-score-unit { font-size: 0.75rem; font-weight: 400; color: var(--text-muted); }
.app-card-time { font-size: 0.8rem; }
.app-card-section {
  font-size: 0.82rem;
  color: var(--blue);
  font-weight: 500;
}

/* ---- Assign form ---- */
.assign-form { max-width: 520px; }
.assign-count-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.assign-all-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  cursor: pointer;
}

/* ---- Reviewer progress cards ---- */
.progress-cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.progress-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.progress-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.progress-card-name {
  display: block;
  font-weight: 600;
  font-size: 1rem;
}
.progress-card-email { font-size: 0.82rem; display: block; }
.progress-fraction {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
}
.progress-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.progress-bar-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.progress-bar-done { background: var(--green); }
.progress-card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.progress-done-label { color: var(--green); font-weight: 600; }
.progress-detail { margin-top: 0.75rem; }
.progress-detail-toggle {
  font-size: 0.82rem;
  color: var(--blue);
  cursor: pointer;
  list-style: none;
}
.progress-detail-list {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.progress-app-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
}
.progress-app-row:hover { background: var(--accent-bg); }
.progress-app-ref { font-family: monospace; color: var(--text-muted); }
.progress-app-status.scored { color: var(--green); font-weight: 500; }
.progress-app-status.unscored { color: var(--text-muted); }

/* ---- Admin nav dropdown ---- */
.admin-nav-dropdown { position: relative; }
.admin-nav-dropdown-toggle { cursor: pointer; user-select: none; }
.admin-nav-dropdown-toggle::after { content: ' ▾'; font-size: 0.7em; }
.admin-nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 200px;
  z-index: 100;
}
.admin-nav-dropdown.open .admin-nav-dropdown-menu { display: block; }
.admin-nav-dropdown-item {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.admin-nav-dropdown-item:hover { background: var(--bg); color: var(--blue); }

/* ---- Admin tabs ---- */
.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.admin-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.admin-tab:hover { color: var(--text); }
.admin-tab-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.admin-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  background: var(--border);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}
.admin-tab-active .admin-tab-count {
  background: var(--blue);
  color: #fff;
}

/* ---- Admin scoring section ---- */
.admin-scoring-section { background: var(--accent-bg); border-radius: var(--radius); }
.admin-scoring-layout { max-width: 600px; }

/* ---- Rankings ---- */
.rankings-header { margin-bottom: 1.5rem; }
.rankings-title { font-size: 1.6rem; margin-bottom: 0.25rem; }
.rankings-table .rank-col { width: 2.5rem; text-align: center; }
.rankings-table .rank-number { font-weight: 700; color: var(--text-muted); }
.rankings-table .score-col { font-size: 1.05rem; }
.row-wildcard { background: rgba(87, 167, 115, 0.07); }
.rankings-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---- Contact note ---- */
.contact-note {
  text-align: center;
  margin: 2rem 0 2rem;
  font-size: 1rem;
  color: var(--text-muted);
}
.contact-note a { color: var(--blue); text-decoration: none; }
.contact-note a:hover { text-decoration: underline; }

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .main-content { padding: 3rem 2rem 6rem; }
  .card { padding: 2.5rem; }
  .scoring-panel { padding: 2rem; }
  .card-title { font-size: 1.9rem; }
}

@media (max-width: 639px) {
  /* Header */
  .header-inner {
    padding: 0.5rem 1rem;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Main content */
  .main-content { padding: 1.25rem 1rem 4rem; }
  .card { padding: 1.25rem; border-radius: var(--radius); }

  /* Admin nav — smaller text, wraps gracefully */
  .admin-nav { gap: 0.1rem; }
  .admin-nav-link { padding: 0.25rem 0.45rem; font-size: 0.78rem; }

  /* Filters */
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-input, .filter-score { width: 100%; }

  /* Form step nav */
  .step-nav { flex-direction: column-reverse; }
  .step-nav .btn { width: 100%; }

  /* Application detail */
  .app-detail-header { flex-direction: column; }

  /* Review section — stack label above value on small screens */
  .review-row { flex-direction: column; gap: 0.2rem; }
  .review-label { flex: none; font-size: 0.72rem; }

  /* Reviewer scoring layout */
  .review-layout { grid-template-columns: 1fr; }
  .scoring-panel { position: static; top: auto; }

  /* Analytics */
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* Applicant banner */
  .applicant-banner-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .applicant-code-display { font-size: 1.9rem; letter-spacing: 0.2em; }

  /* Dashboard cards — stack on very narrow screens */
  .app-card { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .app-card-right {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.5rem;
  }

  /* Progress stepper labels */
  .progress-label { font-size: 0.65rem; letter-spacing: 0.02em; }

  /* Eligibility contact note */
  .contact-note { font-size: 0.95rem; margin: 1.25rem 0 1.5rem; }
}
