/* Styled to match bsps4a.co.uk (WordPress / Elementor): Inter + Dancing Script, navy #183E89 / #012876, red #C02B31 */
:root {
  --navy: #183e89;
  --navy-dark: #012876;
  --red: #c02b31;
  --ink: #070707;
  --muted: #6e7a84;
  --line: #dfe3ea;
  --bg: #f5f7fb;
  --white: #fff;
  --green: #1e6b34;
  --green-dark: #17532a;
  --amber: #b45309;
  --amber-dark: #8f4207;
  --radius: 6px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.65 Inter,
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
}
.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}
a {
  color: var(--navy);
}

.site-header {
  background: var(--white);
  box-shadow: 0 6px 24px rgba(1, 40, 118, 0.08);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  border: 3px solid var(--red);
}
.brand-logo {
  display: block;
  height: 64px;
  width: auto;
}
.brand-text {
  font-weight: 700;
  color: var(--navy-dark);
  letter-spacing: 0.02em;
}
.site-header nav a {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}
.site-header nav a:hover {
  color: var(--navy);
}

main.wrap {
  padding: 32px 16px 48px;
}
h1,
h2 {
  color: var(--navy-dark);
  line-height: 1.2;
}
h1 {
  font-size: 28px;
  margin: 0 0 4px;
  font-weight: 700;
  text-transform: uppercase;
}
h2 {
  font-size: 20px;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.script {
  font-family: 'Dancing Script', cursive;
  color: var(--navy);
  font-size: 22px;
  margin: 0 0 12px;
}
.intro {
  margin-bottom: 24px;
}
.step {
  background: var(--navy);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.grid .full {
  grid-column: 1 / -1;
}
label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-dark);
}
.opt {
  font-weight: 400;
  color: var(--muted);
}
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='password'],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  border: 1px solid #c7cedb;
  border-radius: var(--radius);
  background: #fff;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
  border-color: var(--navy);
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  color: var(--ink);
  margin-top: 16px;
}
.check input {
  margin-top: 5px;
  width: 18px;
  height: 18px;
  flex: none;
}
.hint {
  color: var(--muted);
  margin-top: -8px;
}

