/* Assessment Portal - hand-written design system.
   Custom properties + clean cards. No framework. */

:root {
  --brand:        #1d6f99;
  --brand-600:    #165d83;
  --brand-700:    #114a68;
  --brand-ink:    #0d3a4f;

  --bg:           #eef2f6;
  --surface:      #ffffff;
  --surface-2:    #f6f8fb;

  --text:         #1f2933;
  --text-muted:   #5b6876;
  --border:       #dde3ea;

  --ok:           #1f9d57;
  --ok-bg:        #e7f6ee;
  --warn:         #b8730a;
  --warn-bg:      #fbefdc;
  --bad:          #cf3a3a;
  --bad-bg:       #fbe9e9;
  --locked:       #8b97a4;
  --locked-bg:    #eef1f4;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 1px 2px rgba(16,24,40,.06), 0 4px 12px rgba(16,24,40,.06);
  --shadow-lg:    0 12px 34px rgba(16,24,40,.14);
  --ring:         0 0 0 3px rgba(22,93,131,.30);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-600); }

h1 { font-size: 1.7rem; margin: 0 0 .35rem; color: var(--brand-ink); }
h2 { font-size: 1.2rem; margin: 0; color: var(--brand-ink); }

.lead { color: var(--text-muted); margin: 0; line-height: 1.55; }

/* --- Header / footer ---------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1.6rem;
}

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; }
.brand img { height: 38px; width: auto; display: block; }
.brand-text {
  font-weight: 700; color: var(--brand-ink); font-size: 1.05rem;
  letter-spacing: .2px;
}

.header-meta { display: flex; align-items: center; gap: .9rem; }
.header-email { color: var(--text-muted); font-size: .9rem; }

.site-main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 2.2rem 1.6rem 3rem;
}
.site-main.full { max-width: none; padding: 0; }

.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: .8rem;
  padding: 1.1rem;
  border-top: 1px solid var(--border);
}

/* --- Buttons ----------------------------------------------------------- */

.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); padding: .7rem 1.25rem;
  border: 1px solid transparent; text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: var(--surface); color: var(--brand-700); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  padding: .45rem .8rem; font-weight: 500; font-size: .9rem;
}
.btn-ghost:hover { color: var(--brand-700); }
.btn-block { width: 100%; }
.btn-primary:disabled, .btn-primary[disabled] { background: var(--locked); cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: none; box-shadow: var(--ring); }

/* --- Flash + banners --------------------------------------------------- */

