/* Shared checkbox contract: control on the left, wrapping label on the right.
   Structural !important rules deliberately override legacy dialog ID selectors.
   Keep names, states, native semantics, colours and form behaviour unchanged. */
:root {
  --checkbox-size: 20px;
  --checkbox-gap: 10px;
}

label:has(> input[type="checkbox"]):not([hidden]):not(.waitlist-preview-row):not(.emergency-booking-row) {
  display: grid !important;
  grid-template-columns: var(--checkbox-size) minmax(0, 1fr) !important;
  grid-auto-flow: row !important;
  align-items: start !important;
  align-content: center;
  gap: 4px var(--checkbox-gap) !important;
  min-height: 44px;
  min-width: 0;
  text-align: start;
  line-height: 1.5;
  cursor: pointer;
}

label:has(> input[type="checkbox"]):not(.waitlist-preview-row):not(.emergency-booking-row) > :not(input) {
  grid-column: 2 !important;
  min-width: 0;
  overflow-wrap: anywhere;
}

label > input[type="checkbox"] {
  appearance: auto !important;
  position: static !important;
  opacity: 1 !important;
  box-sizing: border-box;
  width: var(--checkbox-size) !important;
  min-width: var(--checkbox-size) !important;
  max-width: var(--checkbox-size) !important;
  height: var(--checkbox-size) !important;
  min-height: var(--checkbox-size) !important;
  max-height: var(--checkbox-size) !important;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  align-self: start !important;
  justify-self: start !important;
  flex: 0 0 var(--checkbox-size) !important;
  accent-color: var(--aqua-teal, #315b57);
  cursor: inherit;
}

label > input[type="checkbox"]:focus-visible {
  outline: 3px solid #315b57;
  outline-offset: 3px;
}
label:has(> input[type="checkbox"]:disabled) { cursor: not-allowed; }

/* Preserve detailed row grids; their first column already holds the checkbox. */
label:is(.waitlist-preview-row, .emergency-booking-row) {
  align-items: start !important;
  min-height: 44px;
}

/* Existing switch skins keep their slider and their native keyboard control. */
label:has(> .switch > input[type="checkbox"]):not([hidden]) {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  gap: var(--checkbox-gap) !important;
  min-height: 44px;
  cursor: pointer;
}
label:has(> .switch > input[type="checkbox"]) > .switch {
  order: -1;
  flex: 0 0 48px;
}
label:has(> .switch > input[type="checkbox"]) > :not(.switch) {
  min-width: 0;
  overflow-wrap: anywhere;
}
label .switch input:focus-visible + .switch-slider {
  outline: 3px solid #315b57;
  outline-offset: 3px;
}