.btn {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 11px 22px;
  font:
    500 15px Inter,
    sans-serif;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: var(--navy-dark);
}
.btn-ghost {
  background: #fff;
  color: var(--navy);
}
.btn-ghost:hover {
  background: #eef2fa;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: default;
}
.actions {
  margin: 20px 0 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

table.results {
  width: 100%;
  border-collapse: collapse;
}
.results th {
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--navy);
  padding: 10px;
}
.results td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.results.editable td {
  padding: 6px 6px;
}
.results.editable input,
.results.editable select {
  margin-top: 0;
}
.results tfoot td {
  border-bottom: 0;
  padding-top: 14px;
  font-weight: 600;
}
.num {
  text-align: right;
  white-space: nowrap;
}
.row-points {
  font-weight: 600;
  color: var(--navy);
  width: 70px;
}
.total strong {
  font-size: 24px;
  color: var(--navy-dark);
}
.remove-row {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.remove-row:hover {
  color: var(--red);
}
.remove-word {
  display: none;
}

.alert {
  background: #fdf0f0;
  border-left: 4px solid var(--red);
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.alert ul {
  margin: 6px 0 0;
  padding-left: 20px;
}
.field-error {
  color: var(--red);
  font-weight: 500;
  font-size: 14px;
  margin: 6px 0 0;
}
.success h1 {
  color: var(--navy-dark);
}
.ref {
  font-size: 20px;
  color: var(--red);
  letter-spacing: 0.05em;
}
.hp {
  position: absolute;
  left: -9999px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.js-hide {
  display: none !important;
}

.site-footer {
  background: var(--navy-dark);
  color: #cfd8ea;
  font-size: 14px;
  padding: 20px 0;
}

/* admin */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar select,
.toolbar input {
  width: auto;
  display: inline-block;
  margin: 0;
}
.tabs a {
  padding: 8px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
}
.tabs a.on {
  background: var(--navy);
  color: #fff;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: #eef2fa;
  color: var(--navy);
}
.badge.checked {
  background: #e6f4ea;
  color: #1e6b34;
}
.badge.queried {
  background: #fef3e2;
  color: var(--amber-dark);
}
/* The double-points show: in the committee's view the one thing on a return
   that changes how it is counted, so it is meant to catch the eye. */
.badge-double {
  background: #fdecec;
  color: var(--red);
}
.double-note {
  background: #fdf5f5;
  border-left: 4px solid var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 0 0 14px;
}
.double-note .badge {
  margin-right: 4px;
}
/* The member's answers on the committee's view of a return. */
.answers {
  margin: 4px 0 0;
  padding-left: 18px;
}
.answers li {
  margin-top: 4px;
}
/* The yes/no questions above the notes box. */
.questions {
  border: 0;
  padding: 0;
  margin: 8px 0 0;
}
.questions legend {
  font-weight: 600;
  color: var(--navy-dark);
  padding: 0;
}
.questions .check {
  margin-top: 10px;
}
.double-field {
  margin-top: 18px;
  max-width: 28rem;
}
.double-field.has-claim {
  max-width: 40rem;
}
.double-claim {
  margin-top: 0;
}
.has-claim .double-choice {
  margin: 10px 0 0 30px;
  max-width: 28rem;
}
/* Only asked once they say they competed there. CSS alone, so it works
   without JavaScript; an older browser without :has() just shows it. */
.double-field:has(#double_claim:not(:checked)) .double-choice {
  display: none;
}
.double-pick {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
}
.double-pick legend {
  font-weight: 600;
  color: var(--navy-dark);
}
/* With a show list, the typed name and date sit under the dropdown, only for
   "Show not listed". */
.show-other {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.results.editable tr.listed td[data-label='Show'] {
  min-width: 16rem;
}
.mini-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-dark);
}
.mini-label input {
  margin-top: 3px;
  /* The label is small; the field inside it is not. Below 16px, iOS zooms
     the page on focus. */
  font-size: 16px;
}
/* Championships */
.provisional {
  background: #fef3e2;
  border-left: 4px solid var(--amber);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 0 0 16px;
}
.awards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.award {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.award dt {
  font-weight: 700;
  color: var(--navy-dark);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.award dd {
  margin: 6px 0 0;
}
.award dd .badge,
.by-class {
  font-size: 13px;
}
.award dd .badge {
  margin-left: 6px;
}
.champ-edit {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.champ-edit summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.champ-edit[open] summary {
  margin-bottom: 10px;
}
.champ-classes {
  border: 0;
  padding: 0;
  margin: 10px 0 0;
}
.champ-classes legend {
  font-weight: 600;
  color: var(--navy-dark);
  margin-bottom: 6px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 2px 16px;
}
.check-grid .check {
  margin-top: 6px;
}
.champ-delete {
  border-top: 1px solid var(--line);
  margin-top: 10px;
}
.champ-delete .actions {
  align-items: center;
}
.dup {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
}
.scroll {
  overflow-x: auto;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px 14px;
  }
  .results.editable thead {
    display: none;
  }

  /* Each show becomes a self-contained card. Three fields sharing one
     unlabelled line read as a jumble on a phone, and the row number matters:
     validation errors refer to "Entry 2". */

  /* Leave table layout behind completely rather than making flex rows inside a
     table formatting context. Safari does not stretch such a row to the width
     of its row group, so the card came out narrower than its container and a
     date input — which will not shrink past its intrinsic width — hung over
     the edge. Chromium happens to lay it out as intended, which is why this
     only showed up on a real phone. */
  .results.editable,
  .results.editable tbody,
  .results.editable tfoot {
    display: block;
    width: 100%;
  }
  #show-rows {
    counter-reset: showrow;
  }
  .results.editable tr.show-row {
    counter-increment: showrow;
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
  }
  .results.editable tr.show-row.has-error {
    border-color: var(--red);
    background: #fffafa;
  }
  /* Row heading, paired with the remove button on the same line. */
  .results.editable tr.show-row::before {
    /* "Entry", not "Show": validation says "Entry 2: date is outside the 2026
       season" (SPEC §4.3), and the label someone scrolls to find must match
       the message that sent them looking. The double points dropdown uses
       the same word. */
    content: 'Entry ' counter(showrow);
    flex: 1 1 auto;
    order: 1;
    font-weight: 600;
    font-size: 13px;
    color: var(--navy-dark);
  }
  .results.editable tr.show-row td {
    border: 0;
    padding: 0;
    min-width: 0;
  }
  .results.editable tr.show-row td[data-label='Show'] {
    flex: 1 1 100%;
    order: 2;
  }
  /* Date and placing each get their own line on a phone.
     A native date input carries a large min-content width that varies by
     browser — iOS Safari's is wider than its rendered size — and as a flex
     item defaults to min-width:auto, so the cell refuses to shrink and slides
     under its neighbour. Rather than chase per-browser widths on the one
     platform that cannot be verified here, they stack; side by side returns
     at 480px where there is genuinely room for two. */
  .results.editable tr.show-row td[data-label='Date'] {
    flex: 1 1 100%;
    min-width: 0;
    order: 3;
  }
  .results.editable tr.show-row td[data-label='Placing'] {
    flex: 1 1 100%;
    min-width: 0;
    order: 4;
  }
  /* A date input that renders blank when cramped is unidentifiable with only
     an aria-label, so both fields get a visible one. */
  .results.editable tr.show-row td[data-label='Date']::before,
  .results.editable tr.show-row td[data-label='Placing']::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 12px;
    font-weight: 600;
    color: var(--navy-dark);
  }
  .results.editable tr.show-row td[data-label='Points'] {
    flex: 1 1 100%;
    order: 5;
    width: auto;
    text-align: left;
    font-size: 13px;
  }
  /* The running points per row are the whole point of the live total, so they
     stay on mobile rather than being hidden as they were. */
  .results.editable tr.show-row td[data-label='Points']::before {
    content: 'Points: ';
    font-weight: 400;
    color: var(--muted);
  }
  .results.editable tr.show-row td.row-remove {
    order: 1;
    margin-left: auto;
  }
  /* A bare glyph beside the date reads as "clear this field". */
  .results.editable .remove-glyph {
    display: none;
  }
  .results.editable .remove-word {
    display: inline;
    font-size: 13px;
    font-weight: 500;
  }
  .results.editable .remove-row {
    color: var(--navy);
    padding: 4px 8px;
    min-width: 0;
    min-height: 32px;
  }
  /* Native date inputs refuse to shrink below their intrinsic width unless
     told to, which is what squeezed the placing select. */
  .results.editable input,
  .results.editable select {
    max-width: 100%;
  }
  /* iOS sizes a date input from its shadow content and ignores width, so it
     came out wider than its siblings and overhung the card. Dropping the
     native appearance lets it obey the box; the picker still opens on tap,
     since that follows from type=date rather than from how it is painted.
     Scoped to phones, so the desktop control keeps its calendar button. */
  .results.editable input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    width: 100%;
  }
  /* Without this the value sits centred while every other field reads left. */
  .results.editable input[type='date']::-webkit-date-and-time-value {
    text-align: left;
    margin: 0;
  }
  .results.editable input[type='date']::-webkit-calendar-picker-indicator {
    margin-left: auto;
  }
}

/* With a show list there is no date column, so the placing gets the line. */
@media (max-width: 640px) {
  .results.editable tr.show-row.listed td[data-label='Placing'] {
    flex: 1 1 100%;
  }
  .results.editable tr.listed td[data-label='Show'] {
    min-width: 0;
  }
}

/* Small tablets and landscape phones: enough room to pair them again. */
@media (min-width: 480px) and (max-width: 640px) {
  .results.editable tr.show-row td[data-label='Date'] {
    flex: 1 1 45%;
  }
  .results.editable tr.show-row td[data-label='Placing'] {
    flex: 1 1 45%;
  }
  .results.editable tfoot tr {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .results.editable tfoot td {
    text-align: left;
  }
}

/* ---------------------------------------------------------------------------
   Additions for the Workers rebuild: accessibility (WCAG 2.2 AA), the admin
   screens the prototype did not have, and card-stacked tables at 390px.
   --------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 10px 16px;
  z-index: 10;
}
.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

/* 44px touch targets (SPEC §7.4) */
.btn,
button.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='date'],
input[type='search'],
input[type='number'],
input[type='url'],
input[type='password'],
select {
  min-height: 44px;
}
.remove-row {
  min-width: 44px;
  min-height: 44px;
}
.site-header nav a,
.tabs a,
.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.field {
  display: block;
  /* Grid and flex items default to min-width:auto, so they refuse to shrink
     below their content. Safari sizes a <select> to its widest option, and a
     long class name or setting label would then push the whole page sideways.
     Chromium hides this by shrinking the select instead. */
  min-width: 0;
}
select {
  max-width: 100%;
}
.field + .field {
  margin-top: 4px;
}
.grid .field.full {
  grid-column: 1 / -1;
}
.grid.readonly p {
  margin: 0 0 8px;
}
label {
  margin-bottom: 0;
}
.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 12px;
}
.muted {
  color: var(--muted);
}
.opt {
  font-weight: 400;
  color: var(--muted);
}

