:root {
  --ink: #1a1a1a;
  --muted: #6a6a6a;
  --rule: #e2dfd8;
  --bg: #faf7f0;
  --card: #ffffff;
  --accent: #5a3a1e;
  --accent-hover: #3e2712;
  --success-bg: #e8f4ea;
  --success-ink: #1f5f2a;
  --error-bg: #fdeceb;
  --error-ink: #8a2a2a;
  --warn-bg: #fff4d5;
  --warn-ink: #7a5d00;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 22px 80px;
}

.page.centered { text-align: center; padding-top: 60px; }

.hero { text-align: center; margin-bottom: 28px; }

.logo {
  max-width: 170px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
  border-radius: 10px;
}
.logo.big { max-width: 220px; margin-bottom: 28px; }

h1 {
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: 0.3px;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0 0 20px;
}

.lead {
  background: #fff6f0;
  border: 1px solid #e8d6c6;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--error-ink);
  font-size: 13px;
  margin: 0;
}

.notice {
  padding: 14px 16px;
  border-radius: 8px;
  margin: 18px 0;
  font-size: 14px;
  border: 1px solid transparent;
}
.notice.success {
  background: var(--success-bg);
  border-color: #a9d8b1;
  color: var(--success-ink);
}
.notice.error {
  background: var(--error-bg);
  border-color: #e6b9b6;
  color: var(--error-ink);
}
.notice-sub { font-weight: 400; font-size: 13px; margin-top: 4px; }

.agreement {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 26px;
  margin: 24px 0;
}
.agreement h2 {
  font-size: 14px;
  margin: 20px 0 6px;
  color: var(--accent);
  letter-spacing: 0.3px;
}
.agreement h2:first-child { margin-top: 0; }
.agreement p {
  margin: 6px 0;
  font-size: 14px;
  color: #2b2b2b;
}
.agreement p.bullet {
  margin-left: 14px;
  position: relative;
  padding-left: 14px;
}
.agreement p.bullet::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.sign-form {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px 26px;
  margin: 24px 0;
}
.form-title {
  font-size: 18px;
  margin: 0 0 18px;
  color: var(--accent);
}

fieldset.role-pick {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 0 0 16px;
  background: #fafaf2;
}
fieldset.role-pick legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.role-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.role-opt:hover { border-color: var(--accent); }
.role-opt input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
.role-opt span {
  display: flex;
  flex-direction: column;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin: 0;
  color: var(--ink);
}
.role-opt span strong { font-size: 15px; margin-bottom: 2px; }
.role-opt span small { color: var(--muted); font-size: 12px; }
.role-opt:has(input:checked) { border-color: var(--accent); background: #fffdf6; }

.guest-only {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 14px;
  margin: 6px 0 10px;
}
.guest-only label { margin-bottom: 12px; display: block; }

.headshot-field input[type=file] {
  padding: 8px;
  border: 1px dashed #cfc9bd;
  border-radius: 7px;
  background: #fffdf8;
  width: 100%;
  font: inherit;
}
.headshot-field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  font-style: italic;
}
.headshot-preview {
  margin-top: 10px;
}
.headshot-preview img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  object-fit: cover;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }

label { display: block; }
label > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type=text], input[type=email], input[type=tel] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfc9bd;
  border-radius: 7px;
  background: #fffdf8;
  font: inherit;
  color: var(--ink);
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 58, 30, 0.15);
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fafaf2;
  margin: 6px 0 16px;
  cursor: pointer;
}
label.check input { margin-top: 3px; width: 18px; height: 18px; flex-shrink: 0; }
label.check span {
  font-size: 14px;
  line-height: 1.45;
  color: #333;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin: 0;
}

label.signature small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
  font-style: italic;
}
label.signature input {
  font-family: "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: 26px;
  padding: 10px 12px;
}

