:root {
  --ink: #17262b;
  --muted: #5b6b70;
  --paper: #f4f6f5;
  --card: #ffffff;
  --line: #d6dedb;
  --green: #1b7a4b;
  --green-dark: #135a38;
  --blue: #1f5f8b;
  --error: #b3261e;
  --error-bg: #fdf1f0;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.55;
}
h1, h2 { font-family: "Fraunces", Georgia, serif; line-height: 1.2; margin: 0; }
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.muted { color: var(--muted); font-size: .9rem; }

/* Masthead */
.masthead { background: var(--ink); color: #fff; }
.masthead-inner { max-width: 860px; margin: 0 auto; padding: 36px 20px 30px; }
.institution { margin: 0 0 14px; font-size: .9rem; opacity: .8; }
.masthead h1 { font-size: clamp(1.5rem, 4.2vw, 2.4rem); font-weight: 700; max-width: 24ch; max-width: 30em; }
.sub { margin: 14px 0 0; opacity: .75; font-size: .95rem; }
.flag-strip { display: flex; height: 6px; }
.flag-strip span { flex: 1; }
.flag-strip span:nth-child(1) { background: #1eb53a; }
.flag-strip span:nth-child(2) { background: #fff; }
.flag-strip span:nth-child(3) { background: #0072c6; }

/* Layout */
.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 80px; }
.progress-wrap { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: 10px 0 8px; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
#progressBar { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.step-label { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 16px; }
.card h2 { font-size: 1.4rem; margin-bottom: 12px; }
.card p { margin: 0 0 12px; max-width: 70ch; }

.section-head { margin: 8px 0 18px; }
.section-head h2 { font-size: 1.6rem; }
.definition { margin: 10px 0 0; color: var(--muted); max-width: 70ch; }
.lead { margin: 14px 0 0; font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); margin-bottom: 14px; }

/* Questions */
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.q-card.error { border-color: var(--error); background: var(--error-bg); }
.card .q-card { margin-bottom: 0; padding: 0; border: 0; background: none; }
.q-label { margin: 0 0 10px; font-weight: 500; }
.qnum { display: inline-block; min-width: 2.4em; color: var(--blue); font-weight: 600; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input, .pill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; transition: background .12s, border-color .12s;
}
.choice:hover span { border-color: var(--green); }
.choice input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.choice input:focus-visible + span, .pill input:focus-visible ~ .pill-num { outline: 3px solid var(--blue); outline-offset: 2px; }

.scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pill { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; transition: background .12s, border-color .12s; }
.pill:hover { border-color: var(--green); }
.pill-num { font-weight: 600; }
.pill-text { font-size: .72rem; color: var(--muted); line-height: 1.2; margin-top: 2px; }
.pill:has(input:checked) { background: var(--green); border-color: var(--green); color: #fff; }
.pill:has(input:checked) .pill-text { color: #e4f3ea; }

/* Nav */
.nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.btn { font: inherit; font-weight: 600; padding: 11px 22px; border: 1px solid var(--green); background: var(--green); color: #fff; border-radius: 8px; cursor: pointer; }
.btn:hover { background: var(--green-dark); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: #e6f1ec; }
.btn.small { padding: 7px 14px; font-size: .9rem; }
.error-msg { color: var(--error); background: var(--error-bg); border: 1px solid var(--error); border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; }

@media (max-width: 620px) {
  .scale { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Admin */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 80px; }
.login-card { max-width: 400px; margin: 10vh auto 0; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 500; margin-bottom: 4px; }
.field input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.field input:focus { outline: 3px solid var(--blue); outline-offset: 1px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.topbar h1 { font-size: 1.5rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.stat .num { font-family: "Fraunces", Georgia, serif; font-size: 2.4rem; font-weight: 700; line-height: 1; }
.stat .lbl { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.panel h2 { font-size: 1.15rem; margin-bottom: 12px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .92rem; }
.bar { height: 10px; background: #e6ece9; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
