body {
  min-height: 100vh;
}

.pub-head,
.staff-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px var(--space);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--primary);
}

.staff-head .spacer {
  flex: 1;
}

.staff-head nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.staff-head nav a[aria-current="page"] {
  background: var(--primary-tint);
  color: var(--primary-hover);
}

.staff-head nav [aria-disabled="true"] {
  color: var(--muted);
  cursor: not-allowed;
}

.page.narrow {
  max-width: 680px;
}

form.stackform {
  display: grid;
  gap: 16px;
}

.page {
  padding-bottom: 140px;
}

.card {
  box-shadow: var(--shadow);
  border-color: transparent;
}

.calgrid {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: none;
}

.calhead,
.calcells {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.staff-head > span {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.calhead span {
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  background: #fafcfc;
}

.staff-head nav a,
.staff-head nav span {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  border-color: #e6ecec;
  position: relative;
  overflow: hidden;
  gap: 5px;
}

.cell:nth-child(7n) {
  border-right: 0;
}

.cell.weekend {
  background: #fafcfc;
}

.cell.out {
  background: #f4f7f7;
}

.cell .dn {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  width: 28px;
  height: 28px;
  color: var(--text);
}

.cell.out .dn {
  color: #b3bfbf;
  font-weight: 600;
}

.cell.today .dn {
  background: var(--primary);
  color: var(--on-primary);
}

.cell.today {
  background: var(--primary-tint);
  box-shadow: inset 0 3px 0 var(--primary);
}

.banner.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}

.codeinput {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  letter-spacing: 0.25em;
}

form > .row:last-child,
form .field + .row {
  margin-top: 12px;
}

.card > .field + .row {
  margin-top: 12px;
}

.calhead span:nth-child(n + 6) {
  color: #7a8a8a;
}

.calcells {
  grid-auto-rows: 138px;
}

.page.wide {
  max-width: 1680px;
}

.cell .dh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.calbar2 {
  justify-content: space-between;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 14px;
}

.calnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monthlabel {
  margin: 0;
}

.center {
  text-align: center;
}

.calbar2 .calnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.calbar2 .monthlabel {
  font-size: 28px;
  line-height: 1.1;
  margin: 0 8px;
  min-width: 0;
  flex: 0 1 auto;
  text-transform: capitalize;
  white-space: nowrap;
}

.cell.pastday:not(.has) .dn {
  color: #9aa8a8;
  font-weight: 600;
}

.calendar-week {
  display: contents;
}

@media (max-width: 640px) {
  .calgrid {
    display: none;
  }

  main.page {
    padding-bottom: 140px;
  }

  .calbar2 {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .calbar2 .monthlabel {
    flex: 1;
    font-size: 20px;
    margin: 0;
    text-align: center;
  }

  .calbar2 .calnav {
    width: 100%;
  }
}

.client-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.client-form > * {
  grid-column: 1/-1;
}

.client-form > label[for="administratorFirstName"],
.client-form > label[for="administratorLastName"] {
  grid-column: auto;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.backlink {
  max-width: 100%;
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
}

.sectionh {
  font-size: 18px;
  margin: 4px 0 -8px;
}

.statuspill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--primary-tint);
  color: var(--primary-hover);
}

.statuspill.off {
  background: #eceff0;
  color: var(--muted);
}

.evtop {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.evtitle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.evtitle h1 {
  margin: 0;
  overflow-wrap: anywhere;
}

dl.evfacts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
  margin: 8px 0 0;
}

dl.evfacts > div {
  min-width: 0;
}

dl.evfacts dt {
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.event-edit-comparison dd {
  overflow-wrap: anywhere;
}

dl.evfacts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

table.list th,
table.list td {
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

table.list a.rowlink {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

@media (max-width: 640px) {
  .client-form {
    grid-template-columns: 1fr;
  }

  table.list thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table.list,
  table.list tbody,
  table.list tr,
  table.list td {
    display: block;
    width: 100%;
  }

  table.list tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 8px 12px;
    background: var(--surface);
  }

  table.list td {
    border: 0;
    padding: 4px 0;
    overflow-wrap: anywhere;
  }

  table.list td::before {
    content: attr(data-label) ": ";
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
  }

  table.list td.name {
    font-size: 17px;
  }

  table.list td.name::before {
    content: "";
  }
}

.req {
  color: var(--danger-text);
  font-weight: 800;
}

.req-note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

#client-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#client-content > .btn {
  width: fit-content;
}

table.list tbody tr.clickable {
  cursor: pointer;
  position: relative;
}

table.list tbody tr.clickable td:last-child {
  padding-right: 40px;
}

table.list tbody tr.clickable td:last-child::after {
  content: "›" / "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-52%);
  font-size: 28px;
  line-height: 1;
  color: var(--muted);
  pointer-events: none;
}

table.list tbody tr.clickable:active {
  background: var(--primary-tint);
}

@media (hover: hover) {
  table.list tbody tr.clickable:hover {
    background: var(--primary-tint);
  }

  table.list tbody tr.clickable:hover .nm {
    text-decoration: underline;
  }

  table.list tbody tr.clickable:hover td:last-child::after {
    color: var(--text);
  }
}

@media (max-width: 640px) {
  table.list tbody tr.clickable {
    padding-right: 36px;
  }

  table.list tbody tr.clickable td:last-child {
    padding-right: 0;
  }

  table.list tbody tr.clickable td:last-child::after {
    right: 12px;
  }
}

table.list {
  table-layout: fixed;
}

#client-content table.list th:first-child {
  width: 40%;
}

#client-content.card {
  gap: 16px;
}

