:root {
  --bg: #0b0c10;
  --panel: #14161d;
  --panel-2: #1b1e27;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e7e9ee;
  --muted: #8b90a0;
  --accent: #6d6af6;
  --accent-2: #8a87fb;
  --green: #36d399;
  --amber: #fbbf24;
  --red: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(20, 22, 29, 0.7);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1rem; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.topbar-hint { color: var(--muted); font-size: 0.82rem; }

/* Layout */
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 60px); }
.sidebar { border-right: 1px solid var(--border); padding: 18px 14px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sidebar-head h2 { font-size: 0.95rem; margin: 0; }
.workspace { padding: 22px; max-width: 920px; }

/* Sidebar search */
.sidebar-search {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 8px 11px;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
}
.sidebar-search:focus { border-color: rgba(109,106,246,.5); }
.sidebar-search::placeholder { color: var(--muted); opacity: .7; }

/* Candidate filter toolbar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.filter-search {
  flex: 1 1 220px;
  min-width: 160px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
}
.filter-search:focus { border-color: rgba(109,106,246,.5); }
.filter-search::placeholder { color: var(--muted); opacity: .7; }
.filter-select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}
.filter-select:focus { border-color: rgba(109,106,246,.5); }
.filters .btn { padding: 8px 14px; }

/* Job list */
.job-list { display: flex; flex-direction: column; gap: 6px; }
.job-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--panel);
  transition: border-color .15s, background .15s;
}
.job-item:hover { border-color: rgba(109,106,246,.5); }
.job-item.active { border-color: var(--accent); background: var(--panel-2); }
.job-item .ji-title { font-weight: 600; font-size: 0.86rem; }
.job-item .ji-meta { color: var(--muted); font-size: 0.72rem; margin-top: 3px; }

/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 1.1rem; }

label { display: block; font-size: 0.78rem; color: var(--muted); margin: 10px 0 6px; }
input[type=text], input[type=password], input[type=email], textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  resize: vertical;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, textarea:focus {
  border-color: rgba(109,106,246,.55);
}

/* Keep Chrome/Safari autofill on the dark theme (no white box). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--panel-2) inset;
  box-shadow: 0 0 0 1000px var(--panel-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

/* Buttons */
.btn {
  border: none; border-radius: 10px; cursor: pointer;
  font-weight: 600; font-size: 0.85rem; padding: 9px 16px;
  font-family: inherit; transition: filter .15s, background .15s;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }
.row-end { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.file-btn { display: inline-flex; align-items: center; }

/* Empty */
.empty { text-align: center; color: var(--muted); margin-top: 80px; }
.empty-icon { font-size: 46px; margin-bottom: 12px; }

/* Job header */
.job-header { display: flex; align-items: flex-start; justify-content: space-between; }
.job-header h2 { margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 0.82rem; margin: 0; }
.jd-box {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  white-space: pre-wrap;
  font-size: 0.82rem;
  color: #c8ccd8;
  max-height: 320px;
  overflow-y: auto;
  margin: -6px 0 16px;
}

/* Upload */
.upload-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.upload-row h3 { margin: 0 0 4px; font-size: 0.98rem; }
.upload-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Batch progress bar */
.batch-progress { margin-top: 14px; }
.bp-bar {
  height: 8px; border-radius: 6px; overflow: hidden;
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
}
.bp-fill {
  height: 100%; width: 2%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 6px; transition: width .3s ease;
}
.bp-text { margin-top: 7px; font-size: 0.78rem; }

/* Pending / error candidate cards */
.cand-pending { opacity: 0.85; }
.cand-pending .cand-top { cursor: default; }
.cand-error .cand-top { cursor: default; }
.cand-error { border-color: rgba(248,113,113,.35); }
.upload-status {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  font-size: 0.84rem;
}
.upload-status.loading { background: rgba(109,106,246,.12); color: var(--accent-2); border: 1px solid rgba(109,106,246,.3); }
.upload-status.error { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.3); }

/* Results */
.results-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px; }
.results-head h3 { margin: 0; font-size: 1rem; }
.pill { background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; padding: 1px 9px; font-size: 0.74rem; color: var(--muted); }

