:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --text: #122033;
  --muted: #64748b;
  --line: #dbe4ef;
  --teal: #2946f3;
  --teal-quiet: #eff4ff;
  --blue: #102a9f;
  --blue-quiet: #eaf1ff;
  --amber: #b45309;
  --amber-quiet: #fff7e6;
  --rose: #be123c;
  --rose-quiet: #fff1f2;
  --shadow: 0 16px 38px rgba(16, 42, 67, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body.auth-page {
  min-height: 100dvh;
  background: #f3f7fb;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.auth-page .topbar {
  position: fixed;
  right: 0;
  left: 0;
  justify-content: center;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.auth-page .topnav {
  display: none;
}

.auth-page .brand {
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text);
}

.brand-logo {
  width: 150px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.role-switch {
  display: inline-grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 4px;
  min-width: 112px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

.role-switch a {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.role-switch a.active {
  background: #ffffff;
  color: var(--teal);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.topbar-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.topbar-actions .logout-form {
  display: flex;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 2vw, 24px);
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  white-space: nowrap;
}

.site-nav a.active {
  color: var(--blue);
}

.site-nav a.active::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
  content: "";
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 42px) 48px;
}

.page-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 42px) 48px;
}

.auth-page .page-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 120px 18px 42px;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.message {
  border: 1px solid #c7d7ff;
  border-radius: var(--radius);
  background: var(--blue-quiet);
  color: var(--blue);
  padding: 11px 13px;
  font-size: 14px;
  font-weight: 800;
}

.message.error {
  border-color: #fecdd3;
  background: var(--rose-quiet);
  color: var(--rose);
}