.client-search-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.client-search-toolbar label {
  display: block;
}

.client-search-field {
  flex: 1 1 260px;
  max-width: 420px;
}

.client-search-toolbar input,
.client-search-toolbar select {
  width: 100%;
}

.clients-enhanced .client-search-submit {
  display: none;
}

.client-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.client-pagination [aria-disabled] {
  opacity: 0.5;
}

#client-results .banner {
  overflow-wrap: anywhere;
}

#client-results > .banner.danger {
  margin-bottom: 20px;
}

#client-content[data-loading="true"]
  > :not(#client-search-form, .client-loading) {
  display: none;
}

.client-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton {
  height: 18px;
  border-radius: 6px;
  background: var(--border);
}

.evactions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.evactions form {
  margin: 0;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  background: var(--surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.staff-status-actions .btn-outline {
  white-space: nowrap;
}

.btn-outline.off {
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-outline.on {
  border-color: var(--primary);
  color: var(--primary-hover);
}

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

@media (hover: hover) {
  .btn-outline.off:hover {
    background: var(--danger-bg);
  }

  .btn-outline.on:hover {
    background: var(--primary-tint);
  }
}

dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 22px;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 20px 60px rgb(16, 40, 40, 0.35);
}

dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

dialog h2 {
  font-size: 20px;
}

dialog p {
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 16px;
}

dialog form.client-form.row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

dialog .btn-danger,
.guest-delete-page .btn-danger {
  background: var(--danger-text);
  color: var(--on-primary);
  border-color: var(--danger-text);
}

.guest-delete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

dialog .guest-delete-actions {
  justify-content: flex-end;
}

.guest-delete-error[hidden],
.event-action-error[hidden] {
  display: none;
}

dialog::backdrop {
  background: color-mix(in srgb, var(--text) 35%, transparent);
}

.conflict-review {
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .evactions {
    width: 100%;
  }

  .evactions > * {
    flex: 1;
    justify-content: center;
  }

  .evactions form button {
    width: 100%;
  }
}

.staff-form {
  gap: var(--space);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.staff-form > * {
  grid-column: 1 / -1;
}

.staff-form > label[for="firstName"],
.staff-form > label[for="lastName"] {
  grid-column: auto;
}

#staff-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.event-form .check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
}

.event-form .check input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--primary);
}

.event-form .check + .error {
  display: block;
}

.event-form .celebrant-hint {
  margin-top: -8px;
}