button[type=submit] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.12s ease;
}
button[type=submit]:hover:not(:disabled) { background: var(--accent-hover); }
button[type=submit]:disabled { opacity: 0.8; cursor: default; }
.submit-spin { display: inline-flex; align-items: center; gap: 10px; }
.submit-spin[hidden] { display: none; }
.headshot-preview[hidden] { display: none; }
.preview-wrap[hidden] { display: none; }
.two-choices[hidden] { display: none; }
.notice[hidden] { display: none; }
.spouse-fields[hidden] { display: none; }
.member-only[hidden], .guest-only[hidden] { display: none; }
.mini-spinner {
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 22px 0 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.big-lead { font-size: 19px; color: #333; margin: 0 0 24px; }
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 22px;
  max-width: 480px;
  margin: 0 auto 24px;
  text-align: left;
}
.card p { margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.footnote { color: var(--muted); font-size: 13px; }

.admin { max-width: 1100px; }
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}
.admin-head h1 { font-size: 24px; }
.actions { display: flex; gap: 10px; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.secondary:hover { background: #faf3ec; }

.searchbox { margin: 12px 0 18px; }
.searchbox input {
  width: 100%;
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid #cfc9bd;
  border-radius: 7px;
  background: #fff;
  font: inherit;
}

table.signers {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}
table.signers th, table.signers td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
}
table.signers th {
  background: #f5f0e4;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
table.signers tr:last-child td { border-bottom: 0; }
table.signers a { color: var(--accent); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge.ok { background: var(--success-bg); color: var(--success-ink); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.guest { background: #e9eefa; color: #1f3e82; }
.badge.honorary { background: #f3e7d4; color: #7a5d00; }

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 10px;
}
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pill:hover { background: #faf3ec; }
.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.filter-actions {
  display: flex;
  gap: 8px;
}
.sep { color: var(--rule); padding: 0 4px; }

.dlg {
  border: 0;
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  max-width: 460px;
  width: 92%;
}
.dlg::backdrop { background: rgba(0,0,0,0.35); }
.dlg {
  position: relative;
}
.dlg-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.dlg-close:hover {
  background: #faf3ec;
  color: var(--accent);
}
.dlg-form {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dlg-form h2 {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 20px;
}
.dlg-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfc9bd;
  border-radius: 7px;
  background: #fffdf8;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, "Menlo", monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 140px;
}
.dlg-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfc9bd;
  border-radius: 7px;
  background: #fffdf8;
  font: inherit;
}
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.dlg-form .role-pick.compact {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  margin: 0;
}
.dlg-form .role-pick.compact .role-opt { margin-top: 0; flex: 1; min-height: 0; padding: 8px; }
.dlg-form .role-pick.compact .role-opt span strong { font-size: 13px; }

.role-pick.compact {
  padding: 8px 12px 10px;
}
.role-pick.compact .role-opt.tight {
  display: inline-flex;
  margin-top: 6px;
  margin-right: 6px;
  padding: 6px 12px;
  min-height: 0;
}
.role-pick.compact .role-opt.tight span strong { font-size: 14px; }
.role-pick.compact .role-opt.tight span small { display: none; }

.spouse-fields {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 14px;
  margin: 6px 0 10px;
}

.thumb {
  display: inline-block;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: #eee;
  text-align: center;
  line-height: 44px;
  color: #999;
  vertical-align: middle;
}
.thumb.placeholder { font-weight: 700; }

.btn-mini {
  display: inline-block;
  padding: 4px 10px;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-mini:hover:not(:disabled) { background: #faf3ec; }
.btn-mini:disabled { opacity: 0.5; cursor: default; }
.btn-mini.danger {
  color: #8a2a2a;
  border-color: #d4a7a3;
}
.btn-mini.danger:hover:not(:disabled) { background: #fdeceb; }

.row-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

table.signers.compact th,
table.signers.compact td {
  padding: 8px 10px;
  vertical-align: middle;
  font-size: 13.5px;
}
table.signers.compact th {
  font-size: 11px;
  color: var(--muted);
  background: #f5f0e4;
  border-bottom: 1px solid var(--rule);
}

.col-photo { width: 48px; padding-right: 0 !important; }
.col-role { width: 110px; }
.col-contact { min-width: 180px; max-width: 260px; }
.col-contact a { word-break: break-all; }
.col-signed { width: 170px; color: var(--muted); }
.pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
  font-weight: 500;
}
.pdf-link:hover { text-decoration: underline; }
.pdf-icon {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}
.check.tight {
  padding: 10px 12px;
  margin: 4px 0;
}
.check.tight.stacked { margin-top: 22px; }
.check.tight span {
  font-size: 13px;
}

.linked-family {
  background: #fffaf1;
  border: 1px solid #e8d6c6;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 6px 0 4px;
}
.linked-family[hidden] { display: none; }
.fam-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}
.fam-row {
  margin: 6px 0;
  font-size: 13.5px;
}
.fam-label {
  display: inline-block;
  min-width: 72px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: top;
}
.fam-kids {
  margin: 4px 0 0 78px;
  padding: 0;
  list-style: none;
}
.fam-kids li { padding: 2px 0; }
.col-actions { width: 130px; text-align: right; }

.name-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.name-line strong { font-size: 14px; }
a.name-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
a.name-link:hover { color: var(--accent); text-decoration: underline; }
.gender-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}
.gender-dot.m { background: #3e608c; }
.gender-dot.w { background: #a25577; }

.sub {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
  line-height: 1.35;
}
.sub .muted { color: var(--muted); }

.badge.muted-badge { background: #eee; color: var(--muted); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.icon-btn:hover:not(:disabled) {
  background: #faf3ec;
  border-color: var(--accent);
}
.icon-btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn.danger {
  color: #8a2a2a;
  border-color: #e6b9b6;
}
.icon-btn.danger:hover:not(:disabled) { background: #fdeceb; }

.thumb.placeholder.has-action {
  border-style: dashed;
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
}
.thumb.placeholder.has-action:hover { background: #faf3ec; }

.filter-tabs .pill {
  padding: 4px 12px;
  font-size: 12px;
}
.filter-bar {
  margin: 12px 0 6px;
}
.searchbox { margin: 6px 0 14px; }

.upload-body { background: var(--bg); }
.upload-page { max-width: 520px; padding-top: 40px; padding-bottom: 60px; }
.small { font-size: 13px; }

.selfie-stage {
  margin: 22px auto 0;
  max-width: 420px;
}
.selfie-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.selfie-step[hidden] { display: none; }

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.two-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
@media (max-width: 420px) {
  .two-choices { grid-template-columns: 1fr; }
}

.big-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 14px;
  border: 2px solid var(--accent);
  border-radius: 16px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, transform 0.08s ease, box-shadow 0.12s ease;
  font: inherit;
  box-shadow: 0 2px 6px rgba(90, 58, 30, 0.08);
  min-height: 140px;
}
.big-choice:hover {
  background: #fffaf1;
  box-shadow: 0 4px 10px rgba(90, 58, 30, 0.15);
}
.big-choice:active { transform: translateY(1px); }
.big-choice svg { color: var(--accent); }
.big-choice-label {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.big-choice-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.video-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
#cam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.flip-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shutter {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.2);
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px var(--accent), 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.08s ease;
}
.shutter:active { transform: scale(0.93); }
.shutter-inner {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
}

.link-btn {
  background: transparent;
  border: 0;
  padding: 8px 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
}
.link-btn:hover { color: var(--accent); }

.preview-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: #eee;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
#preview { width: 100%; height: 100%; object-fit: cover; display: block; }

.preview-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
}
.preview-actions .btn {
  padding: 14px 22px;
  font-size: 16px;
  width: 100%;
  text-align: center;
}

.spinner {
  width: 54px;
  height: 54px;
  border: 5px solid #eee;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--rule);
  border-radius: 10px;
}
