@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&display=swap');

:root {
  --primary: #012B59;
  --primary-light: #24618E;
  --primary-dark: #011d3d;
  --primary-bg: #F0F6F9;
  --accent: #68BBB9;
  --accent-light: #C8E6E4;
  --text: #2D3748;
  --text-light: #6b7280;
  --bg: #F4F6FA;
  --white: #ffffff;
  --border: #E3EBF0;
  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;
  --shadow: 0 1px 3px rgba(1,43,89,0.08);
  --shadow-lg: 0 4px 12px rgba(1,43,89,0.12);
  --radius: 8px;
}

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

body {
  font-family: 'Lato', Arial, sans-serif;
  background: #E8F0F5;
  color: var(--text);
  line-height: 1.5;
}

/* Login Screen */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 90%;
}

.login-logo {
  max-width: 240px;
  height: auto;
  margin-bottom: 24px;
}

.login-card p {
  color: var(--text-light);
  margin-bottom: 32px;
  font-size: 16px;
  font-weight: 300;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-btn:hover { background: var(--primary-light); }

/* App Layout */
.app-container { display: none; }
.app-container.active { display: block; }

.app-header {
  background: var(--primary);
  border-bottom: none;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  box-shadow: 0 2px 8px rgba(1,43,89,0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: auto;
}

.app-header h1 {
  color: var(--white);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-email {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
}

.logout-btn {
  padding: 6px 12px;
  background: transparent;
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

.logout-btn:hover { border-color: rgba(255,255,255,0.7); color: var(--white); }

/* Tabs */
.tab-nav {
  display: flex;
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 0 24px;
  box-shadow: 0 1px 3px rgba(1,43,89,0.06);
}

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--accent); font-weight: 700; }

.tab-content { display: none; padding: 24px; max-width: 1200px; margin: 0 auto; }
.tab-content.active { display: block; }

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent-light);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h2 { font-size: 18px; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-align: center;
  border-top: 3px solid var(--accent);
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--primary-bg); color: var(--primary); }
.btn-secondary:hover { background: var(--accent-light); }
.btn-danger { background: #fef2f2; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: #ecfdf5; color: var(--success); }
.btn-success:hover { background: #d1fae5; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* Tables */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-light);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover { background: var(--primary-bg); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-open { background: #ecfdf5; color: var(--success); }
.badge-closed { background: #f3f4f6; color: var(--text-light); }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-filled { background: #dbeafe; color: var(--info); }
.badge-on_hold { background: #fef3c7; color: var(--warning); }
.badge-active { background: #ecfdf5; color: var(--success); }
.badge-rejected { background: #fef2f2; color: var(--danger); }
.badge-withdrawn { background: #f3f4f6; color: var(--text-light); }
.badge-hired { background: #dbeafe; color: var(--info); }

/* Pipeline stages */
.pipeline-stages {
  margin-bottom: 20px;
}

.pipeline-caption {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}

.pipeline-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pipeline-stage {
  flex: 1;
  min-width: 120px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.pipeline-stage:hover { border-color: var(--primary); }
.pipeline-stage.active { border-color: var(--primary); background: var(--primary-bg); }

.pipeline-stage .stage-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.pipeline-stage .stage-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* Star Ratings */
.star-rating {
  display: flex;
  gap: 4px;
  font-size: 24px;
  cursor: pointer;
}

.star-rating .star {
  color: var(--border);
  transition: color 0.2s;
}

.star-rating .star.filled { color: #f59e0b; }
.star-rating .star:hover { color: #fbbf24; }

.rating-display {
  display: flex;
  gap: 2px;
  font-size: 16px;
}

.rating-display .star { color: var(--border); }
.rating-display .star.filled { color: #f59e0b; }

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 18px; }

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 8px;
}

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea { min-height: 80px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Filters */
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--text-light);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Detail Panel */
.detail-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.detail-label { color: var(--text-light); font-size: 14px; }
.detail-value { font-weight: 500; font-size: 14px; }

/* Stage Progress */
.stage-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 16px 0;
}

.stage-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
}

.stage-dot.completed { background: var(--primary); border-color: var(--primary); color: var(--white); }
.stage-dot.current { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.stage-line { flex: 1; height: 2px; background: var(--border); }
.stage-line.completed { background: var(--primary); }

/* Toast */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
.toast-error { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.toast-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Activity Timeline */
.activity-timeline {
  position: relative;
  padding-left: 24px;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.activity-item {
  position: relative;
  padding: 12px 0;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--white);
}

.activity-item .activity-action {
  font-weight: 500;
  font-size: 14px;
}

.activity-item .activity-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Import UI */
.import-section {
  margin-bottom: 24px;
}

.import-slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.import-slot .slot-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.import-slot .slot-label {
  flex: 1;
  font-weight: 500;
}

.import-slot .slot-status {
  font-size: 13px;
  color: var(--text-light);
}

.import-slot .slot-status.done { color: var(--success); }
.import-slot .slot-status.error { color: var(--danger); }

/* Radio group */
.radio-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.radio-option:hover { border-color: var(--primary); }
.radio-option.selected { border-color: var(--primary); background: var(--primary-bg); }

.radio-option input[type="radio"] { display: none; }

/* User role select */
.user-role-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s;
}

.user-role-select:focus { outline: none; border-color: var(--primary); }
.user-role-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* Responsive */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .pipeline-row { flex-direction: column; }
  .tab-nav { overflow-x: auto; }
  .tab-btn { white-space: nowrap; }
  .app-header { padding: 0 16px; }
  .tab-content { padding: 16px; }
}

/* ---- Job stage editor ---- */
.field-hint {
  font-size: 12px;
  color: var(--text-light);
  margin: 2px 0 8px;
  line-height: 1.45;
}

.stage-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.stage-list:empty::after {
  content: "No stages yet — add one below.";
  display: block;
  padding: 14px;
  font-size: 13px;
  color: var(--text-light);
}

.stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.stage-row:last-child { border-bottom: none; }
.stage-row:nth-child(even) { background: var(--primary-bg); }

.stage-row .stage-num {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-row .stage-name {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

/* Flag a stage used more than once, so a repeat reads as deliberate. */
.stage-row .stage-repeat {
  font-size: 11px;
  color: var(--text-light);
  font-style: italic;
}

.stage-row .stage-actions {
  display: flex;
  gap: 2px;
}

.stage-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: var(--primary);
}

.stage-btn:hover:not(:disabled) { background: var(--primary-bg); }
.stage-btn:disabled { opacity: .3; cursor: default; }
.stage-btn.remove { color: #b91c1c; }

.stage-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-add-row select {
  flex: 1;
  min-width: 180px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-light);
  text-decoration: underline;
  padding: 0 4px;
  cursor: pointer;
  font-size: 13px;
}

/* ---- Application flags ---- */
/* A flag is a state the application is in, not a step in the pipeline, so it
   reads as an annotation beside the name rather than as a stage badge. */
.flag-chip {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.btn-flag {
  background: #fff;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.btn-flag:hover { background: #FEF3C7; }

/* ---- Candidate filter bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.filter-bar select,
.filter-bar .filter-search {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--white);
  color: var(--text);
  max-width: 220px;
}

.filter-bar .filter-search {
  flex: 1 1 200px;
  min-width: 160px;
}

.filter-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
  cursor: pointer;
}

.result-count {
  font-size: 13px;
  color: var(--text-light);
}

/* ---- Sortable table headers ---- */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable:hover { color: var(--primary); }

/* Arrow is always in the DOM so the header does not jump width when sorted. */
th.sortable::after {
  content: " \2195";
  opacity: .25;
  font-size: 11px;
}

th.sortable.sorted-asc::after { content: " \2191"; opacity: 1; }
th.sortable.sorted-desc::after { content: " \2193"; opacity: 1; }

/* ---- Candidate slide-over ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 43, 89, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 900;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(560px, 100vw);
  background: var(--white);
  box-shadow: -4px 0 24px rgba(1, 43, 89, .18);
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(100%);
  transition: transform .22s ease;
  z-index: 901;
}

.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.drawer-close {
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-light);
  padding: 0 4px;
}

.drawer-close:hover { color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-overlay { transition: none; }
}

.job-candidate-count {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

/* ---- Home / My Dashboard ---- */
/* Two columns: personal work queues on the left, counters and context on the
   right. Mirrors Greenhouse's My Dashboard, where the home page is a to-do
   list rather than a report. */

.home-greeting {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.home-greeting h2 { font-size: 24px; color: var(--primary); }
.home-greeting span { font-size: 14px; color: var(--text-light); }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.home-main > .card, .home-side > .card { margin-bottom: 20px; }
.home-main > .card:last-child, .home-side > .card:last-child { margin-bottom: 0; }

.link-btn {
  background: none;
  border: none;
  color: var(--primary-light);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { color: var(--primary); text-decoration: underline; }

/* Work queues */
.work-list { padding: 4px 0; }

.work-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.work-list .work-item:last-child { border-bottom: none; }
.work-item.clickable { cursor: pointer; }
.work-item.clickable:hover { background: var(--primary-bg); }

.work-title { font-weight: 700; font-size: 14px; }
.work-meta { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.work-count {
  flex: none;
  min-width: 26px;
  text-align: center;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 13px;
  font-weight: 700;
}

.home-empty {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-light);
}

/* My Tasks counters */
.task-list { padding: 4px 0; }

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.task-list .task-row:last-child { border-bottom: none; }
.task-row.clickable { cursor: pointer; }
.task-row.clickable:hover { background: var(--primary-bg); }

.task-count {
  flex: none;
  color: var(--text-light);
  font-weight: 700;
}

/* A count worth acting on is given weight; zero stays a quiet dash, so the
   panel reads at a glance as "nothing here" rather than "a row of noughts". */
.task-count.has {
  background: var(--accent-light);
  color: var(--primary);
  border-radius: 12px;
  padding: 2px 10px;
}

.home-side .activity-timeline { padding: 16px 20px 16px 28px; }

@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
}

/* ---- Application form editor (job modal) ---- */

.core-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-weight: 400;
  /* Without these the label wraps under its own checkbox when the row is
     tight, which reads as two separate controls. */
  flex: none;
  white-space: nowrap;
}

.check input { cursor: pointer; }

.question-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.question-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--primary-bg);
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.question-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--white);
  border-radius: 10px;
  padding: 1px 9px;
}

.question-row textarea,
.question-row input[type="text"],
.question-row select {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text);
  margin-bottom: 8px;
}

.question-row textarea { resize: vertical; }
.question-label { font-weight: 700; }
.question-options { font-family: inherit; }

.question-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.question-controls select { width: auto; margin-bottom: 0; flex: none; }

.question-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-light);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

/* Required marker on the public application form. */
.req { color: var(--danger); font-weight: 700; }

/* ---- Job board link in the header ---- */
.board-link {
  color: var(--accent-light);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 6px;
  white-space: nowrap;
}

.board-link:hover { color: var(--white); border-color: rgba(255, 255, 255, .6); }

/* ---- Choice questions on the application form ---- */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 0;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.choice input { margin-top: 3px; flex: none; }
.other-input { margin-top: 8px; }

.eeoc-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.eeoc-block h3 {
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 6px;
}

.eeoc-block .field-hint { margin-bottom: 16px; }

/* ---- EEOC report (Admin) ---- */
.eeoc-group {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.eeoc-group h3 { font-size: 15px; color: var(--primary); margin-bottom: 4px; }

.eeoc-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.eeoc-table h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.eeoc-n { font-weight: 400; color: var(--text-light); }

.eeoc-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.eeoc-table td { padding: 4px 0; border-bottom: 1px solid var(--border); }
.eeoc-table td.num { text-align: right; width: 48px; color: var(--text-light); }
.eeoc-table tr:last-child td { border-bottom: none; }

/* A tick box and its words are one control, so they sit on one line. These
   need the extra specificity because `.form-group label` sets display:block
   and `.form-group input` stretches every input to the full width -- between
   them a checkbox ends up centred above its own label. */
.form-group label.check,
.form-group label.choice,
label.check,
label.choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0;
  font-weight: 400;
}

.form-group label.check { align-items: center; }

.form-group .check input[type="checkbox"],
.form-group .choice input[type="checkbox"],
.check input[type="checkbox"],
.choice input[type="checkbox"] {
  width: auto;
  flex: none;
  padding: 0;
  margin: 0;
}

.form-group .choice input[type="checkbox"] { margin-top: 3px; }

/* Stage and criteria names are editable in place. */
.stage-name-input,
.criteria-list .stage-name-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
}

.stage-name-input:hover { border-color: var(--border); background: var(--white); }
.stage-name-input:focus { border-color: var(--primary-light); background: var(--white); outline: none; }

.criteria-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

/* Application answers in the candidate drawer. Long-form text, so it reads as
   prose rather than squeezing into the label/value rows above it. */
.answer-block { margin-bottom: 16px; }
.answer-block:last-child { margin-bottom: 0; }

.answer-question {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.answer-text {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text);
}

.answer-stale {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-light);
}

/* ---- EMAIL WORDING EDITOR ---- */
.template-block {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.template-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.template-head h3 {
  font-size: 15px;
  color: var(--primary);
  margin: 0;
}

/* The applicant-facing message is the only one a stranger reads, so it is
   marked rather than left to look like all the internal ones. */
.template-audience {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-light);
  border: 1px solid var(--border);
}

.template-audience.applicant {
  background: #fff4e5;
  border-color: #f0c27a;
  color: #8a5a00;
}

.template-edited {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}

.template-block textarea {
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}

.template-block code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
}

.template-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* Inline examples in form hints, e.g. the link syntax on a job description. */
.field-hint code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 12px;
}

/* ---- RICH TEXT: TOOLBAR AND RENDERED OUTPUT ---- */
.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg);
}

