/* UPHFP Recruit — shared styles
   Palette: UNIPH forest green + crane gold */
:root {
  --ink: #182018;
  --muted: #536153;
  --surface: #f3f6f3;
  --card: #ffffff;
  --line: #cdd9cc;
  --primary: #1a5c36;
  --primary-deep: #113d24;
  --primary-soft: #e2ede6;
  --gold: #c79a2e;
  --gold-soft: #f7efd6;
  --red: #a93226;
  --red-soft: #f7e4e1;
  --radius: 10px;
  --font-ui: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
a { color: var(--primary); }
button { font-family: inherit; }

/* ---------- public pages ---------- */
.public-wrap { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.25rem 5rem; }
.public-head { border-bottom: 3px solid var(--primary); padding-bottom: 1.25rem; margin-bottom: 2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; color: var(--primary); margin-bottom: .4rem; }
.display { font-family: var(--font-display); font-weight: 600; font-size: 2.1rem; }
.lede { color: var(--muted); max-width: 56ch; }

/* the seven-stage rail — signature element */
.rail { display: flex; gap: 4px; margin: 1.2rem 0; }
.rail span { flex: 1; height: 7px; border-radius: 4px; background: var(--line); }
.rail span.done { background: var(--primary); }
.rail span.now { background: var(--gold); }
.rail-labels { display: flex; gap: 4px; font-size: .68rem; color: var(--muted); }
.rail-labels span { flex: 1; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem; }
.card h2 { font-size: 1.05rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: 1rem; }
fieldset { border: 0; padding: 0; margin: 0; }
label { display: block; font-weight: 600; font-size: .85rem; margin: .9rem 0 .3rem; }
label .req { color: var(--red); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 7px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
@media (max-width: 620px) { .grid2 { grid-template-columns: 1fr; } }
.checkrow { display: flex; align-items: flex-start; gap: .55rem; margin: .7rem 0; font-size: .9rem; }
.checkrow input { margin-top: .25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.chips label { display: flex; align-items: center; gap: .35rem; margin: 0; font-weight: 500; font-size: .85rem;
  border: 1px solid var(--line); border-radius: 20px; padding: .3rem .8rem; cursor: pointer; background: #fff; }
.chips label:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); }

.btn { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 8px;
  padding: .65rem 1.4rem; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-deep); }
.btn.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.small { padding: .35rem .8rem; font-size: .8rem; }
.btn.gold { background: var(--gold); color: #3a2c05; }
.btn.danger { background: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.notice { border-radius: 8px; padding: .8rem 1rem; margin: 1rem 0; font-size: .9rem; }
.notice.ok { background: var(--primary-soft); border: 1px solid var(--primary); }
.notice.warn { background: var(--gold-soft); border: 1px solid var(--gold); }
.notice.err { background: var(--red-soft); border: 1px solid var(--red); }

/* repeatable entry blocks (education / employment) */
.entry-block { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin-top: .8rem; position: relative; background: #f8fbf8; }
.entry-block + .entry-block { margin-top: .6rem; }
.entry-remove { position: absolute; top: .7rem; right: .7rem; background: none; border: none;
  color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .1rem .4rem; border-radius: 4px; line-height: 1; }
.entry-remove:hover { background: var(--red-soft); color: var(--red); }
.add-entry-btn { margin-top: 1rem; display: inline-flex; align-items: center; gap: .4rem;
  background: var(--primary-soft); border: 1.5px dashed var(--primary); color: var(--primary);
  padding: .5rem 1rem; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.add-entry-btn:hover { background: var(--primary); color: #fff; border-style: solid; }

/* ---------- staff app ---------- */
.shell { display: grid; grid-template-columns: 218px 1fr; min-height: 100vh; }
.side { background: var(--primary-deep); color: #c8ddc8; padding: 1.2rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: #fff; margin-bottom: .1rem; }
.side .cohort { font-size: .72rem; color: #8ab89a; margin-bottom: 1.4rem; }
.side nav a { display: block; color: #a8c8a8; text-decoration: none; padding: .5rem .7rem; border-radius: 7px; font-size: .9rem; margin-bottom: 2px; }
.side nav a.active, .side nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.side .who { margin-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.18); padding-top: .9rem; font-size: .8rem; color: #8ab89a; }
.main { padding: 1.8rem 2rem 4rem; max-width: 1200px; }
.main h1 { font-size: 1.35rem; margin-bottom: 1.1rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar input[type=text], .toolbar select { width: auto; }

table.data { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .87rem; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: #eef3ee; }
table.data td { padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.rowlink { cursor: pointer; }
table.data tr.rowlink:hover { background: var(--primary-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: .12rem .55rem; border-radius: 11px; white-space: nowrap; }
.tag.green { background: var(--primary-soft); color: var(--primary-deep); }
.tag.gold { background: var(--gold-soft); color: #6d5312; }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.grey { background: #e7eaef; color: var(--muted); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat.accent { border-top: 3px solid var(--primary); }

.detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: .3rem .8rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.score-pill { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); }

.rubric-row { display: grid; grid-template-columns: 1fr 210px; gap: .8rem; align-items: start;
  padding: .8rem 0; border-bottom: 1px solid var(--line); }
.rubric-row:last-of-type { border-bottom: 0; }
.likert { display: flex; gap: .3rem; }
.likert label { margin: 0; font-weight: 600; border: 1px solid var(--line); border-radius: 6px;
  width: 34px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: .85rem; }
.likert input { display: none; }
.likert label:has(input:checked) { background: var(--primary); color: #fff; border-color: var(--primary); }

.modal-bg { position: fixed; inset: 0; background: rgba(10,20,40,.45); display: flex; align-items: flex-start; justify-content: center; padding: 3rem 1rem; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius); max-width: 720px; width: 100%; padding: 1.5rem; }
pre.letter { white-space: pre-wrap; background: #f4f7f4; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; font-family: inherit; font-size: .88rem; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
@media print { .side, .toolbar, .btn { display: none !important; } .shell { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- application wizard ---------- */
.wizard-bar { display: flex; align-items: center; overflow-x: auto; gap: 0; padding: .4rem 0 .9rem; scrollbar-width: none; }
.wizard-bar::-webkit-scrollbar { display: none; }
.step-node { display: flex; align-items: center; flex-shrink: 0; }
.step-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700;
  color: var(--muted); cursor: default; flex-shrink: 0; transition: background .15s, border-color .15s; }
.step-dot.done { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); cursor: pointer; }
.step-dot.done .step-n { display: none; }
.step-dot.done::after { content: '✓'; font-size: .68rem; }
.step-dot.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-line { width: 20px; height: 2px; background: var(--line); flex-shrink: 0; }
.step-line.done-line { background: var(--primary); }
.wizard-meta { margin-bottom: 1rem; }
.wizard-step-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .15rem; }
.wizard-step-name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); gap: .6rem; }
.word-counter { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.word-counter.over { color: var(--red); font-weight: 600; }
.ag-bar { background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 8px;
  padding: .5rem .9rem; font-size: .84rem; margin-bottom: 1rem; }
.ag-bar a { color: var(--primary); font-weight: 600; }
/* read-only submitted application */
#appliedPanel .card h3 { font-size: .98rem; margin: 0 0 .5rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.ro-row { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.ro-row:last-child { border-bottom: 0; }
.ro-row span:first-child { color: var(--muted); }
.ro-row span:last-child { text-align: right; }
.ro-para { padding: .45rem 0; font-size: .88rem; border-bottom: 1px solid var(--line); }
.ro-para:last-child { border-bottom: 0; }
.ro-para .ro-k { color: var(--muted); font-weight: 600; margin-bottom: .2rem; }
.save-state { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.save-state.saved { color: var(--primary); font-weight: 600; }
.save-state.failed { color: var(--red); font-weight: 600; }

/* eligibility self-check */
.selfcheck { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.selfcheck h2 { font-family: var(--font-display); font-size: 1.35rem; color: var(--primary-deep); margin-bottom: .3rem; }
.selfcheck .sc-q { border-top: 1px solid var(--line); padding: .9rem 0; }
.selfcheck .sc-q:first-of-type { border-top: 0; }
.selfcheck .sc-label { font-weight: 600; font-size: .92rem; margin-bottom: .5rem; }
.sc-opts { display: flex; gap: .5rem; }
.sc-opts button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .4rem 1.1rem;
  font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--ink); }
.sc-opts button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.sc-opts button.on.no { background: var(--red); border-color: var(--red); }

/* ---------- reviewer screen (Applicant Review Summary) ---------- */
.section-h { font-size: 1rem; margin: 1.6rem 0 .6rem; color: var(--primary-deep); }
.review-screen { display: block; }
.rev-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  border-bottom: 2px solid var(--primary); padding-bottom: .8rem; margin-bottom: 1rem; }
.rev-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(260px, .85fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .rev-grid { grid-template-columns: 1fr; } }
/* right rail follows the reviewer down the page instead of leaving a long empty column */
.rev-grid > div:last-child { position: sticky; top: 0; }
@media (max-width: 900px) { .rev-grid > div:last-child { position: static; } }

/* six domain cards, two-up on wide screens */
.domains-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; align-items: start; }
@media (max-width: 1080px) { .domains-grid { grid-template-columns: 1fr; } }

.snap-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.snap-chip { display: flex; align-items: center; gap: .5rem; background: #eef3ee;
  border: 1px solid var(--line); border-radius: 20px; padding: .3rem .8rem; font-size: .8rem; }
.snap-chip.snap-ok { background: var(--primary-soft); border-color: var(--primary); }
.snap-chip.warn { background: var(--gold-soft); border-color: var(--gold); }
.snap-l { color: var(--muted); }
.snap-v { font-weight: 700; }

/* per-domain applicant context inside each scoring card */
.dom-facts { font-size: .8rem; color: var(--primary-deep); background: var(--primary-soft); border-radius: 6px;
  padding: .35rem .6rem; margin: .1rem 0 .5rem; font-weight: 500; }
.dom-text { font-size: .86rem; line-height: 1.5; white-space: pre-wrap; margin-bottom: .6rem; color: var(--ink); }
.dom-text.muted { font-style: italic; }
.dom-submitted-note { font-size: .82rem; margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--line); }

/* at-a-glance, stacked so long values don't wrap awkwardly */
.glance-list { display: flex; flex-direction: column; gap: .5rem; }
.glance-item { display: flex; flex-direction: column; }
.glance-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.glance-v { font-size: .88rem; font-weight: 500; line-height: 1.35; }

.domain-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem .95rem; margin-bottom: 0; }
.domain-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.domain-n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.evidence { margin: .2rem 0 .5rem; padding-left: 1.05rem; font-size: .81rem; color: var(--ink); line-height: 1.45; }
.evidence li { margin: .15rem 0; }
.score-row { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
.score-box { width: 90px !important; text-align: center; font-weight: 700; font-size: 1rem; }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .6rem; font-size: .72rem;
  color: var(--muted); background: #f6f9f6; border-radius: 6px; padding: .4rem .55rem; margin-top: .35rem; }
.guide b { color: var(--ink); }
.dom-note { min-height: 48px; margin-top: .5rem; font-size: .85rem; }
.flag-item { font-size: .82rem; background: var(--gold-soft); border-left: 3px solid var(--gold);
  padding: .35rem .6rem; border-radius: 4px; margin: .3rem 0; }

.sum-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin-bottom: 1rem; position: sticky; top: 1rem; }
.rev-grid > div:last-child .sum-card { position: static; }
.sum-row { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; padding: .18rem 0; }
.sum-total { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--primary-deep);
  border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .5rem; text-align: right; }

.empty-state { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem 1.8rem; max-width: 640px; }
.empty-state .es-title { font-family: var(--font-display); font-size: 1.15rem; color: var(--primary-deep); margin-bottom: .4rem; }
.empty-state .es-body { color: var(--muted); font-size: .9rem; margin: 0 0 .9rem; }
.empty-state .es-steps { margin: 0; padding-left: 1.2rem; font-size: .86rem; color: var(--ink); }
.empty-state .es-steps li { margin: .35rem 0; }

.toolbar .inline-check { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 500; font-size: .85rem; white-space: nowrap; }
.toolbar .inline-check input { width: auto; margin: 0; }
.queue-progress { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.queue-label { font-size: .85rem; font-weight: 600; margin-bottom: .45rem; }

.elig-fail { color: var(--red); }
.elig-manual { color: #6d5312; }
.elig-flag { color: var(--muted); }

/* ---------- toasts ---------- */
#toastRoot { position: fixed; right: 1rem; bottom: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; max-width: 360px; }
.toast { background: var(--ink); color: #fff; border-radius: 9px; padding: .7rem .95rem; font-size: .86rem;
  box-shadow: 0 8px 24px rgba(17,61,36,.22); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
  border-left: 4px solid var(--primary); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: var(--primary); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- dialogs (confirm / prompt) ---------- */
#dialogRoot .modal-bg { z-index: 80; align-items: center; }
.dialog { max-width: 460px; }
.dialog h3 { font-size: 1.05rem; }
.dialog label { margin-top: .6rem; }
.dialog-err { color: var(--red); font-size: .8rem; min-height: 1rem; margin-top: .3rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }

/* ---------- score control (slider + number + live band) ---------- */
.score-control { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: center; margin: .5rem 0; }
.score-control input[type=range] { width: 100%; accent-color: var(--primary); }
.score-num { width: 84px !important; text-align: center; font-weight: 700; font-size: 1rem; }
.band-live { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); }
.band-live b { color: var(--primary-deep); }
.guide .on { background: var(--primary-soft); border-radius: 4px; padding: 0 .2rem; color: var(--primary-deep); font-weight: 600; }

/* ---------- focus & polish ---------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.btn:focus-visible { outline-offset: 3px; }
.side .brand-row img { border-radius: 50%; }
table.data tr.rowlink:focus-visible { background: var(--primary-soft); }

/* segmented control (interview scoring) */
.iv-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.iv-row:last-of-type { border-bottom: 0; }
.iv-label { font-weight: 600; font-size: .9rem; }
.seg { display: inline-flex; gap: 4px; }
.seg-btn { min-width: 34px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  font-weight: 600; font-size: .85rem; color: var(--ink); cursor: pointer; }
.seg-btn:hover { border-color: var(--primary); }
.seg-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* admin shell polish */
.side { background: linear-gradient(180deg, var(--primary-deep) 0%, #0d3320 100%); }
.side .brand { letter-spacing: .01em; }
.side .cohort { line-height: 1.35; }
.side nav a { transition: background .12s; }
.main { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .main { animation: none; } }
.toolbar .btn { box-shadow: none; }
.card { transition: border-color .12s; }
@media (max-width: 700px) {
  .rubric-row { grid-template-columns: 1fr; }
  .score-control { grid-template-columns: 1fr; }
  .score-num { width: 100% !important; }
  table.data { font-size: .82rem; }
}