.alert a {
  color: var(--red);
}
.alert li {
  margin: 4px 0;
}
.show-row.has-error input,
.show-row.has-error select {
  border-color: var(--red);
}

.card.narrow {
  max-width: 460px;
}
.card.danger {
  border-color: #f0d4d5;
}
.card.prose h2 {
  font-size: 18px;
  margin-top: 20px;
}
.card.prose li {
  margin: 4px 0;
}
.stack {
  margin-bottom: 20px;
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
}
.btn-danger:hover {
  background: #9d2227;
  border-color: #9d2227;
}

/* One-click review buttons. Both carry white text at 5:1 contrast or better. */
.status-fieldset {
  border: 0;
  padding: 0;
  margin: 20px 0 0;
}
.status-fieldset legend {
  padding: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--navy-dark);
}
.status-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.btn-checked {
  background: var(--green);
  border-color: var(--green);
}
.btn-checked:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}
.btn-queried {
  background: var(--amber);
  border-color: var(--amber);
}
.btn-queried:hover {
  background: var(--amber-dark);
  border-color: var(--amber-dark);
}
/* The current status is marked, never disabled: a mis-click must stay recoverable. */
.status-actions .is-current {
  box-shadow: 0 0 0 3px rgba(1, 40, 118, 0.18);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
/* "Back to main site" shortens on a phone, where the logo, the wordmark and
   two links have to share one line. */
.nav-short {
  display: none;
}
@media (max-width: 480px) {
  .nav-long {
    display: none;
  }
  .nav-short {
    display: inline;
  }
}
.site-header nav .who {
  font-size: 14px;
  color: var(--muted);
}

.site-footer .wrap {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.site-footer a {
  color: #cfd8ea;
}

/* admin */
.toolbar h1 {
  margin-right: auto;
}
.toolbar.filters {
  align-items: flex-end;
  gap: 12px;
}
.toolbar.filters .field {
  margin: 0;
}
.toolbar.filters label {
  font-size: 13px;
}
/* Show names tab: spellings that look like the same show sit together under
   an amber heading and rule, so a group reads as one thing to standardise. */
.show-names-intro {
  margin: 0 0 12px;
}
.results.show-names tbody.has-matches {
  border-left: 3px solid var(--amber);
  background: #fffbf5;
}
.results.show-names tr.show-group-head th {
  background: #fef3e2;
  color: var(--amber-dark);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}
.results.show-names tbody.has-matches + tbody td,
.results.show-names tbody + tbody.has-matches tr:first-child th {
  border-top: 2px solid var(--line);
}
.results.show-names td[data-label='Show name'] {
  min-width: 14em;
}
.results.show-names .show-name {
  font-weight: 600;
  /* Keep stray spacing visible: "Spring  Show" should look different. */
  white-space: pre-wrap;
}
/* Qualifications tab: one card per question, with links to jump between
   them since a busy season makes the page long. */
.qualifications-intro {
  margin: 0 0 12px;
}
.qualifications-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.qualification h2 .count,
.qualifications-jump .count {
  color: var(--muted);
  font-weight: 400;
}
.qualification h2 {
  flex-wrap: wrap;
  gap: 4px 10px;
}
.qualification h2 .count {
  font-size: 0.8em;
  white-space: nowrap;
}
.nowrap {
  white-space: nowrap;
}
.member-returns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* A bar pairing what is on screen with the action that exports it, rather
   than a button floating on its own line above the table. */
.list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.list-bar-in-card {
  margin: -4px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.list-bar-count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
/* Secondary to the Filter button above it. */
.btn-sm {
  padding: 7px 14px;
  font-size: 14px;
  min-height: 40px;
  gap: 8px;
}
.btn-sm .icon {
  flex: none;
}
.flash {
  background: #e6f4ea;
  border-left: 4px solid #1e6b34;
  color: #1e6b34;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 500;
}
.flash-error {
  background: #fdf0f0;
  border-left-color: var(--red);
  color: var(--red);
}
.row-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row-form .check {
  margin-top: 0;
  align-items: center;
}
.row-form input[type='text'] {
  min-width: 220px;
}
.narrow-input {
  max-width: 90px;
}

/* Class list: inputs sit in real columns under their headers. */
.class-table td {
  vertical-align: middle;
}
.class-table input[type='text'] {
  margin: 0;
}
.class-table input[type='number'] {
  margin: 0;
  text-align: right;
}
.class-table th:nth-child(2),
.class-table td:nth-child(2) {
  width: 7rem;
}
.class-table th:nth-child(3),
.class-table td:nth-child(3) {
  width: 11rem;
}
.class-table .check {
  margin: 0;
  justify-content: center;
}
.in-use {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* A secondary action sitting below a card's main form. */
.subform {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.subform .row-form {
  align-items: flex-end;
}

@media (max-width: 640px) {
  /* The stacked card layout already labels each cell, so centring the
     checkbox under a header that is no longer there would look wrong. */
  .class-table .check {
    justify-content: flex-start;
  }
  .class-table th:nth-child(2),
  .class-table td:nth-child(2),
  .class-table th:nth-child(3),
  .class-table td:nth-child(3) {
    width: auto;
  }
  .class-table input[type='number'] {
    max-width: 6rem;
  }
}
.points-grid {
  grid-template-columns: repeat(6, 1fr);
}
.results td .badge,
.results td .dup {
  margin-left: 6px;
}
/* Inactive people are marked with a badge rather than a faded row: dimming
   the text dropped it below the 4.5:1 contrast the spec asks for. */
.badge.inactive {
  background: #eceff4;
  color: #4b5563;
  margin-left: 8px;
}
.you {
  color: var(--muted);
  font-weight: 400;
}
.user-table td {
  vertical-align: middle;
}
.user-table select {
  margin: 0;
  min-width: 9rem;
}
.user-table .check {
  margin: 0;
  justify-content: center;
}
.user-table .email-cell {
  word-break: break-word;
}
.user-table th:nth-child(4),
.user-table td:nth-child(4) {
  width: 8rem;
}
.subform h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--navy-dark);
}

@media (max-width: 640px) {
  .user-table .check {
    justify-content: flex-start;
  }
  .user-table th:nth-child(4),
  .user-table td:nth-child(4) {
    width: auto;
  }
  .user-table select {
    min-width: 0;
  }
}
.audit {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
}
.audit li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 0 24px;
}

@media (max-width: 760px) {
  .points-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .toolbar.filters {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar.filters .field,
  .toolbar.filters select,
  .toolbar.filters input {
    width: 100%;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 24px;
  }
  .site-header .wrap {
    min-height: 64px;
  }
  .brand-badge {
    width: 40px;
    height: 40px;
  }
  .brand {
    gap: 8px;
  }
  .brand-logo {
    height: 48px;
  }
  .brand-text {
    white-space: nowrap;
  }
  .site-header nav {
    gap: 12px;
  }

  /* Read-only tables stack into cards so nothing scrolls sideways (SPEC §7.4) */
  .results:not(.editable) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .results:not(.editable) tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }
  .results:not(.editable) td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 0;
    padding: 4px 0;
  }
  .results:not(.editable) td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--navy-dark);
    font-size: 13px;
  }
  .results:not(.editable) td:empty {
    display: none;
  }
  .results:not(.editable) tfoot td {
    border: 0;
  }

  .results.editable tr.show-row td.row-remove {
    align-self: center;
  }
  .pager {
    flex-wrap: wrap;
  }
}

