/* Onboarding app styles. One file, no build step. */

:root {
  --brand: #1f5f56;
  --brand-dark: #164841;
  --brand-soft: #e5f0ed;
  --ink: #1b2330;
  --muted: #5d6675;
  --line: #dde1e6;
  --bg: #f4f5f3;
  --card: #ffffff;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --info-soft: #eaf1fb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid #7cc4b5; outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
h2 { font-size: 20px; line-height: 1.3; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .inner { max-width: 1160px; margin: 0 auto; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px; letter-spacing: .02em; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.site-nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.site-nav a, .site-nav button { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; }
.site-nav a:hover, .site-nav button:hover { background: var(--bg); }
.site-nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 32px; }

/* Layout */
main { max-width: 560px; margin: 28px auto 64px; padding: 0 16px; }
main.wide { max-width: 900px; }
main.full { max-width: 1160px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.back { display: inline-block; margin-bottom: 12px; font-size: 15px; text-decoration: none; }
.back:hover { text-decoration: underline; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Buttons */
.button, button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border: 1px solid var(--brand); border-radius: 10px; background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.button:hover, button:hover { background: var(--brand-dark); color: #fff; }
.button.secondary, button.secondary { background: #fff; color: var(--brand); }
.button.secondary:hover, button.secondary:hover { background: var(--brand-soft); color: var(--brand-dark); }
.button.danger, button.danger { background: #fff; color: var(--bad); border-color: #e9b3ad; }
.button.danger:hover, button.danger:hover { background: var(--bad-soft); }
.button.small, button.small { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 8px; }
.button.big, button.big { min-height: 52px; padding: 12px 28px; font-size: 17px; }
button.link { background: none; border: 0; color: var(--brand); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }
button.link.danger { color: var(--bad); }

/* Forms */
.field { margin-top: 18px; }
.field:first-child { margin-top: 0; }
label, .label { display: block; font-weight: 600; margin: 0 0 6px; }
.req { color: var(--bad); font-weight: 400; }
.optional { color: var(--muted); font-weight: 400; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], input:not([type]), textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #c8ced6; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: 3px solid rgba(31, 95, 86, .18); outline-offset: 0; }
input[readonly] { background: #f0f2f4; color: var(--muted); }
textarea { resize: vertical; min-height: 96px; }
.helptext { color: var(--muted); font-size: 14px; display: block; margin-top: 6px; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 6px 0 0; font-size: 14px; font-weight: 600; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--bad); }
.field.has-error { border-left: 4px solid var(--bad); padding-left: 12px; margin-left: -16px; }
[data-show-if] { transition: opacity .15s; }
.follow-up { border-left: 3px solid var(--brand-soft); padding-left: 16px; }

/* Yes/No and other short choices as big buttons */
.choices > div { display: flex; flex-wrap: wrap; gap: 8px; }
.choices > div > div { display: contents; }
.choices label { position: relative; margin: 0; font-weight: 500; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices label { display: inline-flex; align-items: center; min-height: 44px; min-width: 76px; justify-content: center; padding: 8px 18px; border: 1px solid #c8ced6; border-radius: 10px; background: #fff; cursor: pointer; }
.choices label:hover { border-color: var(--brand); }
.choices label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: #fff; }
.choices label:has(input:focus-visible) { outline: 3px solid #7cc4b5; outline-offset: 2px; }

/* Tick boxes (declarations) */
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfa; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.check label { margin: 0; }

/* Notices */
.notice { padding: 14px 16px; border-radius: 10px; background: var(--info-soft); margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.success { background: var(--brand-soft); }
.notice > :last-child { margin-bottom: 0; }
.notice .note, .note { white-space: pre-wrap; margin: 6px 0 0; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 14px 16px; border-radius: 10px; margin-bottom: 8px; background: var(--brand-soft); font-weight: 500; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }
.legal { font-size: 15px; color: #3d4654; }
.legal p, .legal li { margin-bottom: 8px; }
details.more { margin: 8px 0 0; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; }
details.more[open] summary { margin-bottom: 8px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #eceef1; color: #3d4654; white-space: nowrap; }
.badge.submitted, .badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.changes_requested, .badge.rejected { background: var(--bad-soft); color: var(--bad); }
.badge.approved, .badge.completed { background: var(--brand-soft); color: var(--brand-dark); }

/* Candidate step bar */
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 20px; gap: 0; counter-reset: step; }
.steps li { flex: 1; position: relative; text-align: center; font-size: 13px; color: var(--muted); padding-top: 38px; }
.steps li::before { content: attr(data-n); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid #c8ced6; font-weight: 700; color: var(--muted); z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 14px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: #c8ced6; }
.steps li:first-child::after { display: none; }
.steps li.done::before { content: "✓"; background: var(--brand); border-color: var(--brand); color: #fff; }
.steps li.done::after, .steps li.current::after { background: var(--brand); }
.steps li.current { color: var(--ink); font-weight: 700; }
.steps li.current::before { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
@media (max-width: 480px) { .steps li { font-size: 11px; } }

/* "Your next step" panel */
.next { border-left: 6px solid var(--brand); }
.next.warn { border-left-color: #d99a00; }
.next.info { border-left-color: #6b8fc7; }
.next.success { border-left-color: var(--brand); background: linear-gradient(0deg, #fff, var(--brand-soft)); }
.next .eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

/* Application form layout with section menu */
.form-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1000px) { .form-layout { grid-template-columns: 250px 1fr; } }
.section-nav { position: sticky; top: 76px; align-self: start; padding: 16px; }
.section-nav ol { list-style: none; margin: 8px 0 0; padding: 0; }
.section-nav a { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14px; }
.section-nav a:hover { background: var(--bg); }
.section-nav .dot { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid #c8ced6; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.section-nav .complete .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.section-nav .complete .dot::before { content: "✓"; }
.section-nav .error .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.section-nav .error .dot::before { content: "!"; }
.progress { height: 8px; background: #e6e9ec; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
@media (max-width: 999px) {
  .section-nav { position: static; }
  .section-nav ol { display: none; }
  .section-nav[open] ol, .section-nav details[open] ol { display: block; }
}
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head h2 { margin-bottom: 4px; }
.section-num { color: var(--muted); font-size: 14px; font-weight: 600; }
.save-bar { position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .96); backdrop-filter: blur(4px); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; box-shadow: 0 -4px 16px rgba(16, 24, 40, .08); }
.save-bar .status { font-size: 14px; color: var(--muted); }
.save-bar .status.dirty { color: var(--warn); font-weight: 600; }
.error-summary { border: 2px solid var(--bad); background: #fff; }
.error-summary h2 { color: var(--bad); }
.error-summary ul { margin: 0; padding-left: 20px; }

/* Repeating rows (education, jobs, referees…) */
.formset { margin-top: 20px; }
.formset h3 { margin-top: 0; }
.row { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; background: #fafbfa; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.row-head strong { font-size: 15px; }
.row.removed { opacity: .55; background: #fff; }
.row.removed .grid { display: none; }
.js .row .remove-check, html:not(.js) .row .remove-row { display: none; }
.row .remove-check { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; font-size: 14px; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.grid .field { margin-top: 12px; }
.grid .field:has(textarea) { grid-column: 1 / -1; }
.add-row { margin-top: 4px; }

/* Documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.slot { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.slot .thumb { aspect-ratio: 4 / 3; background: #eef0f2; display: grid; place-items: center; color: var(--muted); font-size: 14px; overflow: hidden; }
.slot .thumb img { width: 100%; height: 100%; object-fit: cover; }
.slot .thumb .pdf { font-size: 28px; font-weight: 800; color: #b42318; }
.slot .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.slot .title { font-weight: 600; overflow-wrap: anywhere; }
.slot.empty { border: 2px dashed #c8ced6; background: #fafbfa; }
.slot.empty .thumb { background: transparent; aspect-ratio: auto; padding: 18px 0 0; font-size: 30px; }
.slot.rejected { border-color: #e9b3ad; }
.dropzone { border: 2px dashed #c8ced6; border-radius: 12px; padding: 16px; background: #fafbfa; transition: border-color .15s, background .15s; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .preview-local { max-height: 160px; border-radius: 8px; display: block; margin-top: 8px; }
.file-pick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.file-pick input[type=file] { max-width: 100%; }
.preview { display: block; max-width: 100%; max-height: 460px; border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #eef0f2; }

/* Staff */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--brand); color: var(--ink); }
.tile .count { font-size: 32px; font-weight: 800; line-height: 1.1; }
.tile.urgent.has { border-color: #e7c36a; background: #fffbef; }
.tile .label { font-size: 14px; color: var(--muted); margin: 4px 0 0; font-weight: 500; }
.flags { border: 2px solid #e7c36a; background: #fffbef; }
.flags ul { margin: 0; padding-left: 20px; }
.flag-value { background: var(--warn-soft); border-radius: 6px; padding: 0 6px; font-weight: 700; }
.decision-bar { position: sticky; bottom: 0; z-index: 10; }
.reject-box { margin-top: 10px; }
.reject-box summary { list-style: none; display: inline-flex; }
.reject-box summary::-webkit-details-marker { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { min-height: 32px; padding: 4px 12px; border-radius: 999px; border: 1px solid #c8ced6; background: #fff; color: var(--ink); font-weight: 500; font-size: 14px; }
.chip:hover { background: var(--bg); color: var(--ink); }
.review-doc { padding: 16px 0; border-top: 1px solid var(--line); }
.review-doc:first-of-type { border-top: 0; padding-top: 0; }

/* Groups of small buttons (in table rows and page headers) */
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions.left { justify-content: flex-start; }
.row-actions .button { white-space: nowrap; }
td.buttons { text-align: right; width: 1%; }
@media (max-width: 700px) { .row-actions { justify-content: flex-start; } td.buttons { width: auto; } }

/* Tables and summaries */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.empty-state { text-align: center; padding: 20px; color: var(--muted); }
dl.summary { display: grid; grid-template-columns: minmax(180px, 1fr) 2fr; gap: 8px 20px; margin: 0; }
dl.summary dt { color: var(--muted); font-size: 14px; }
dl.summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.summary-row { padding: 12px 0; border-top: 1px solid var(--line); }
@media (max-width: 600px) { dl.summary { grid-template-columns: 1fr; gap: 0; } dl.summary dd { margin-bottom: 10px; } .card { padding: 18px; } }