.flash-stack { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.4rem; }
.flash {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: .92rem; line-height: 1.5;
}
.flash-error   { background: var(--bad-bg);  border-color: #f0c4c4; color: #8f2222; }
.flash-success { background: var(--ok-bg);   border-color: #bfe6cf; color: #126c3c; }
.flash-info    { background: var(--warn-bg); border-color: #ecd6ac; color: #855107; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-radius: var(--radius);
  margin-bottom: 1.6rem;
}
.banner-success { background: var(--ok-bg); border: 1px solid #bfe6cf; }
.banner strong { display: block; color: #126c3c; }
.banner span { color: #2c7a4f; font-size: .92rem; }
.banner-attention {
  background: var(--bad-bg); border: 1px solid #f0bcbc;
  border-left: 4px solid var(--bad);
}
.banner-attention strong { color: #a02525; }
.banner-attention span { color: #9e2b2b; }

/* --- Modal / popup ----------------------------------------------------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(13,58,79,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  border-top: 4px solid var(--warn);
  box-shadow: var(--shadow-lg);
  padding: 2rem 1.9rem;
  width: 100%; max-width: 440px;
}
.modal-card h2 { font-size: 1.3rem; }
.modal-body {
  color: var(--text-muted); line-height: 1.6;
  font-size: .94rem; margin: .7rem 0 1.6rem;
}
.modal-body strong { color: var(--brand-ink); }
.modal-actions { display: flex; gap: .7rem; justify-content: flex-end; }

@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn-primary, .modal-actions .btn-secondary { width: 100%; }
}

/* --- Centered pages (login) -------------------------------------------- */

.page-centered .site-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.page-centered .flash-stack { width: 100%; max-width: 430px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-600);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.6rem 2.4rem;
  width: 100%;
  max-width: 430px;
  text-align: center;
}
.auth-logo { display: block; height: 52px; width: auto; margin: 0 auto 1.3rem; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card .lead { margin: .5rem 0 1.7rem; font-size: .95rem; }
.auth-help {
  margin: 1.6rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.auth-form { display: flex; flex-direction: column; gap: .45rem; text-align: left; }
.auth-form label { font-weight: 600; font-size: .88rem; }
.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
  font: inherit; padding: .7rem .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: .8rem;
}

/* --- Page head --------------------------------------------------------- */

.page-head { margin-bottom: 1.6rem; }
.page-head .lead { margin-top: .3rem; }

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

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
}

.assess-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  display: flex; flex-direction: column; gap: .65rem;
  border-top: 4px solid var(--brand-600);
}
.assess-card.state-locked  { border-top-color: var(--locked); }
.assess-card.state-complete { border-top-color: var(--ok); }
.assess-card.state-awaiting_result,
.assess-card.state-retake  { border-top-color: var(--warn); }

.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--brand-700);
}
.card-desc { color: var(--text-muted); font-size: .9rem; line-height: 1.5; margin: 0; flex: 1; }
.card-score { font-size: .88rem; color: var(--text-muted); margin: 0; }
.card-score strong { color: var(--brand-ink); }
.card-action { margin-top: .4rem; }
.card-note { font-size: .88rem; color: var(--text-muted); margin: 0; }
.card-note.ok  { color: #126c3c; font-weight: 600; }
.card-note.bad { color: #8f2222; font-weight: 600; }
/* Notes are margin-less, so a note sitting directly above a button (the redo
   card) would otherwise read as one block. */
.card-note + .btn-primary { margin-top: .6rem; }

/* --- Status pills ------------------------------------------------------ */

.pill {
  font-size: .73rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; padding: .28rem .6rem; border-radius: 999px;
}
.pill-grey  { background: var(--locked-bg); color: var(--locked); }
.pill-blue  { background: #e6eef7; color: var(--brand-600); }
.pill-amber { background: var(--warn-bg); color: var(--warn); }
.pill-green { background: var(--ok-bg); color: var(--ok); }
.pill-red   { background: var(--bad-bg); color: var(--bad); }

/* --- Assessment split screen ------------------------------------------ */

.split {
  display: flex;
  height: calc(100vh - 71px - 49px); /* viewport minus header & footer */
  min-height: 480px;
}
.study-pane { flex: 6 1 0; background: var(--surface-2); border-right: 1px solid var(--border); }
.study-pane iframe { width: 100%; height: 100%; border: 0; display: block; }
.launch-pane {
  flex: 4 1 0; min-width: 320px; max-width: 460px;
  background: var(--surface); padding: 1.8rem; overflow-y: auto;
}
.launch-pane.solo { max-width: 560px; margin: 0 auto; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); }

.launch-pane h1 { font-size: 1.3rem; }
.launch-pane .lead { font-size: .92rem; margin-bottom: 1.2rem; }

.step-list { padding-left: 1.1rem; margin: 1.1rem 0; color: var(--text-muted); font-size: .9rem; }
.step-list li { margin-bottom: .4rem; line-height: 1.5; }

/* --- Post-launch: study guide expands, launch panel slims down --------- */

/* Once the test window is open the launch panel is mostly idle, so give
   the study guide more room and trim the panel to just the next actions.
   The candidate then snaps this window beside the test window. */
.split.launched .study-pane { flex: 9 1 0; }
.split.launched .launch-pane {
  flex: 0 0 300px; min-width: 260px; max-width: 320px;
}

.side-by-side h2 { font-size: 1.05rem; margin-bottom: .35rem; }
.side-by-side .lead { font-size: .9rem; margin-bottom: .9rem; }

/* --- Credential copy fields ------------------------------------------- */

.cred-block { display: flex; flex-direction: column; gap: .7rem; margin: 1.2rem 0; }
.cred {
  display: flex; flex-direction: column; gap: .25rem;
}
.cred-label { font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-muted); }
.cred-row {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--surface-2);
}
.cred-value {
  flex: 1; padding: .6rem .7rem; font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: .9rem; color: var(--brand-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy-btn {
  border: 0; border-left: 1px solid var(--border);
  background: var(--surface); color: var(--brand-600);
  font: inherit; font-weight: 600; font-size: .82rem; padding: 0 .9rem;
  cursor: pointer;
}
.copy-btn:hover { background: var(--surface-2); }
.copy-btn.copied { color: var(--ok); }

.callout {
  background: var(--warn-bg); border: 1px solid #ecd6ac;
  border-radius: var(--radius-sm); padding: .8rem .9rem;
  font-size: .87rem; color: #855107; line-height: 1.5; margin: 1rem 0;
}
.divider { border: 0; border-top: 1px solid var(--border); margin: 1.4rem 0; }
.back-link { font-size: .9rem; }

/* --- Completion page --------------------------------------------------- */

.complete-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 3rem 2.6rem; max-width: 540px; text-align: center;
}
.complete-mark {
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--ok-bg); color: var(--ok);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem; margin-bottom: 1.2rem;
}
.complete-card h1 { font-size: 1.6rem; }
.complete-card p { color: var(--text-muted); line-height: 1.6; margin: .6rem 0 0; }

/* --- Admin ------------------------------------------------------------- */

.admin-section { margin-bottom: 2.4rem; }
.admin-section h2 { margin-bottom: .8rem; }

.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; font-size: .88rem;
}
.data-table th, .data-table td {
  text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--surface-2); color: var(--text-muted);
  text-transform: uppercase; font-size: .72rem; letter-spacing: .4px;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table code { font-size: .82rem; }

.tag {
  display: inline-block; font-size: .73rem; font-weight: 700;
  padding: .15rem .5rem; border-radius: 999px;
}
.tag-ok   { background: var(--ok-bg); color: var(--ok); }
.tag-wait { background: var(--warn-bg); color: var(--warn); }
.tag-none { background: var(--locked-bg); color: var(--locked); }
.tag-bad  { background: var(--bad-bg); color: var(--bad); }

.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type="text"], .inline-form input[type="email"] {
  font: inherit; padding: .4rem .55rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .85rem;
}
.inline-form button {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  padding: .42rem .8rem; border-radius: 6px;
  border: 1px solid var(--brand-600); background: var(--brand-600); color: #fff;
}
.empty-note { color: var(--text-muted); font-size: .9rem; font-style: italic; }

/* --- Recruiter view ---------------------------------------------------- */

.recruiter-wrap { width: 100%; max-width: 1180px; margin: 0 auto; }

.recruiter-head {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: flex-end;
  margin-bottom: 1.4rem;
}
.recruiter-head .head-actions { display: flex; gap: .55rem; align-items: center; }

.stat-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 1.6rem;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-card .stat-label {
  color: var(--text-muted); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
  /* reserve space for up to 2 lines so single- and multi-line labels align */
  min-height: 2.4em; line-height: 1.2;
  display: flex; align-items: flex-end;
}
.stat-card .stat-value {
  color: var(--brand-ink); font-size: 1.85rem; font-weight: 700; line-height: 1.1;
}
.stat-card.accent-ok    { border-left: 4px solid var(--ok); }
.stat-card.accent-warn  { border-left: 4px solid var(--warn); }
.stat-card.accent-bad   { border-left: 4px solid var(--bad); }
.stat-card.accent-brand { border-left: 4px solid var(--brand); }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1rem;
}
.filter-bar .filter-label {
  color: var(--text-muted); font-size: .85rem; margin-right: .25rem;
}
.filter-chip {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  padding: .4rem .85rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all .15s ease;
}
.filter-chip:hover { border-color: var(--brand); color: var(--brand-700); }
.filter-chip.active {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.filter-bar .search {
  margin-left: auto; flex: 0 0 240px; max-width: 100%;
  padding: .45rem .7rem; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: .9rem; background: var(--surface);
}

.candidate-list { display: flex; flex-direction: column; gap: .85rem; }

.candidate-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; transition: box-shadow .15s ease, transform .15s ease;
}
.candidate-card:hover { box-shadow: var(--shadow-lg); }
.candidate-card.outreach { border-left: 4px solid var(--bad); }
.candidate-card.retake   { border-left: 4px solid var(--warn); }
.candidate-card.done     { border-left: 4px solid var(--ok); }