/* Slideshow photos. Fixed-ratio tiles keep the grid tidy whatever shape the
   member's camera produced; the full image is one click away. */
.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
}
.photo-grid a:focus-visible img {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}
/* The zip button is revealed by photos-zip.js; .btn's display would
   otherwise beat the browser's own [hidden] rule and show a dead button. */
#photo-zip[hidden] {
  display: none;
}
#photo-zip:disabled {
  opacity: 0.6;
  cursor: progress;
}
#photo-zip-status {
  font-variant-numeric: tabular-nums;
}
#photo-zip-status:empty {
  display: none;
}
.photo-caption {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}
input[type='file'] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid #c7cedb;
  border-radius: var(--radius);
  background: #fff;
}

@media (max-width: 640px) {
  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

/* Points key: a disclosure, not a modal, so it works without JavaScript. */
.points-key {
  /* Only as wide as it needs to be, so it reads as a control rather than an
     empty banner stretched across the card. */
  width: fit-content;
  max-width: 100%;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}
.points-key > summary {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.points-key > summary::-webkit-details-marker {
  display: none;
}
/* Own marker, so it points the same way in every browser. */
.points-key > summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}
.points-key[open] > summary::before {
  transform: rotate(90deg);
}
.points-key > summary:hover {
  color: var(--navy-dark);
}
.points-key > summary:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: -3px;
}
.points-key-table {
  /* Fill the panel rather than huddling on the left: the container is sized
     by its longest line, so a narrow table left a gap beside it. */
  width: calc(100% - 28px);
  margin: 0 14px 4px;
  border-collapse: collapse;
}
.points-key-table th.num {
  /* The generic th rule below would otherwise left-align this heading while
     the figures beneath it sit right. */
  text-align: right;
}
.points-key-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 4px 16px 4px 0;
  border-bottom: 1px solid var(--line);
}
.points-key-table td {
  padding: 5px 16px 5px 0;
  border-bottom: 1px solid var(--line);
}
.points-key-table tr:last-child td {
  border-bottom: 0;
}
.points-key-table .num {
  font-weight: 600;
  color: var(--navy-dark);
  padding-right: 0;
}
.points-key > .hint {
  margin: 0;
  padding: 0 14px 12px;
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  .points-key > summary::before {
    transition: none;
  }
}
