/* LABAQ visual system.
   Instrument-panel structure (mono field codes, thin rules, tabular figures)
   softened with lilac washes, a Baskerville display face and generous space. */

:root {
  --paper:       #f7f4ef;
  --panel:       #fffdfa;
  --panel-alt:   #f3eef7;
  --ink:         #2e2438;
  --ink-muted:   #6e6478;
  --ink-faint:   #9c93a8;
  --rule:        #ded6e5;
  --rule-strong: #c6bad1;
  --accent:      #7b5ea7;
  --accent-soft: #ede4f6;
  --mint:        #4f9382;
  --mint-soft:   #e2f0ec;
  --apricot:     #c07a4e;
  --cranberry:   #a8435a;
  --shadow:      0 1px 2px rgba(46, 36, 56, .06), 0 14px 34px -18px rgba(46, 36, 56, .34);

  --display: "Hoefler Text", Baskerville, "Baskerville Old Face", Garamond, Georgia, serif;
  --body: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #171320;
    --panel:       #201a2b;
    --panel-alt:   #292236;
    --ink:         #ece5f3;
    --ink-muted:   #a89fb6;
    --ink-faint:   #7b7188;
    --rule:        #372e45;
    --rule-strong: #4a3f5c;
    --accent:      #b294e0;
    --accent-soft: #2d2440;
    --mint:        #6ec3ac;
    --mint-soft:   #1e3630;
    --apricot:     #dda077;
    --cranberry:   #dd7b91;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -20px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: center;
}

.masthead-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--accent);
}

.mark path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.mark circle { fill: currentColor; stroke: none; }

.identity { display: flex; flex-direction: column; gap: 1px; margin-right: auto; }

.wordmark {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .34em;
  margin: 0;
  line-height: 1.1;
}

.tagline {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0;
}

.masthead-actions { display: flex; align-items: center; gap: 10px; }

.build-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 4px 11px;
  white-space: nowrap;
}

/* ---------- shell ---------- */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 32px) 72px;
}

.shell--narrow { max-width: 620px; }

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 34px);
}

/* ---------- typography ---------- */

h1, h2, h3 { font-family: var(--display); font-weight: 600; text-wrap: balance; margin: 0; }

h1 { font-size: clamp(26px, 5vw, 34px); line-height: 1.14; }
h2 { font-size: clamp(20px, 3.4vw, 25px); line-height: 1.2; }
h3 { font-size: 18px; }

p { margin: 0 0 14px; max-width: 62ch; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

.lead { color: var(--ink-muted); }

.fine {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.75;
  letter-spacing: .04em;
  color: var(--ink-faint);
}

/* ---------- form controls ---------- */

.field { margin-bottom: 22px; }

.field-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}

.field-code {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 100px;
  padding: 3px 9px;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.field-label { font-weight: 600; font-size: 15.5px; line-height: 1.4; }

.field-help {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.control {
  width: 100%;
  font-family: var(--body);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color .16s, box-shadow .16s;
}

textarea.control { resize: vertical; min-height: 46px; }

.control::placeholder { color: var(--ink-faint); }

.control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field--invalid .control { border-color: var(--cranberry); }

.field-error {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--cranberry);
  margin-top: 6px;
}

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

.button {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 13px 22px;
  border-radius: 100px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fffdfa;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter .16s, background-color .16s;
}

.button:hover { filter: brightness(1.08); }

.button--ghost {
  background: transparent;
  color: var(--accent);
}

.button--ghost:hover { background: var(--accent-soft); filter: none; }

.button--quiet {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--rule-strong);
}

.button--quiet:hover { background: var(--panel-alt); filter: none; }

:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- notices ---------- */

.notice {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  padding: 12px 15px;
  margin-bottom: 20px;
  font-size: 14.5px;
}

.notice--error { border-left-color: var(--cranberry); color: var(--cranberry); }
.notice--good { border-left-color: var(--mint); background: var(--mint-soft); }

/* ---------- gate ---------- */

.gate { display: grid; place-items: center; min-height: 62vh; }

.gate-card { width: 100%; max-width: 430px; text-align: left; }

.gate-card .mark { width: 44px; height: 44px; margin-bottom: 16px; }

.gate-row { display: flex; gap: 10px; margin-top: 6px; }
.gate-row .control { flex: 1 1 auto; }

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

.form-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: start;
}

@media (max-width: 860px) {
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static !important; }
}

.rail {
  position: sticky;
  top: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}

.rail ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.rail a {
  display: flex;
  gap: 9px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 13.5px;
}

.rail a:hover { background: var(--panel-alt); color: var(--ink); }

.rail .rail-index {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.progress-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 5px;
  border-radius: 100px;
  background: var(--panel-alt);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 100px;
  transition: width .3s ease;
}

.form-section { margin-bottom: 40px; scroll-margin-top: 20px; }

.section-head {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 22px;
}

.section-head .lead { margin: 8px 0 0; font-size: 14.5px; }

.submit-bar {
  border-top: 1px solid var(--rule-strong);
  padding-top: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- confirmation ---------- */

.receipt {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  margin: 22px 0;
}

.receipt dt {
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 3px;
}

.receipt dd { margin: 0; font-variant-numeric: tabular-nums; }

.position { font-family: var(--display); font-size: 40px; line-height: 1; color: var(--accent); }

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

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}

.stat {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
}

.stat dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.stat dd {
  margin: 0;
  font-family: var(--display);
  font-size: 27px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.filter {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 6px 13px;
}

.filter:hover { background: var(--panel-alt); }
.filter[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fffdfa; }

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel); }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

th {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

td { padding: 13px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-alt); }

td.numeric { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }

td a { color: var(--ink); text-decoration: none; font-weight: 600; }
td a:hover { color: var(--accent); text-decoration: underline; }

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-radius: 100px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.chip--new { color: var(--accent); }
.chip--shortlisted { color: var(--apricot); }
.chip--rejected { color: var(--cranberry); }
.chip--accepted { color: var(--mint); }

.empty { padding: 46px 20px; text-align: center; color: var(--ink-muted); }

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(20px, 3vw, 32px);
  align-items: start;
}

@media (max-width: 900px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  .review-panel { position: static !important; }
}

.answer { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.answer:last-child { border-bottom: 0; }

.answer-question {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 7px;
}

.answer-question span:last-child { font-weight: 600; font-size: 14.5px; }

.answer-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--panel-alt);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  margin: 0;
  font-size: 15px;
}

.answer-text.is-blank { color: var(--ink-faint); font-style: italic; }

.review-panel { position: sticky; top: 24px; }

.review-panel label {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 16px 0 6px;
}

.status-options { display: flex; flex-direction: column; gap: 6px; }

.status-option {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 14px;
}

.status-option:hover { background: var(--panel-alt); }
.status-option input { accent-color: var(--accent); margin: 0; }
.status-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- colophon ---------- */

.colophon {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding: 20px clamp(16px, 4vw, 32px);
}

.colophon-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.inline-form { display: inline; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* Utilities kept at the end so they win over component spacing. */
.gate-note { margin-top: 18px; }