.candidate-list { display: flex; flex-direction: column; gap: 12px; }
.cand {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}
.cand.rec { border-color: rgba(54,211,153,.45); }
.cand-top { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.score-badge {
  width: 52px; height: 52px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem; flex-shrink: 0;
}
.cand-main { flex: 1; min-width: 0; }
.cand-name { font-weight: 700; font-size: 0.95rem; }
.cand-file { color: var(--muted); font-size: 0.74rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-summary { font-size: 0.82rem; color: #c2c6d2; margin-top: 6px; line-height: 1.5; }
.verdict {
  font-size: 0.7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 9px; border-radius: 20px; flex-shrink: 0;
}
.v-shortlist { background: rgba(54,211,153,.18); color: var(--green); }
.v-maybe { background: rgba(251,191,36,.16); color: var(--amber); }
.v-reject { background: rgba(248,113,113,.16); color: var(--red); }

.cand-detail { padding: 0 16px 16px; display: none; border-top: 1px solid var(--border); }
.cand.open .cand-detail { display: block; padding-top: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-block h4 { margin: 0 0 6px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.detail-block ul { margin: 0; padding-left: 16px; }
.detail-block li { font-size: 0.8rem; margin-bottom: 4px; line-height: 1.4; }
.li-good::marker { color: var(--green); }
.li-bad::marker { color: var(--red); }
.li-flag::marker { color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px; font-size: 0.74rem; color: #c2c6d2; }
.cand-actions { margin-top: 14px; display: flex; justify-content: flex-end; }
.link-danger { background: none; border: none; color: var(--red); font-size: 0.78rem; cursor: pointer; }

.hidden { display: none !important; }

/* Topbar right */
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Segmented control (recruiter / student) */
.seg {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin: 14px 0 4px;
}
.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.seg-sm { margin: 0; padding: 2px; }
.seg-sm .seg-btn { padding: 6px 12px; font-size: 0.78rem; }

/* Student workspace */
.student-main { padding: 24px 20px; }
.student-wrap { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; }
.student-cv-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
.st-score-head { display: flex; align-items: center; gap: 16px; }
.st-qlist { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 4px; }
.st-q-label { font-size: 0.84rem; color: var(--text); margin-bottom: 6px; }
.st-q-input { width: 100%; }
.prep-item { font-size: 0.85rem; color: var(--text); padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); line-height: 1.5; }
.prep-hint { font-size: 0.8rem; margin-top: 2px; }

/* Login overlay */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 8, 12, 0.96);
  backdrop-filter: blur(8px);
}
.login-card {
  width: 360px; max-width: 90vw;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 24px;
}
.login-brand { font-size: 1rem; margin-bottom: 6px; }
.login-error {
  margin-top: 12px; padding: 9px 12px; border-radius: 9px;
  background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.3);
  color: var(--red); font-size: 0.82rem;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 8, 12, 0.7); backdrop-filter: blur(6px);
}
.modal {
  width: 680px; max-width: 94vw; max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; }

.add-user-row { display: grid; grid-template-columns: 1fr 1fr 110px 90px 70px; gap: 8px; margin-bottom: 16px; }
.add-user-row input, .add-user-row select {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); padding: 9px 11px; font-size: 0.84rem; font-family: inherit;
}

.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: grid; grid-template-columns: 1fr 1fr 110px 90px 60px 60px; gap: 8px; align-items: center; }
.user-row input, .user-row select {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); padding: 8px 10px; font-size: 0.82rem; font-family: inherit;
}
.user-row .u-save { padding: 7px 10px; font-size: 0.78rem; }
.user-row .link-danger { font-size: 0.78rem; }

@media (max-width: 620px) {
  .add-user-row, .user-row { grid-template-columns: 1fr 1fr; }
}

/* Dashboard */
.modal-wide { width: 820px; }
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.dstat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.dstat-num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.dstat-label { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

.dash-subhead { font-size: 0.92rem; margin: 6px 0 12px; }
.dash-jobs { display: flex; flex-direction: column; gap: 4px; }
.djob-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1.1fr 0.8fr;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.82rem;
}
.djob-row:not(.djob-head):hover { background: rgba(255,255,255,.03); }
.djob-head { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); border-radius: 0; }
.djob-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.djob-cell { color: var(--muted); }
.djob-rate { text-align: right; font-weight: 700; color: var(--text); }

@media (max-width: 720px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .djob-row { grid-template-columns: 1.6fr 1fr 1fr; }
  .djob-row .djob-cell:nth-child(4), .djob-row .djob-rate { display: none; }
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); }
  .detail-grid { grid-template-columns: 1fr; }
}