.message.success {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.auth-page .messages {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 30;
  width: min(440px, calc(100% - 32px));
  transform: translateX(-50%);
}

.auth-page .panel.narrow {
  width: min(440px, 100%);
  padding: 32px;
  border-color: rgba(219, 228, 239, 0.9);
  box-shadow: 0 28px 70px rgba(16, 42, 67, 0.16);
}

.auth-page .panel.narrow h1 {
  margin: 0 0 20px;
  font-size: 34px;
  line-height: 1.05;
}

.auth-page .footer {
  display: none;
}

.logout-form {
  margin: 0;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
}

.login-brand {
  margin-bottom: 24px;
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: 32px;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

.form-error {
  margin: 0;
  border: 1px solid #fecdd3;
  border-radius: var(--radius);
  background: var(--rose-quiet);
  color: var(--rose);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 800;
}

.subtle-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.page-heading h1,
.panel h2,
.weight-panel h3,
.question-builder h3 {
  margin: 0;
  letter-spacing: 0;
}

.page-heading h1 {
  max-width: 780px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toolbar,
.table-controls,
.form-actions,
.wizard-actions,
.question-builder-header,
.weight-header,
.dialog-header,
.panel-header.split {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar,
.panel-header.split {
  justify-content: space-between;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--teal);
  background: var(--teal);
  color: #fff;
  padding: 0 16px;
  box-shadow: 0 10px 18px rgba(41, 70, 243, 0.18);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 14px;
}

.icon-button {
  width: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.login-actions {
  display: grid;
  gap: 10px;
}

.login-actions .primary-button,
.login-actions .ghost-button {
  width: 100%;
  text-decoration: none;
}

.reset-code-input {
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.otp-timer {
  margin: -2px 0 0;
  color: var(--rose);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 126px;
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: clamp(25px, 4vw, 40px);
  line-height: 1;
}

.metric-card.accent {
  border-color: #c7d7ff;
  background: linear-gradient(180deg, #ffffff, var(--teal-quiet));
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 22px;
}

.funnel-chart {
  display: grid;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 150px 1fr 58px;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.funnel-row span {
  color: var(--muted);
  font-weight: 700;
}

.funnel-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.funnel-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 400ms ease;
}

.skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--blue-quiet);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.chip.teal {
  background: var(--teal-quiet);
  color: var(--teal);
}

.chip.amber {
  background: var(--amber-quiet);
  color: var(--amber);
}

.chip.rose {
  background: var(--rose-quiet);
  color: var(--rose);
}

.job-performance {
  display: grid;
  gap: 12px;
}

.job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.job-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.job-row strong,
.candidate-job-card strong {
  display: block;
}

.job-row span,
.candidate-job-card span,
.score-breakdown span,
.review-box span {
  color: var(--muted);
  font-size: 13px;
}

.table-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-controls input,
.table-controls select {
  width: min(190px, 100%);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.table-actions .ghost-button {
  min-height: 34px;
  padding: 0 11px;
  text-decoration: none;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pagination-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 900;
}

.pagination-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 68, 246, 0.2);
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.score-pill {
  display: inline-grid;
  min-width: 58px;
  min-height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--teal-quiet);
  color: var(--teal);
  font-weight: 900;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger-button {
  min-height: 40px;
  border: 1px solid #fecdd3;
  border-radius: var(--radius);
  background: var(--rose-quiet);
  color: var(--rose);
  padding: 0 14px;
  font-weight: 900;
}

.danger-button:hover {
  border-color: var(--rose);
  background: #ffe4e6;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.underqualified {
  background: var(--rose-quiet);
  color: var(--rose);
}

.status-pill.qualified {
  background: var(--blue-quiet);
  color: var(--blue);
}

.status-pill.highly-qualified {
  background: var(--teal-quiet);
  color: var(--teal);
}

.status-pill.overqualified {
  background: var(--amber-quiet);
  color: var(--amber);
}

.job-builder {
  margin-top: 18px;
}

.job-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8ea2ff;
  box-shadow: 0 0 0 4px rgba(41, 70, 243, 0.14);
}

.weight-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fbfdff;
}

.weight-header {
  justify-content: space-between;
  margin-bottom: 12px;
}

.weight-header span {
  color: var(--teal);
  font-weight: 900;
}

.weight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.weight-grid input {
  min-height: auto;
  padding: 0;
  accent-color: var(--teal);
}

.weight-grid output {
  color: var(--muted);
}

.question-builder {
  display: grid;
  gap: 10px;
}

.question-builder-header {
  justify-content: space-between;
}

.question-rows,
.application-questions {
  display: grid;
  gap: 10px;
}

.question-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 10px;
  align-items: start;
}

.question-row textarea {
  min-height: 58px;
}

.form-actions {
  justify-content: flex-end;
}

.form-actions p,
.wizard-actions p {
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-message {
  min-height: 0;
}

.status-message:not(:empty) {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
}

.status-error:not(:empty) {
  border-color: #fecdd3;
  background: var(--rose-quiet);
  color: var(--rose);
}

.status-loading:not(:empty),
.status-success:not(:empty) {
  border-color: #c7d7ff;
  background: var(--teal-quiet);
  color: var(--teal);
}

.wizard-actions .status-message:not(:empty) {
  flex: 1 1 220px;
}

.candidate-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.candidate-portal-heading h1 {
  max-width: 100%;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 0.98;
}

.application-section-heading {
  margin: -2px 0 -6px;
}

.application-section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
  letter-spacing: 0;
}

.candidate-job-cards {
  display: grid;
  gap: 10px;
}

.candidate-job-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.8fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 13px;
  text-align: left;
}

.candidate-job-card.active {
  border-color: #8ea2ff;
  background: var(--teal-quiet);
}

.candidate-job-card p {
  margin: 8px 0 10px;
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.candidate-job-main {
  min-width: 0;
}

.apply-button {
  min-width: 96px;
}

.application-panel-status {
  margin: 0 0 14px;
  color: var(--blue);
  font-weight: 900;
}

.position-display {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid #c7d7ff;
  border-radius: var(--radius);
  background: var(--blue-quiet);
  padding: 12px 14px;
}

.position-display span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.position-display strong {
  font-size: 18px;
  line-height: 1.2;
}

.position-display small {
  color: var(--muted);
  font-weight: 700;
}

.application-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.step {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.step.active,
.step.complete {
  border-color: #8ea2ff;
  background: var(--teal-quiet);
  color: var(--teal);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
  margin-bottom: 18px;
}

.progress-track span {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 240ms ease;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.upload-zone {
  min-height: 255px;
  place-items: center;
  border: 2px dashed #9aa9ff;
  border-radius: var(--radius);
  background: #fbfefd;
  color: var(--text);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.upload-zone.dragging {
  border-color: var(--teal);
  background: var(--teal-quiet);
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-zone strong {
  margin-top: 64px;
  font-size: 22px;
}

.upload-zone span {
  color: var(--muted);
}

.application-question {
  display: grid;
  gap: 8px;
}

.application-question header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.application-question textarea {
  min-height: 134px;
}

.review-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.review-item {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfdff;
}

.review-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.wizard-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

.confirmation {
  margin-top: 18px;
  border: 1px solid #c7d7ff;
  border-radius: var(--radius);
  background: var(--teal-quiet);
  padding: 16px;
}

.confirmation h3 {
  margin: 0 0 10px;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.score-breakdown div {
  border: 1px solid rgba(41, 70, 243, 0.16);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.score-breakdown strong {
  display: block;
  font-size: 22px;
}

dialog {
  width: min(920px, calc(100% - 28px));
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-header {
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

#dialogContent {
  padding: 18px;
  overflow: auto;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.report-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #fff;
}

.report-section h3 {
  margin: 0 0 10px;
}

.report-section ul {
  margin: 0;
  padding-left: 18px;
}

.empty-state {
  min-height: 140px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .metric-grid,
  .admin-grid,
  .candidate-layout,
  .form-grid,
  .form-grid.two,
  .weight-grid,
  .review-box,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .candidate-layout {
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .topbar,
  .page-heading,
  .toolbar,
  .panel-header.split,
  .question-builder-header,
  .form-actions,
  .wizard-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .role-switch {
    width: 100%;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 16px;
  }

  .brand-logo {
    width: 118px;
    height: 36px;
  }

  .brand strong {
    font-size: 15px;
  }

  .metric-grid,
  .admin-grid,
  .candidate-layout,
  .form-grid,
  .form-grid.two,
  .weight-grid,
  .review-box,
  .score-breakdown,
  .report-grid,
  .job-row,
  .candidate-job-card,
  .question-row {
    grid-template-columns: 1fr;
  }

  .job-actions {
    justify-content: stretch;
  }

  .job-actions button {
    flex: 1 1 120px;
  }

  .apply-button {
    width: 100%;
  }

  .table-controls,
  .toolbar {
    width: 100%;
  }

  .table-controls input,
  .table-controls select,
  .toolbar button,
  .logout-form,
  .wizard-actions .status-message,
  .form-actions button,
  .wizard-actions button {
    width: 100%;
  }

  .application-progress {
    grid-template-columns: 1fr 1fr;
  }

  .upload-zone strong {
    margin-top: 42px;
    font-size: 19px;
  }
}
