:root {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #172333;
  background: #fff;
  --navy: #102742;
  --blue: #244b76;
  --red: #ac253b;
  --muted: #526175;
  --line: #dbe2eb;
  --selected: #eef4fa;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
a { color: var(--navy); }
button:disabled { cursor: default; opacity: .62; }
:where(button, input, a, summary, .table-wrap):focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.panel h1:focus { outline: 3px solid var(--blue); outline-offset: 4px; border-radius: 2px; }

.shell { width: 100%; max-width: 680px; margin-inline: auto; padding-inline: 24px; }
.masthead { background: var(--navy); color: #fff; }
.topbar { max-width: 1140px; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 62px; }
.brand { color: #fff; text-decoration: none; font-size: 1.025rem; font-weight: 740; letter-spacing: -.02em; }
.brand:focus-visible { outline-color: #fff; }
.brand-light { font-weight: 560; }
.access { font-size: .81rem; color: #e2eaf3; }
main.shell { padding-top: clamp(36px, 8vw, 80px); padding-bottom: 36px; }
main.shell:has(.entry) { max-width: 488px; }

.steps { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 4px; list-style: none; padding: 0; margin: 0 0 26px; }
.steps li { padding-bottom: 5px; color: var(--muted); font-size: .8rem; }
.steps li.active { border-bottom: 2px solid var(--red); font-weight: 720; color: var(--navy); }
.panel { overflow-wrap: anywhere; }
.panel h1 { color: var(--navy); font-size: clamp(1.9rem, 7vw, 2.65rem); line-height: 1.12; letter-spacing: -.04em; margin: 0 0 12px; font-weight: 750; }
.panel p { margin: 0 0 14px; }
.entry::before { content: ""; display: block; width: 30px; height: 3px; background: var(--red); margin-bottom: 16px; }
.lede { color: var(--muted); max-width: 58ch; }
.helper, .notice { font-size: .9rem; color: var(--muted); }
.notice { margin-top: 22px; }
.notice code { display: block; margin-top: 3px; color: var(--navy); font-size: 1.3rem; letter-spacing: .055em; }
.problem { border-left: 3px solid var(--red); padding: 4px 0 4px 12px; margin-top: 14px; color: #93263b; }
.actions { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 18px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 15px;
  border-radius: 5px; border: 1px solid #aab7c6; color: var(--navy); background: #fff;
  font-weight: 690; line-height: 1.2; text-decoration: none;
}
.button:hover { background: #f1f5f9; }
.primary { color: #fff; border-color: var(--navy); background: var(--navy); }
.primary:hover { color: #fff; border-color: var(--blue); background: var(--blue); }
.text-button {
  background: transparent; border: 0; color: var(--navy); padding: 8px 0; min-height: 44px;
  text-decoration: underline; text-underline-offset: 3px; font-weight: 640;
}
.actions .text-button { padding-inline: 3px; }
.device-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.device-options .button { min-height: 52px; }
.contact-steps { padding-inline-start: 22px; margin: 0 0 18px; }
.contact-steps li { margin-bottom: 6px; padding-inline-start: 2px; }
details { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { color: var(--navy); font-weight: 680; padding-bottom: 8px; }
details p { font-size: .9rem; }
.eyebrow { color: var(--muted); font-size: .81rem; font-weight: 690; }
.choice-heading { display: block; color: var(--navy); font-weight: 720; margin: 20px 0 4px; }
.choices { display: grid; gap: 10px; margin: 12px 0; }
.choice {
  display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 12px;
  padding: 15px; border: 1px solid #bdc9d6; border-radius: 7px; background: #fff; cursor: pointer;
}
.choice strong { color: var(--navy); font-size: 1.04rem; }
.choice:has(input:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--selected); }
.candidate-options { min-inline-size: 0; border: 0; padding: 0; }
.candidate-card { border: 1px solid var(--line); border-radius: 7px; }
.candidate-card:has(input:checked) { border-color: var(--navy); background: var(--selected); }
.candidate-card .choice { border: 0; box-shadow: none; background: transparent; }
.candidate-address { display: block; margin-block: 4px; color: var(--navy); font-size: .9rem; }
main.shell:has(.candidate-compare) { max-width: 1000px; }
.candidate-compare { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.contact-summary, .match-observation { padding: 15px; background: #f3f6fa; border: 1px solid var(--line); border-radius: 8px; }
.candidate-compare .contact-summary { position: sticky; top: 12px; }
.contact-summary h2, #candidate-heading { color: var(--navy); font-size: 1rem; margin: 0 0 7px; }
.candidate-data { padding: 0 15px 14px; }
.candidate-data .record-badges { margin-top: 0; }
.candidate-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.candidate-facts:empty { display: none; }
.candidate-household { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.candidate-household h3 { color: var(--navy); font-size: .88rem; margin: 0 0 5px; }
.candidate-household p { margin: 0; }
.household-list { list-style: none; margin: 0; padding: 0; }
.household-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: .9rem; }
.household-list .record-chip { flex-shrink: 0; }
.match-observation { margin: 0 12px 12px; background: #fff; }
.assessment-question { padding: 0; margin: 0; border: 0; min-inline-size: 0; }
.assessment-question + .assessment-question { margin-top: 15px; }
.assessment-question legend { padding: 0; margin-bottom: 7px; color: var(--navy); font-size: .94rem; font-weight: 700; }
.assessment-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#catholic-community .assessment-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.assessment-option {
  display: flex; align-items: center; gap: 6px; text-align: left;
  min-width: 0; min-height: 44px; padding: 6px 8px; border: 1px solid #8294a8; border-radius: 6px;
  color: var(--navy); background: #fff; font-size: .875rem; font-weight: 600; line-height: 1.25;
  scroll-margin-bottom: 80px;
}
.assessment-option:hover { background: #f3f6fa; }
.assessment-option[aria-pressed="true"] { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--selected); }
.assessment-check {
  display: grid; place-items: center; flex: 0 0 16px; height: 16px; border: 1px solid #71849a;
  border-radius: 50%; color: transparent; font-size: 11px;
}
.assessment-option[aria-pressed="true"] .assessment-check { background: var(--navy); border-color: var(--navy); color: #fff; }
.candidate-actions { position: sticky; z-index: 1; bottom: 0; padding: 10px 0 max(10px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
#candidate-status:empty { display: none; }
.record-dialog {
  width: min(760px, calc(100% - 28px)); max-height: 90dvh; padding: clamp(14px, 4vw, 24px);
  border: 1px solid var(--line); border-radius: 12px; color: inherit; overflow-wrap: anywhere;
}
.record-dialog::backdrop { background: rgb(16 39 66 / .56); }
.details-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record-dialog h2 { color: var(--navy); margin: 0; }
.detail-item { margin-top: 8px; font-size: .9rem; }
.record-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 10px; }
.party-badge, .record-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: #edf2f7; color: #172f47; font-size: .82rem; font-weight: 650; }
.party-badge span { display: grid; place-items: center; width: 1.3em; height: 1.3em; border-radius: 50%; background: currentColor; }
.party-badge.republican { background: #fff0ee; color: #842329; }
.party-badge.democrat { background: #e8f1ff; color: #174985; }
.party-badge.republican span { background: #842329; color: #fff; }
.party-badge.democrat span { background: #174985; color: #fff; }
.record-detail-summary { padding: 14px; background: #f3f6fa; border-radius: 8px; margin-top: 14px; }
.record-detail-summary p, .record-detail-summary .record-badges { margin-bottom: 0; }
.record-section { border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; padding: 12px; }
.record-section summary { color: var(--navy); cursor: pointer; font-weight: 650; }
.record-section summary .record-chip { margin-inline-start: 6px; }
.record-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 0; }
.record-field-grid > div { border-top: 1px solid var(--line); padding-top: 8px; }
.record-field-grid dt { color: var(--muted); font-size: .82rem; }
.record-field-grid dd { margin: 2px 0 0; }
.directory-result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.choice:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 3px; }
.choice input:focus-visible { outline: none; }
.secondary-actions { margin-top: 8px; }
.correction { max-width: 700px; }
.current-record { display: grid; gap: 2px; background: #f3f6fa; border: 1px solid var(--line); border-radius: 7px; padding: 14px 16px; margin: 20px 0; }
.current-record .choice-heading { margin: 0 0 4px; font-size: .9rem; }
.current-record strong { color: var(--navy); }
.search-row { display: flex; align-items: end; gap: 12px; }
.search-row label { display: grid; flex: 1; min-width: 0; font-size: .9rem; font-weight: 670; gap: 6px; }
.search-status { min-height: 1.4em; margin-top: 10px !important; }
input:is([type=radio],[type=checkbox]) { accent-color: var(--navy); width: 19px; height: 19px; margin: 4px 0 0; }
.clue, .reason { display: block; color: var(--muted); font-size: .87rem; }
.verify { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: start; gap: 10px; padding: 7px 0; cursor: pointer; }
.footer { color: var(--muted); font-size: .78rem; margin: 26px 0 0; }
.footer:empty, .access:empty { display: none; }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { border-top: 1px solid var(--line); padding: 12px 0; }
.review-list .line { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.review-list .text-button { padding: 3px 0; }
.fields { display: grid; gap: 12px; max-width: 420px; }
.fields label { display: grid; font-size: .9rem; font-weight: 670; gap: 6px; }
input:not([type=radio],[type=checkbox],[type=file]) {
  color: inherit; min-width: 0; min-height: 46px; border: 1px solid #aab7c6; border-radius: 5px;
  padding: 9px 12px; font-size: 1rem;
}
#invite-entry { margin-top: 24px; }
#invite-entry .fields { max-width: none; }
#invite-entry .button { width: 100%; margin-top: 12px; }
#invite-entry input { font-family: "IBM Plex Mono", Consolas, monospace; letter-spacing: .035em; }
#invite-entry input::placeholder { color: #667589; opacity: 1; }
.panel .invite-help { margin: 16px 0 0; }
.panel:has(.invite-handoff) { max-width: 560px; }
.invite-card {
  margin-top: 22px; padding: clamp(16px, 4vw, 24px);
  border: 1px solid var(--line); border-radius: 8px; background: #f3f6fa;
}
.invite-card .fields { max-width: none; }
.invite-card .actions { margin-top: 12px; }
.panel .invite-status { margin: 0; }
.panel .invite-status:not(:empty) { margin-top: 12px; }
.invite-details {
  display: flex; flex-wrap: wrap; gap: 12px 32px;
  margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: .9rem;
}
.invite-details dt { color: var(--muted); font-size: .82rem; }
.invite-details dd { margin: 2px 0 0; font-weight: 650; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: .9rem; }
td, th { vertical-align: top; padding: 10px; border-bottom: 1px solid var(--line); }
th { color: var(--navy); background: #f3f6fa; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px 12px; }
.table-actions .text-button { min-height: 32px; padding-block: 1px; }
.admin.shell { max-width: 1140px; }
@media (max-width: 650px) {
  .candidate-compare { grid-template-columns: minmax(0, 1fr); }
  .candidate-compare .contact-summary { position: static; }
}
@media (max-width: 500px) {
  #catholic-community .assessment-options { grid-template-columns: minmax(0, 1fr); }
  #match-confidence .assessment-option { gap: 5px; padding-inline: 5px; }
  .record-field-grid { grid-template-columns: minmax(0, 1fr); }
  .shell { padding-inline: 20px; }
  .topbar { min-height: 54px; }
  .steps { column-gap: 12px; margin-bottom: 20px; }
  .actions .button { flex: 1 1 auto; }
  .search-row { align-items: stretch; flex-direction: column; }
}

@media (max-width: 375px) {
  #match-confidence .assessment-option { flex-direction: column; justify-content: center; text-align: center; padding-inline: 3px; }
  #match-confidence .assessment-check { flex: none; width: 16px; }
}
