:root {
  --ink: #1b2333;
  --muted: #566176;
  --paper: #f4f6fa;
  --surface: #ffffff;
  --line: #d3dbe8;
  --teal: #22559e;
  --teal-dark: #1f3254;
  --tint: #e6edf7;
  --ok: #1b7f4b;
  --err: #b42318;
  --err-tint: #fdecea;
  --radius: 8px;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #f2a900; outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 50; }

/* ---------- brand header ---------- */
.brandbar { background: #fff; border-bottom: 3px solid var(--teal); }
.brandbar .in { max-width: none; margin: 0 auto; padding: 10px clamp(16px, 3vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brandbar img { height: 44px; width: auto; display: block; }
.brandbar .meta { color: var(--muted); font-size: .9rem; display: flex; gap: 18px; align-items: center; }
.brandbar a { color: var(--teal); font-weight: 600; text-decoration: none; }
.brandbar a:hover { text-decoration: underline; }

/* ---------- landing ---------- */
.hero { background: var(--teal-dark); color: #fff; }
.hero .in { max-width: none; margin: 0 auto; padding: 64px clamp(16px, 3vw, 48px) 112px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.8rem); letter-spacing: -0.02em; font-weight: 600; }
.hero .period { margin: 16px 0 0; color: #b9c8e2; font-size: 1.15rem; }
.landing { max-width: none; margin: -64px auto 0; padding: 0 clamp(16px, 3vw, 48px) 56px; }
.entries { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.entry { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--teal); border-radius: var(--radius); padding: 26px 26px 28px; box-shadow: 0 10px 28px rgba(31, 50, 84, .14); transition: transform .15s, box-shadow .15s; }
.entry:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(31, 50, 84, .2); }
.entry h2 { font-size: 1.35rem; font-weight: 600; color: var(--teal-dark); }
.entry p { margin: 10px 0 0; color: var(--muted); }
.entry .go { display: inline-block; margin-top: 20px; font-weight: 600; color: #fff; background: var(--teal); padding: 10px 18px; border-radius: 6px; }
.entry:hover .go { background: var(--teal-dark); }
.notes { margin: 36px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.sitefoot { text-align: left; padding-left: clamp(16px, 3vw, 48px) !important; color: var(--muted); font-size: .85rem; padding: 0 16px 32px; }

/* ---------- form shell ---------- */
.demo { background: #fff4d6; color: #5c4400; border-bottom: 1px solid #ecd48a; text-align: center; padding: 8px 16px; font-size: .92rem; }

.shell { max-width: none; margin: 0 auto; padding: 24px clamp(16px, 3vw, 48px) 80px; display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .shell { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; } }

.progress { position: sticky; top: 0; z-index: 10; background: var(--paper); padding: 10px 0; }
@media (min-width: 900px) { .progress { top: 16px; align-self: start; padding: 0; } }
.progress ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; }
@media (min-width: 900px) { .progress ol { flex-direction: column; gap: 2px; overflow: visible; } }
.progress a { display: flex; gap: 8px; align-items: center; white-space: nowrap; text-decoration: none; color: var(--muted); padding: 7px 10px; border-radius: var(--radius); font-size: .93rem; border: 1px solid transparent; }
.progress a:hover { background: var(--tint); }
.progress a.current { color: var(--ink); font-weight: 700; border-color: var(--line); background: var(--surface); }
.progress .tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 11px; color: #fff; }
.progress a.complete .tick { background: var(--ok); border-color: var(--ok); }
.progress a.complete .tick::after { content: "✓"; }
.draft-note { font-size: .82rem; color: var(--muted); margin-top: 10px; display: none; }
@media (min-width: 900px) { .draft-note { display: block; } }

.formhead h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.01em; font-weight: 600; color: var(--teal-dark); }
.formhead p { color: var(--muted); max-width: 110ch; margin: 8px 0 0; }

.sec { margin-top: 44px; padding-top: 22px; border-top: 3px solid var(--teal); scroll-margin-top: 70px; }
.sec > h2 { font-size: 1.3rem; font-weight: 600; color: var(--teal-dark); }
.sec > .hint { color: var(--muted); margin: 6px 0 0; max-width: 110ch; }

.field { margin-top: 24px; max-width: none; }
.field.wide { max-width: none; }
.field > label, .field > .q { display: block; font-weight: 600; }
.field .sub { display: block; font-weight: 400; color: var(--muted); font-size: .93rem; margin-top: 2px; }
.req { color: var(--err); margin-left: 3px; }

.grid2 { display: grid; gap: 4px 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); max-width: none; }
.grid2 .field { max-width: none; }

input[type=text], input[type=date], textarea, select {
  width: 100%; margin-top: 8px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid #9fb0b5; border-radius: var(--radius); padding: 10px 12px;
}
textarea { min-height: 108px; resize: vertical; }
input:hover, textarea:hover { border-color: var(--teal); }
input:focus, textarea:focus { border-color: var(--teal); }
input[readonly] { background: #eef2f3; color: var(--muted); }

.err-msg { display: none; color: var(--err); font-size: .9rem; margin-top: 6px; font-weight: 600; }
.field.invalid .err-msg { display: block; }
.field.invalid input[type=text], .field.invalid textarea, .field.invalid input[type=date] { border-color: var(--err); background: var(--err-tint); }
.field.invalid .scale label { border-color: var(--err); }

/* rating scale */
.scale { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; position: relative; }
.scale input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.scale label {
  min-width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer;
  border: 1.5px solid #9fb0b5; border-radius: var(--radius); background: var(--surface);
  font-weight: 700; font-size: 1.05rem; user-select: none; transition: background .12s, color .12s;
}
.scale label:hover { background: var(--tint); border-color: var(--teal); }
.scale input:checked + label { background: var(--teal); border-color: var(--teal); color: #fff; }
.scale input:focus-visible + label { outline: 3px solid #f2a900; outline-offset: 2px; }
.scale.yn label { min-width: 84px; }
.scale-cap { margin-top: 6px; font-size: .9rem; color: var(--muted); min-height: 1.4em; }

/* matrix rows (supervisor) */
.row { margin-top: 26px; padding: 18px 0 4px 18px; border-left: 4px solid var(--tint); max-width: none; }
.row > h3 { font-size: 1.05rem; }
.row > .prompt { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.row .pair { display: grid; gap: 0 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.row .field { margin-top: 16px; max-width: none; }
.row textarea { min-height: 84px; }

/* guide */
details.guide { margin-top: 20px; max-width: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.guide summary { cursor: pointer; padding: 12px 16px; font-weight: 600; }
details.guide dl { margin: 0; padding: 0 16px 14px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
details.guide dt { font-weight: 700; }
details.guide dd { margin: 0; color: var(--muted); }

.declare { display: flex; gap: 10px; align-items: flex-start; margin-top: 24px; max-width: none; }
.declare input { width: 22px; height: 22px; margin-top: 3px; flex: none; }

.actions { margin-top: 40px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
button.primary { font: inherit; font-weight: 700; background: var(--teal); color: #fff; border: 0; border-radius: var(--radius); padding: 14px 28px; cursor: pointer; }
button.primary:hover { background: var(--teal-dark); }
button.primary:disabled { opacity: .6; cursor: wait; }
button.ghost { font: inherit; background: none; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 18px; cursor: pointer; color: var(--ink); }
.banner-err { display: none; margin-top: 20px; padding: 12px 16px; background: var(--err-tint); border-left: 5px solid var(--err); max-width: none; font-weight: 600; }
.banner-err.show { display: block; }

.done { max-width: 620px; margin: 64px auto; padding: 0 16px; }
.done h1 { font-size: 2rem; }
.done .ref { display: inline-block; margin: 14px 0; padding: 8px 14px; background: var(--tint); border-radius: var(--radius); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .progress, .actions, .brandbar, .demo { display: none; } .sec { break-inside: avoid; } }

/* sections without an explicit grid: short controls flow side by side, long answers span the row */
.sec > div:not(.grid2):not(.row) { display: grid; gap: 0 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.sec > div:not(.grid2):not(.row) > .field[data-type="textarea"],
.sec > div:not(.grid2):not(.row) > .field[data-type="yesno"] { grid-column: 1 / -1; }
.sec > div:not(.grid2):not(.row) > .field[data-type="scale"] { grid-column: auto; }
.shell > * { min-width: 0; }

/* align labels, inputs and error lines across a row even when a label wraps */
.grid2 { row-gap: 0; }
.grid2 > .field { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 0; align-content: start; }
