/* ===========================================================================
   Candidate Portal — design tokens
   Corporate palette: deep navy structure, one confident blue for action,
   green/amber only ever used to carry status meaning.
   ========================================================================= */

:root {
  --navy-900: #0a1f35;
  --navy-800: #0f2d49;
  --navy-700: #16405f;

  --brand-700: #14497c;
  --brand-600: #1a5f9e;
  --brand-500: #2276bd;
  --brand-050: #eef4fb;

  --bg:            #f1f4f8;
  --surface:       #ffffff;
  --surface-sunk:  #f7f9fc;
  --line:          #dde5ee;
  --line-strong:   #c4d0de;

  --text:       #0f2233;
  --text-soft:  #4c5f73;
  --text-muted: #7d8d9e;
  --text-invert:#eaf1f8;

  --done-fg: #0d6b45;
  --done-bg: #e4f5ed;
  --done-bd: #b3ddc8;

  --wait-fg: #8a5600;
  --wait-bg: #fdf3e1;
  --wait-bd: #f0dcae;

  --err-fg: #a1231b;
  --err-bg: #fdeceb;
  --err-bd: #f3c7c4;

  /* Work in progress at our end — a state the candidate cannot act on. */
  --prog-fg: #14497c;
  --prog-bg: #eef4fb;
  --prog-bd: #bcd4ea;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15, 34, 51, .06);
  --shadow:    0 2px 6px rgba(15, 34, 51, .07), 0 12px 28px -18px rgba(15, 34, 51, .35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.011em; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
p  { margin: 0; }
a  { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ layout */

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }
.wrap--wide { max-width: 1240px; }

.stack   { display: grid; gap: 18px; }
.stack-s { display: grid; gap: 10px; }

/* ----------------------------------------------------------------- top bar */

.topbar {
  background: var(--navy-900);
  color: var(--text-invert);
  border-bottom: 3px solid var(--brand-600);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 62px; flex-wrap: wrap; padding-block: 10px;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--brand-500), var(--brand-700));
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.brand__name { font-weight: 650; font-size: 1rem; line-height: 1.2; }
.brand__sub  { font-size: .75rem; color: #9fb6cc; line-height: 1.2; }

.topbar__user { display: flex; align-items: center; gap: 14px; }
.topbar__id   { text-align: right; line-height: 1.25; }
.topbar__name { font-weight: 600; font-size: .875rem; }
.topbar__org  { font-size: .75rem; color: #9fb6cc; }

/* ------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.card__body { padding: 22px; }
.card__body--flush { padding: 0; }
.card__title { font-size: 1rem; }
.card__hint  { font-size: .8125rem; color: var(--text-muted); margin-top: 2px; }

/* ------------------------------------------------------------ page heading */

.page-head { padding: 30px 0 22px; }
.page-head h1 { font-size: 1.6rem; }
.page-head p  { color: var(--text-soft); margin-top: 6px; }
.eyebrow {
  font-size: .6875rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--brand-600); margin-bottom: 6px;
}

/* -------------------------------------------------------------- status pill */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px 3px 9px;
  border-radius: 999px;
  font-size: .75rem; font-weight: 650; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--done { color: var(--done-fg); background: var(--done-bg); border-color: var(--done-bd); }
.pill--wait { color: var(--wait-fg); background: var(--wait-bg); border-color: var(--wait-bd); }
.pill--err  { color: var(--err-fg);  background: var(--err-bg);  border-color: var(--err-bd); }
.pill--mute { color: var(--text-soft); background: var(--surface-sunk); border-color: var(--line-strong); }
.pill--progress { color: var(--prog-fg); background: var(--prog-bg); border-color: var(--prog-bd); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  font-size: .75rem; font-weight: 600; color: #dbe8f5;
}

/* ---------------------------------------------------------------- progress */

.progress { display: grid; gap: 8px; }
.progress__meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .8125rem; color: var(--text-soft);
}
.progress__count { font-weight: 650; color: var(--text); }
.progress__track { display: flex; gap: 4px; }
.progress__seg {
  height: 6px; flex: 1; border-radius: 3px;
  background: var(--line-strong);
}
.progress__seg.is-done { background: linear-gradient(90deg, #17805a, #21a06f); }

.bar { height: 8px; border-radius: 4px; background: var(--line-strong); overflow: hidden; }
.bar__fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-500));
  transition: width .2s ease;
}

/* ------------------------------------------------------------- stage groups */

.stage + .stage { border-top: 1px solid var(--line); }