.candidate-row {
  display: grid; align-items: center; gap: 1rem;
  /* Step columns size to their content (pills no longer wrap); identity
     column flexes to fill remaining space. */
  grid-template-columns:
    minmax(180px, 1.6fr) repeat(5, max-content) auto;
  padding: 1rem 1.2rem; cursor: pointer; user-select: none;
}
.candidate-id { min-width: 0; }
.candidate-email {
  font-weight: 600; color: var(--brand-ink); font-size: .98rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  user-select: text; min-width: 0;
}

/* Copy-to-clipboard control next to email / Bullhorn ID. The wrap restores
   text selection on the value (the row sets user-select: none) and gives the
   button somewhere to sit without affecting the email's truncation. */
.copy-wrap {
  display: inline-flex; align-items: center; gap: .35rem;
  max-width: 100%; min-width: 0; user-select: text;
}
.copy-wrap > :first-child { min-width: 0; }
.copy-btn {
  flex: none; border: 0; background: transparent; cursor: pointer;
  padding: .15rem; border-radius: 5px; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .55; transition: opacity .12s ease, color .12s ease, background .12s ease;
}
.copy-btn:hover { opacity: 1; color: var(--brand-700); background: var(--surface-2); }
.copy-btn:focus-visible {
  outline: 0; opacity: 1; box-shadow: var(--ring);
}
.copy-btn.copied { color: var(--ok); opacity: 1; }
.copy-btn.copied::after {
  content: "copied"; font-size: .7rem; font-weight: 700; margin-left: .25rem;
}
.candidate-meta {
  color: var(--text-muted); font-size: .78rem; margin-top: .15rem;
  display: flex; gap: .65rem; flex-wrap: wrap;
}

