:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #2b2b2b;
  --ink-2: #424242;
  --muted: #6e6a67;
  --line: #e4ded8;
  --brand: #72403d;
  --brand-dark: #5a3230;
  --brand-ink: #ffffff;
  --brand-soft: #f4eceb;
  --accent: #424242;
  --accent-soft: #ecebea;
  --ok: #2f7a4d;
  --ok-soft: #e3f2e8;
  --warn: #9a6b12;
  --warn-soft: #fbf1db;
  --danger: #a33a32;
  --danger-soft: #f8e5e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 35, 33, 0.06), 0 4px 16px rgba(60, 35, 33, 0.05);
  --heading: 'Josefin Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

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

h1, h2, h3 { font-family: var(--heading); font-weight: 600; color: var(--brand); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--brand);
}
.site-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; min-width: 0; }
.brand img { display: block; height: 44px; width: auto; }
.brand-label {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  font-family: var(--heading);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
}
.site-nav { display: flex; gap: 20px; align-items: center; font-family: var(--heading); font-weight: 600; font-size: 1rem; letter-spacing: 0.03em; }
.site-nav a { color: var(--accent); text-decoration: none; }
.site-nav a:hover { color: var(--brand); }
@media (max-width: 720px) { .brand-label { display: none; } }
@media (max-width: 420px) { .brand img { height: 32px; } .site-nav { gap: 14px; font-size: 0.92rem; } }