.stage__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 22px;
  background: var(--surface-sunk);
  list-style: none; cursor: pointer;
  transition: background .12s ease;
}
.stage__head::-webkit-details-marker { display: none; }
.stage__head:hover { background: #eaeff6; }

.stage__head--static { cursor: default; border-bottom: 1px solid var(--line); }
.stage__head--static:hover { background: var(--surface-sunk); }

.stage__title {
  display: flex; align-items: center; gap: 9px;
  font-size: .9375rem; font-weight: 650; color: var(--text);
}
.stage__right { display: flex; align-items: center; gap: 10px; }

.stage__chev {
  display: inline-block; color: var(--text-muted); font-size: .6875rem;
  transition: transform .15s ease;
}
details.stage[open] > .stage__head .stage__chev { transform: rotate(90deg); }
details.stage[open] > .timeline { border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }

.step { position: relative; display: flex; gap: 16px; padding: 20px 22px; }
.step + .step { border-top: 1px solid var(--line); }

.step__rail { position: relative; flex: none; width: 30px; display: flex; justify-content: center; }
.step:not(:last-child) .step__rail::after {
  content: ""; position: absolute; top: 34px; bottom: -40px; left: 50%;
  width: 2px; margin-left: -1px; background: var(--line-strong);
}
.step--done:not(:last-child) .step__rail::after { background: var(--done-bd); }

.step__marker {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: .8125rem; font-weight: 700;
  border: 2px solid;
}
.step--done .step__marker { color: var(--done-fg); background: var(--done-bg); border-color: var(--done-bd); }
.step--wait .step__marker { color: var(--wait-fg); background: var(--wait-bg); border-color: var(--wait-bd); }
.step--progress .step__marker { color: var(--prog-fg); background: var(--prog-bg); border-color: var(--prog-bd); }

/* Sits inline ahead of the summary text of a step being processed at our end. */
.spinner {
  display: inline-block; vertical-align: -2px;
  width: 12px; height: 12px; margin-right: 7px;
  border: 2px solid var(--prog-bd); border-top-color: var(--prog-fg);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.step__content { flex: 1; min-width: 0; }
.step__header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 3px;
}
.step__title { font-size: .9375rem; font-weight: 650; }
.step__summary { color: var(--text-soft); font-size: .875rem; }
.step__note {
  margin-top: 10px; padding: 10px 12px;
  background: var(--wait-bg); border: 1px solid var(--wait-bd);
  border-radius: var(--radius-sm);
  font-size: .8125rem; color: #6f4703; line-height: 1.5;
}
.step__meta { margin-top: 6px; font-size: .75rem; color: var(--text-muted); }

/* -------------------------------------------------------------- key entry */

.keyform { margin-top: 14px; padding: 16px; background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--radius); }
.keyform__row { display: flex; gap: 10px; flex-wrap: wrap; }
.keyform__row .field { flex: 1 1 260px; margin: 0; }
.keyform__row .field--action { flex: 0 0 auto; display: flex; align-items: flex-end; }
.keyform__hint { margin-top: 9px; font-size: .75rem; color: var(--text-muted); }
.keyform__hint code { font-family: var(--mono); font-size: .75rem; background: #fff; border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; color: var(--text-soft); }

.keyvalue {
  display: inline-block; margin-top: 8px; padding: 5px 11px;
  font-family: var(--mono); font-size: .8125rem; letter-spacing: .01em;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-soft); word-break: break-all;
}

/* ------------------------------------------------------------------ forms */