.step-cell { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.step-name {
  font-size: .68rem; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
}
.step-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .55rem; border-radius: 999px;
  font-size: .76rem; font-weight: 700; line-height: 1; width: fit-content;
  white-space: nowrap;
}
.step-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.step-pill.s-passed   { background: var(--ok-bg);     color: var(--ok); }
.step-pill.s-passed .dot   { background: var(--ok); }
.step-pill.s-complete { background: var(--ok-bg);     color: var(--ok); }
.step-pill.s-complete .dot { background: var(--ok); }
.step-pill.s-failed   { background: var(--bad-bg);    color: var(--bad); }
.step-pill.s-failed .dot   { background: var(--bad); }
.step-pill.s-in_progress     { background: var(--warn-bg);   color: var(--warn); }
.step-pill.s-in_progress .dot     { background: var(--warn); }
.step-pill.s-retake_available { background: var(--warn-bg);  color: var(--warn); }
.step-pill.s-retake_available .dot { background: var(--warn); }
.step-pill.s-not_started { background: var(--locked-bg); color: var(--locked); }
.step-pill.s-not_started .dot { background: var(--locked); }
.step-pill.s-locked      { background: var(--locked-bg); color: var(--locked); }
.step-pill.s-locked .dot      { background: var(--locked); }

.attempts-line {
  font-size: .72rem; color: var(--text-muted); font-weight: 600;
}
.attempts-line strong { color: var(--text); font-weight: 700; }

.expand-chev {
  color: var(--text-muted); transition: transform .15s ease;
  font-size: 1.1rem; line-height: 1; padding: .25rem;
}
.candidate-card[open] .expand-chev { transform: rotate(90deg); }

.candidate-details {
  border-top: 1px solid var(--border); background: var(--surface-2);
  padding: 1rem 1.2rem; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.detail-block h3 {
  font-size: .8rem; color: var(--brand-ink);
  text-transform: uppercase; letter-spacing: .4px; margin: 0 0 .55rem;
}
.attempts-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.attempts-table th, .attempts-table td {
  text-align: left; padding: .35rem .5rem;
  border-bottom: 1px solid var(--border);
}
.attempts-table th {
  font-size: .68rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px; font-weight: 600;
}
.attempts-table tr:last-child td { border-bottom: 0; }
.attempts-table .score-pass { color: var(--ok); font-weight: 700; }
.attempts-table .score-fail { color: var(--bad); font-weight: 700; }
.detail-block .empty-note { padding: .4rem 0; }

.no-candidates {
  text-align: center; padding: 2.5rem 1rem; color: var(--text-muted);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius);
}

@media (max-width: 980px) {
  .candidate-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "id chev"
      "steps steps";
    gap: .6rem;
  }
  .candidate-id { grid-area: id; }
  .expand-chev  { grid-area: chev; }
  .candidate-row .step-cell { display: none; }
  .candidate-row::after {
    grid-area: steps; content: ""; display: block;
  }
  .candidate-card .quick-states {
    display: flex; flex-wrap: wrap; gap: .35rem;
    padding: 0 1.2rem 1rem;
  }
}
@media (min-width: 981px) {
  .candidate-card .quick-states { display: none; }
}

/* --- Responsive -------------------------------------------------------- */

@media (max-width: 720px) {
  .split { flex-direction: column; height: auto; }
  .study-pane { height: 60vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .launch-pane { max-width: none; }
  .site-header { padding: .7rem 1rem; }
  .header-email { display: none; }

  /* On a stacked small-screen layout there is no side-by-side to set up,
     so keep the launch panel full width and do not collapse it. */
  .split.launched .study-pane { flex: none; height: 60vh; }
  .split.launched .launch-pane { flex: none; min-width: 0; max-width: none; }
}