.event-form .celebrant-host-summary {
  margin: 0;
}

.event-form #celebrant-names[hidden],
.event-form #end-date-intent[hidden] {
  display: none;
}

#staff-content .search {
  max-width: 420px;
  flex: 1;
}

#staff-content .search input {
  width: 100%;
}

.staff-enhanced .staff-search-submit {
  display: none;
}

.youchip {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}

#staff-results .name .nm {
  font-weight: 700;
}

#staff-results .banner {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .staff-form {
    grid-template-columns: 1fr;
  }
}

.staff-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#staff-content[data-loading="true"] > #staff-results {
  display: none;
}

#staff-results table.list th:nth-child(1) {
  width: 16%;
}

#staff-results table.list th:nth-child(2) {
  width: 22%;
}

#staff-results table.list th:nth-child(3) {
  width: 16%;
}

#staff-results table.list th:nth-child(4) {
  width: 14%;
}

#staff-results table.list th:nth-child(5) {
  width: 12%;
}

#staff-results .statuspill {
  white-space: nowrap;
}

.staff-form .staff-review-acknowledgement {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: var(--tap);
}

.staff-status-actions form {
  margin: 0;
}

#staff-status-dialog form {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

#staff-results td {
  overflow-wrap: anywhere;
}

@media (min-width: 640px) and (max-width: 1359px) {
  #staff-results table {
    table-layout: fixed;
  }

  #staff-results th,
  #staff-results td {
    padding-inline: 8px;
  }

  #staff-results .btn-outline {
    padding-inline: 8px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  #staff-results .staff-status-actions .btn-outline {
    width: 100%;
  }

  #staff-results .staff-status-actions:not(:has(a, form)) {
    height: 0;
    padding: 0;
  }
}

#staff-status-region:not(:has(*)) {
  display: none;
}

#staff-results .staff-status-actions::before {
  content: none;
}

#staff-results table.list th:nth-child(6) {
  width: 20%;
}

.locations-enhanced .locations-search-submit {
  display: none;
}

#locations-content[data-loading="true"] #locations-results {
  display: none;
}

#locations-results td {
  overflow-wrap: anywhere;
}

#locations-content .search {
  flex: 1 1 260px;
  max-width: 420px;
}

#locations-content .search input {
  width: 100%;
}

#locations-form textarea.input {
  min-height: 88px;
  resize: vertical;
}

.locations-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#locations-results td.name {
  font-weight: 700;
}

#locations-results > .banner + .locations-retry {
  margin-top: 16px;
}

#locations-results .rowactions {
  white-space: nowrap;
}

#locations-results .rowactions::before {
  content: none;
}

#locations-results .rowactions .actions {
  display: grid;
  grid-template-columns: 140px;
  gap: 8px;
  justify-content: end;
}

#locations-results .rowactions .actions > *,
#locations-results .rowactions form button {
  width: 100%;
  justify-content: center;
  text-align: center;
}

@media (max-width: 640px) {
  #locations-results .rowactions {
    padding-top: 8px;
  }

  #locations-results .rowactions .actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
}

#locations-form .preserve-lines {
  white-space: pre-wrap;
}

#locations-form dd {
  overflow-wrap: anywhere;
}

#location-status-region:not(:has(*)) {
  display: none;
}

.location-status-error {
  display: grid;
  gap: 16px;
}

.event-form .kid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  min-width: 0;
}

.event-form .kid legend {
  font-weight: 700;
  padding: 0 6px;
}

.event-form .hint-below {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.event-schedule > :nth-child(1) {
  order: 1;
}

.event-schedule > :nth-child(2) {
  order: 3;
}

.event-schedule > :nth-child(3) {
  order: 2;
}

.event-schedule > :nth-child(4) {
  order: 4;
}

.event-edit-dialog {
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.event-edit-confirmation {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-edit-confirmation h2 {
  margin: 0;
}

.event-form .event-edit-confirmation .row {
  margin-top: 12px;
  justify-content: flex-end;
}
