:root {
  --brand: #2f6cb5;          /* MSJ logo blue */
  --brand-dark: #1f4f8a;
  --brand-soft: #eaf1fa;
  --accent: #c9a24a;         /* warm gold, complements the logo */
  --ink: #1b2533;
  --muted: #5d6b7e;
  --line: #dde4ee;
  --bg: #f4f7fb;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 37, 66, .06), 0 8px 24px rgba(16, 37, 66, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
.wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
[hidden] { display: none !important; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 28px 0 64px;
}
.header-inner { display: flex; align-items: center; gap: 18px; }
.logo {
  width: 92px; height: auto; flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.18));
}
.eyebrow { display: block; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.site-header h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.2; font-weight: 650; }

main.wrap { margin-top: -40px; padding-bottom: 32px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid rgba(221,228,238,.7);
}
.intro { border-left: 4px solid var(--accent); }
.intro p:first-child { margin-top: 0; font-size: 17px; }
.intro p:last-child { margin-bottom: 0; }
.intro strong { color: var(--brand-dark); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.req { color: var(--danger); font-weight: 600; }
.optional { color: var(--muted); font-weight: 400; font-size: 14px; }

/* Questions */
fieldset.q { border: 0; margin: 0 0 8px; padding: 0 0 24px; border-bottom: 1px solid var(--line); min-width: 0; }
fieldset.q + fieldset.q { padding-top: 22px; }
fieldset.q:last-of-type { border-bottom: 0; }
legend { font-weight: 600; font-size: 17px; padding: 0; margin-bottom: 14px; display: flex; gap: 10px; line-height: 1.4; float: left; width: 100%; }
legend + * { clear: both; }
.num {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-size: 14px; font-weight: 700;
}
.small-num { width: 22px; height: 22px; font-size: 12px; margin-right: 6px; vertical-align: middle; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 14px; clear: both; }

.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: 14px; font-weight: 600; color: #334155; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; clear: both; }
.grid-2 .field { margin-bottom: 0; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  border: 1px solid #cdd6e2; border-radius: 10px; padding: 11px 13px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,108,181,.18); }
.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important; }

.checks { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; clear: both; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-block; padding: 9px 16px; border-radius: 999px;
  border: 1px solid #cdd6e2; background: #fff; font-size: 15px; user-select: none;
  transition: all .15s;
}
.chip:hover span { border-color: var(--brand); }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(47,108,181,.3); }

.task {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  margin-bottom: 14px; background: #fafcfe;
}
.task-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.task-title { font-weight: 650; color: var(--brand-dark); font-size: 15px; }
.task .grid-2 { margin-top: 12px; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  padding: 12px 22px; border: 1px solid transparent; transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .65; cursor: progress; }
.btn-ghost { background: #fff; color: var(--brand); border-color: #bcd0ea; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: #fff; color: var(--danger); border-color: #efc5c0; }
.btn-danger:hover { background: #fdf0ee; }
.btn-sm { padding: 7px 12px; font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--danger); font: inherit; font-size: 14px; cursor: pointer; padding: 4px; }

.submit-area { padding-top: 22px; border-top: 1px solid var(--line); }
.closing { font-style: italic; color: var(--muted); margin: 0 0 16px; }
.submit-area .btn-primary { width: 100%; font-size: 17px; padding: 14px; }
.alert { background: #fdf0ee; color: #8e2a1f; border: 1px solid #efc5c0; padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 15px; }

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.thanks { text-align: center; padding: 48px 28px; outline: none; }
.thanks h2 { margin: 10px 0 8px; color: var(--brand-dark); }
.tick {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto;
  background: var(--brand-soft); color: var(--brand); font-size: 32px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.site-footer { padding: 8px 0 36px; text-align: center; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--brand); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }

/* Admin */
.admin-main { margin-top: -40px; }
.login-card { max-width: 420px; margin-left: auto; margin-right: auto; }
.login-card h2 { margin-top: 0; }
.login-card .btn-primary { width: 100%; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.toolbar h2 { margin: 0; font-size: 20px; }
.toolbar .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.count-badge { display: inline-block; background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 2px 12px; font-size: 15px; margin-left: 8px; vertical-align: middle; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.sub { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.sub > summary {
  list-style: none; cursor: pointer; padding: 14px 16px;
  display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 12px; align-items: center;
}
.sub > summary::-webkit-details-marker { display: none; }
.sub > summary:hover { background: #f8fafd; }
.sub[open] > summary { border-bottom: 1px solid var(--line); background: #f8fafd; }
.sub .s-name { font-weight: 650; }
.sub .s-meta { color: var(--muted); font-size: 14px; }
.sub .s-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.sub-body { padding: 16px; }
.answer { margin-bottom: 14px; }
.answer h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.answer p, .answer div { margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.answer table { width: 100%; border-collapse: collapse; font-size: 15px; }
.answer th, .answer td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: pre-wrap; }
.answer th { font-size: 13px; color: var(--muted); font-weight: 600; }
.sub-actions { display: flex; justify-content: flex-end; padding-top: 6px; }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .site-header { padding: 22px 0 56px; }
  .site-header h1 { font-size: 22px; }
  .logo { width: 60px; }
  .card { padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  legend { font-size: 16px; }
  .sub > summary { grid-template-columns: 1fr; gap: 2px; }
}