.field { margin-bottom: 16px; }
.field__label { display: block; font-size: .8125rem; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field__hint  { font-size: .75rem; color: var(--text-muted); margin-top: 6px; }

.input, .select, textarea.input {
  width: 100%; padding: 10px 12px;
  font: inherit; font-size: .9375rem; color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder { color: #a8b5c2; }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(34, 118, 189, .16);
}
.input--mono { font-family: var(--mono); letter-spacing: .02em; }
.input--error { border-color: #d98b85; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; font-family: var(--mono); font-size: .8125rem; }

.file {
  display: block; padding: 22px; text-align: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-sunk); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.file:hover { border-color: var(--brand-500); background: var(--brand-050); }
.file input { display: block; margin: 10px auto 0; font-size: .8125rem; }
.file__title { font-weight: 600; font-size: .9375rem; }
.file__hint  { font-size: .8125rem; color: var(--text-muted); margin-top: 3px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  font: inherit; font-size: .875rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--brand-600); color: #fff; }
.btn--primary:hover { background: var(--brand-700); }
.btn--ghost { background: #fff; color: var(--text-soft); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--brand-500); color: var(--brand-600); }
.btn--danger { background: #fff; color: var(--err-fg); border-color: var(--err-bd); }
.btn--danger:hover { background: var(--err-bg); }
.btn--sm { padding: 6px 12px; font-size: .8125rem; }
.btn--block { width: 100%; }
.btn--link { background: none; border: none; color: var(--brand-600); padding: 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

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

/* ----------------------------------------------------------------- alerts */

.alert {
  display: flex; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid; font-size: .875rem; line-height: 1.5;
}
.alert--ok    { color: var(--done-fg); background: var(--done-bg); border-color: var(--done-bd); }
.alert--error { color: var(--err-fg);  background: var(--err-bg);  border-color: var(--err-bd); }
.alert--warn  { color: var(--wait-fg); background: var(--wait-bg); border-color: var(--wait-bd); }
.alert--info  { color: var(--brand-700); background: var(--brand-050); border-color: #c5daf0; }
.alert strong { font-weight: 650; }

/* ------------------------------------------------------------------ table */

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left; font-size: .6875rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted);
  padding: 11px 16px; background: var(--surface-sunk);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafcfe; }
.table__strong { font-weight: 600; }
.table__sub { font-size: .75rem; color: var(--text-muted); }
.table__num { font-variant-numeric: tabular-nums; }
.table--fixed td { vertical-align: top; }

.empty { padding: 44px 22px; text-align: center; color: var(--text-muted); }
.empty__title { font-weight: 600; color: var(--text-soft); margin-bottom: 4px; }

/* ------------------------------------------------------------------- auth */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth__aside {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--brand-700) 140%);
  color: var(--text-invert);
  padding: 48px 56px;
  /* brand pinned top, lede centred in the space between, foot (admin only) at the bottom */
  display: grid; grid-template-rows: auto 1fr auto;
}
.auth__aside::after {
  content: ""; position: absolute; right: -140px; bottom: -180px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.10), transparent 62%);
}
.auth__lede { position: relative; align-self: center; max-width: 30ch; }
.auth__lede h2 { color: #fff; font-size: 1.6rem; line-height: 1.28; }
.auth__lede p  { color: #a9c1d8; margin-top: 12px; font-size: .9375rem; }
.auth__points { position: relative; list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 11px; }
.auth__points li { display: flex; gap: 10px; font-size: .875rem; color: #c3d6e8; }
.auth__points span {
  flex: none; display: grid; place-items: center;
  width: 19px; height: 19px; margin-top: 1px; border-radius: 50%;
  background: rgba(255,255,255,.12); font-size: .6875rem; line-height: 1; color: #dbe8f5;
}
.auth__foot { position: relative; font-size: .75rem; color: #7f97ae; }

.auth__main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth__form { width: 100%; max-width: 388px; }
.auth__form h1 { font-size: 1.375rem; }
.auth__form > p { color: var(--text-soft); font-size: .875rem; margin-top: 6px; margin-bottom: 24px; }
.auth__alt { margin-top: 20px; font-size: .8125rem; color: var(--text-muted); text-align: center; }

/* --------------------------------------------------------- admin chrome */

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.side {
  background: var(--navy-900); color: var(--text-invert);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; border-bottom: 1px solid rgba(255,255,255,.09); }
.side__group { display: grid; gap: 2px; }
.side__label {
  font-size: .625rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #6d879f; padding: 0 8px 7px;
}
.side__link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: #c0d2e3; font-size: .875rem; font-weight: 500; text-decoration: none;
}
.side__link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.side__link.is-active { background: var(--brand-600); color: #fff; font-weight: 600; }
.side__foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.09); font-size: .75rem; color: #86a0b8; }

.main { background: var(--bg); min-width: 0; }
.main__head {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 20px 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.main__body { padding: 26px 30px 56px; }

/* ------------------------------------------------------------------ stats */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat__label { font-size: .6875rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.stat__value { font-size: 1.75rem; font-weight: 680; letter-spacing: -.02em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.stat__foot  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.stat--done .stat__value { color: var(--done-fg); }
.stat--wait .stat__value { color: var(--wait-fg); }

/* ----------------------------------------------------------------- filters */

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; }
.filters .field__label { margin-bottom: 4px; }
.filters .input, .filters .select { min-width: 168px; }
.filters .input--date { min-width: 140px; }

.tickrow { display: flex; align-items: center; gap: 7px; font-size: .8125rem; }
.tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: .625rem; font-weight: 700; }
.tick--done { color: var(--done-fg); background: var(--done-bg); border: 1px solid var(--done-bd); }
.tick--wait { color: var(--wait-fg); background: var(--wait-bg); border: 1px solid var(--wait-bd); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px 22px; }
.meta__label { font-size: .6875rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.meta__value { margin-top: 3px; font-size: .9375rem; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--text-muted); }

/* ---------------------------------------------------------------- utility */

.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }
.small { font-size: .8125rem; }
.tiny  { font-size: .75rem; }
.mono  { font-family: var(--mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 20px 0; }

.footer { padding: 26px 0 40px; text-align: center; font-size: .75rem; color: var(--text-muted); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { padding: 30px 26px; }
  .auth__aside::after { display: none; }
  .auth__points { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; align-items: center; gap: 12px; overflow-x: auto; padding: 12px 14px; }
  .side__brand { border: 0; padding: 0 10px 0 0; }
  .side__label, .side__foot { display: none; }
  .side__group { display: flex; gap: 4px; }
  .side__link { white-space: nowrap; }
  .main__head, .main__body { padding-inline: 18px; }
}

@media (max-width: 560px) {
  .topbar__inner { min-height: 0; }
  .topbar__id { text-align: left; }
  .step { padding: 16px 15px; gap: 12px; }
  .card__head, .card__body { padding: 16px; }
  .page-head { padding: 22px 0 16px; }
  .page-head h1 { font-size: 1.3rem; }
}