/* ---------- Layout ---------- */
main { padding: 40px 20px 64px; }
.container { max-width: 1120px; margin: 0 auto; }
.narrow { max-width: 720px; margin: 0 auto; }
.tiny { max-width: 440px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card + .card { margin-top: 20px; }
@media (max-width: 560px) { .card { padding: 20px; } main { padding: 24px 16px 48px; } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.eyebrow { font-family: var(--heading); font-size: 0.88rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.lede { font-size: 1.1rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 24px 0 8px; }
.hero .lede { max-width: 620px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-top: 40px; }
.paths h3 { margin-bottom: 0.35em; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 0.95rem var(--body);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover { background: var(--brand-soft); }
.btn-small { padding: 7px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- Forms ---------- */
fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend { font-family: var(--heading); font-size: 1.25rem; color: var(--brand); font-weight: 600; margin-bottom: 14px; padding: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: 2fr 1fr 1fr; }
.span-2, .grid-3 .span-3 { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid, .grid-3 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.req { color: var(--danger); }

input[type='text'], input[type='email'], input[type='tel'], input[type='password'], input[type='search'],
select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfcabf;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .choice:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: var(--brand);
}

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.choice {
  position: relative;
  display: block;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 16px 46px;
  cursor: pointer;
  background: var(--surface);
}
.choice input { position: absolute; left: 16px; top: 19px; accent-color: var(--brand); width: 18px; height: 18px; }
.choice strong { display: block; color: var(--brand); }
.choice span { font-size: 0.88rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.form-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 0.92rem; margin-bottom: 18px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--brand-soft); color: var(--brand); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--brand-soft);
  color: var(--brand);
}
.badge-planter { background: var(--accent-soft); color: var(--accent); }
.badge-partner { background: var(--brand-soft); color: var(--brand); }
.badge-completed, .badge-approved { background: var(--ok-soft); color: var(--ok); }
.badge-in_progress, .badge-active { background: var(--warn-soft); color: var(--warn); }
.badge-declined, .badge-withdrawn { background: var(--danger-soft); color: var(--danger); }
.badge-not_started, .badge-skipped, .badge-on_hold, .badge-new { background: #eeece7; color: var(--ink-2); }

/* ---------- Step timeline ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.step { position: relative; padding: 0 0 26px 44px; }
.step:last-child { padding-bottom: 0; }
.step::before {
  content: '';
  position: absolute;
  left: 13px; top: 30px; bottom: 2px;
  width: 2px;
  background: var(--line);
}
.step:last-child::before { display: none; }
.step-dot {
  position: absolute; left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line); color: var(--muted);
}
.step[data-status='in_progress'] .step-dot { border-color: var(--warn); color: var(--warn); }
.step[data-status='completed'] .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step[data-status='skipped'] .step-dot { border-style: dashed; }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 28px; }
.step-head h3 { margin: 0; }
.step-body { margin-top: 6px; color: var(--ink-2); font-size: 0.93rem; }

.progress { height: 8px; background: #ebe7de; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }

/* ---------- Definition lists ---------- */
.info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 0.93rem; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Admin table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar input[type='search'] { flex: 1 1 240px; }
.toolbar select { flex: 0 1 190px; width: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
td a { text-decoration: none; font-weight: 600; }
.cell-sub { display: block; color: var(--muted); font-size: 0.82rem; }
.mini-progress { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.mini-progress .progress { flex: 1; height: 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-family: var(--heading); font-weight: 700; font-size: 1.8rem; color: var(--brand); }
.stat span { font-size: 0.82rem; color: var(--muted); }

/* ---------- Admin detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.detail aside .card + .card { margin-top: 20px; }

.admin-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; background: var(--surface); }
.admin-step[data-status='completed'] { border-left: 4px solid var(--ok); }
.admin-step[data-status='in_progress'] { border-left: 4px solid var(--warn); }
.admin-step-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.admin-step-head h3 { margin: 0; }
.admin-step-head select { width: auto; padding: 6px 10px; font-size: 0.88rem; }
.admin-step .meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

.notes { list-style: none; margin: 12px 0 0; padding: 0; }
.note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; font-size: 0.92rem; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.note-meta .link-button { font-size: 0.78rem; }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.note-form textarea { min-height: 60px; }
.note-form .btn { align-self: flex-end; }

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

.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; color: var(--brand); text-decoration: underline; cursor: pointer; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; min-width: 0; }
.card-head .btn { flex-shrink: 0; }
.poc-foot { margin-top: 6px; min-height: 22px; }
.poc-editor { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.poc-list { list-style: none; margin: 0 0 12px; padding: 0; }
.poc-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.poc-list li:last-child { border-bottom: 0; }
.poc-list .empty-note { color: var(--muted); }
.poc-add { display: flex; gap: 8px; }
.poc-add input { flex: 1; min-width: 0; }
.status-row select { width: auto; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.loading { color: var(--muted); padding: 24px 0; }

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

/* ---------- Step actions (dashboard + admin) ---------- */
.step-action { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }

/* ---------- Application form ---------- */
.app-intro p:last-child { margin-bottom: 0; }
.app-section h2 { margin-bottom: 6px; }
.section-note { color: var(--muted); font-size: 0.9rem; margin-bottom: 14px; }
.app-questions { display: flex; flex-direction: column; gap: 26px; margin-top: 18px; }
.app-section .info + .app-questions { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

.q { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.q-label { font-weight: 600; color: var(--ink); padding: 0; line-height: 1.45; }
.q-num { color: var(--brand); font-family: var(--heading); font-weight: 700; }
.q .hint { margin: -4px 0 0; font-size: 0.85rem; color: var(--muted); }
.q textarea { min-height: 110px; field-sizing: content; }
.q-detail { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding-left: 14px; border-left: 3px solid var(--brand-soft); }
.q-detail textarea { min-height: 80px; }
.q-error { margin: 0; color: var(--danger); font-size: 0.85rem; font-weight: 600; }
.q-missing { background: var(--danger-soft); outline: 8px solid var(--danger-soft); border-radius: 4px; }

.yesno { display: flex; gap: 24px; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }
.radio { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.radio input { margin: 4px 0 0; width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--brand); }

.uploads { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.file-btn.is-busy { opacity: 0.6; pointer-events: none; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 0.92rem; }
.file-list a { font-weight: 600; overflow-wrap: anywhere; }

/* Read-only answers */
.answers { list-style: none; margin: 0; padding: 0; counter-reset: answer; }
.answer { counter-increment: answer; padding: 14px 0; border-bottom: 1px solid var(--line); }
.answer:last-child { border-bottom: 0; padding-bottom: 0; }
.answer-q { font-weight: 600; margin-bottom: 6px; }
.answer-q::before { content: counter(answer) '. '; color: var(--brand); font-family: var(--heading); font-weight: 700; }
.answer-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.answer-empty { color: var(--muted); font-style: italic; margin-bottom: 0; }

/* Save bar */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(60, 35, 33, 0.08); }
.savebar-inner { max-width: 720px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.savebar-text { display: flex; flex-direction: column; font-size: 0.85rem; line-height: 1.4; min-width: 0; }
.save-error { color: var(--danger); font-weight: 600; }
body.has-savebar { padding-bottom: 90px; }
@media (max-width: 560px) { .savebar-inner { padding: 10px 16px; } .savebar .btn { padding: 10px 14px; } }

.head-actions { display: flex; gap: 8px; }

/* ---------- Print (admin application view) ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .site-header, .no-print, .savebar, .alert { display: none !important; }
  main { padding: 0; }
  .narrow { max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; margin-top: 18pt !important; }
  .app-section { break-inside: auto; }
  .answer { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