.rt-spacer { flex: 1 1 auto; }

.rt-btn {
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 6px 9px;
  min-width: 30px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.rt-btn:hover { background: var(--white); border-color: var(--border); }
.rt-btn:active { transform: translateY(1px); }

.rt-preview-toggle { color: var(--primary); font-weight: 500; }

/* The toolbar sits directly on top of the field it belongs to. */
.rt-toolbar + textarea,
.rt-toolbar + textarea:focus {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.rt-preview {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px 14px;
  min-height: 80px;
  background: var(--white);
}

.rt-empty { color: var(--text-light); font-style: italic; }

/* What the renderer emits, wherever it is shown. */
.rich-text p { margin: 0 0 10px; line-height: 1.6; overflow-wrap: anywhere; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul, .rich-text ol { margin: 0 0 10px; padding-left: 22px; }
.rich-text li { margin-bottom: 4px; line-height: 1.6; overflow-wrap: anywhere; }
.rich-text ul:last-child, .rich-text ol:last-child { margin-bottom: 0; }
.rich-text a { color: var(--primary); text-decoration: underline; }
.rich-text a:hover { opacity: 0.8; }
.rich-text strong { font-weight: 600; }

.scorecard-notes { font-size: 13px; color: var(--text-light); }

/* A control that reads as a link but acts as a button, for actions that must
   carry credentials and therefore cannot be a plain href. */
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover { opacity: 0.8; }

/* ---- Resume import (Admin tab) ---- */
.resume-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}
.resume-steps code,
.resume-problem code {
  background: var(--bg, #f5f5f5);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 13px;
}
.resume-pick {
  margin-bottom: 16px;
}
/* The native folder picker renders as "Choose Files", which is both wrong
   (it takes a folder) and not what the steps above tell you to look for. */
.resume-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.resume-pick label.btn {
  display: inline-block;
  cursor: pointer;
}
.resume-summary p {
  margin: 0 0 8px;
  font-size: 15px;
}
.resume-notes {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.7;
}
.resume-problem {
  color: var(--danger, #dc2626);
  font-size: 14px;
  line-height: 1.6;
}
.resume-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--border, #e5e5e5);
  overflow: hidden;
  margin: 16px 0 10px;
}
.resume-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}
.resume-count {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
}
.resume-done {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--success, #16a34a);
}
.resume-failures {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-light);
}
.resume-failures summary {
  cursor: pointer;
}
.resume-failures ul {
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.resume-latest {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
}
.resume-pick label.btn:active {
  transform: translateY(1px);
}
#resume-start:disabled {
  opacity: 0.45;
  cursor: default;
}
.resume-list {
  text-align: left;
  line-height: 1.9;
}
.resume-list .resume-latest {
  margin-left: 6px;
  white-space: nowrap;
}
