/* Shared Pass 7 controls. Load after page styles; themes override these tokens. */
:root {
  --component-paper: #f7f6f0;
  --component-ink: #1d232e;
  --component-muted: #5f645c;
  --component-line: #a7ac9b;
  --component-active: #414823;
  --component-active-text: #fff;
  --component-switch-off: #b9bcb0;
}

/* Exclude only non-text controls from the legacy global 44px minimum. */
input[type="checkbox"],
input[type="radio"],
input[type="file"],
.sr-only,
.custom-select-native {
  min-height: 0 !important;
}

.custom-select {
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
  color: var(--component-ink);
  font: inherit;
}

.custom-select .custom-select-native {
  position: absolute !important;
  inset: 0 auto auto 0 !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.custom-select .select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--component-line);
  border-radius:0;
  background: var(--component-paper);
  color: var(--component-ink);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
  text-align: start;
  cursor: pointer;
  touch-action: manipulation;
}

.custom-select .select-trigger::after {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 13px;
  width: 7px;
  height: 7px;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  content: "";
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.custom-select .select-trigger[aria-expanded="true"]::after {
  transform: translateY(-20%) rotate(225deg);
}

.custom-select.is-filter.is-active .select-trigger {
  border-color: var(--component-active);
  box-shadow: inset 0 0 0 1px var(--component-active);
}

.custom-select .select-label {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
}

.select-trigger .select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select .select-list {
  position: fixed;
  z-index: 10000;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: calc(100vw - 24px);
  max-height: min(360px, calc(100dvh - 24px));
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--component-line);
  border-radius:0;
  background: var(--component-paper);
  color: var(--component-ink);
  box-shadow: 0 8px 24px rgba(29, 35, 46, .16);
  /* JS supplies viewport left/top (trigger bottom + 4px) and min-width. */
}

.custom-select .select-list[hidden] {
  display: none !important;
}

.select-list .select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius:0;
  background: transparent;
  color: var(--component-ink);
  font: inherit;
  font-weight: 400;
  line-height: 1.5;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.select-list .select-option:hover,
.select-list .select-option:focus-visible {
  background: color-mix(in srgb, var(--component-active) 10%, var(--component-paper));
}

.select-list .select-option[aria-selected="true"] {
  font-weight: 700;
}

.select-option .select-check {
  position: relative;
  display: block;
  flex: 0 0 16px;
  width: 16px;
  height: 20px;
  margin-inline-start: auto;
  color: var(--component-active);
  font-size: 0;
  opacity: 0;
}

.select-option .select-check::after {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 5px;
  width: 5px;
  height: 10px;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

.select-option[aria-selected="true"] .select-check {
  opacity: 1;
}

.custom-select .select-trigger:focus-visible,
.custom-select:focus-within > .select-trigger {
  outline: 2px solid var(--component-active);
  outline-offset: 3px;
}

.select-list .select-option:focus-visible {
  outline: 2px solid var(--component-active);
  outline-offset: -3px;
}

.custom-select .select-trigger:disabled,
.select-list .select-option:disabled,
.select-list .select-option[aria-disabled="true"] {
  color: var(--component-muted);
  cursor: not-allowed;
}

body[data-page="admin"] .custom-select .select-trigger {
  min-height: 36px;
  font-size: 14px;
  line-height: 20px;
}

body[data-page="admin"] .select-list .select-option {
  min-height: 36px;
  font-size: 14px;
  line-height: 20px;
}

.consent-field {
  display: block;
}

.public-form label.consent-row,
.public-form label.check-row,
.consent-row,
.consent-row.field,
.check-row,
.usage-options label.check-row,
.switch-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  box-sizing: border-box;
  min-height: 44px;
  padding-block: 10px;
  color: var(--component-ink);
  line-height: 24px;
  text-align: start;
  cursor: pointer;
}

:is(.consent-row, .check-row, .switch-row) > :is(span, div) {
  min-width: 0;
  overflow-wrap: anywhere;
}

:is(.consent-row, .check-row) input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-content: center;
  flex: 0 0 22px !important;
  box-sizing: border-box;
  width: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px !important;
  margin: 1px 0 0;
  padding: 0;
  border: 2px solid var(--component-ink);
  border-radius:var(--radius-s);
  background: var(--component-paper);
  color: var(--component-active-text);
  cursor: pointer;
}

:is(.consent-row, .check-row) input[type="checkbox"]::before {
  width: 5px;
  height: 10px;
  border-inline-end: 2px solid currentColor;
  border-block-end: 2px solid currentColor;
  content: "";
  opacity: 0;
  transform: translateY(-1px) rotate(45deg);
}

.public-form :is(.consent-row, .check-row) input[aria-invalid="true"],
.public-form .form-field:has(.field-error:not([hidden])) :is(.consent-row, .check-row) input {
  border-color: var(--danger, #973d30);
}

:is(.consent-row, .check-row) input[type="checkbox"]:checked {
  border-color: var(--component-active);
  background: var(--component-active);
}

:is(.consent-row, .check-row) input[type="checkbox"]:checked::before {
  opacity: 1;
}

.switch-row {
  align-items: center;
}

.switch-row .switch-input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  flex: 0 0 38px;
  box-sizing: border-box;
  width: 38px !important;
  min-width: 38px;
  max-width: 38px;
  height: 22px !important;
  min-height: 22px !important;
  max-height: 22px;
  margin: 0;
  padding: 2px;
  border: 0;
  border-radius:var(--radius-m);
  background: var(--component-switch-off);
  cursor: pointer;
}

.switch-row .switch-input::before {
  display: block;
  width: 18px;
  height: 18px;
  border-radius:50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(29, 35, 46, .2);
  content: "";
  transition: transform .15s ease;
}

.switch-row .switch-input:checked {
  background: var(--component-active);
}

.switch-row .switch-input:checked::before {
  transform: translateX(16px);
}

:is(.consent-row, .check-row, .switch-row) input:focus-visible {
  outline: 2px solid var(--component-active);
  outline-offset: 3px;
}

:is(.consent-row, .check-row, .switch-row):has(input:disabled) {
  color: var(--component-muted);
  cursor: not-allowed;
}

:is(.consent-row, .check-row, .switch-row) input:disabled {
  cursor: not-allowed;
}

label.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 132px;
  margin: 0;
  padding: 24px 16px;
  border: 1px dashed var(--component-line);
  border-radius:0;
  background: var(--component-paper);
  color: var(--component-ink);
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
}

label.upload-zone :is(small, .upload-hint, .upload-limits) {
  color: var(--component-muted);
  font-size: 14px;
  line-height: 20px;
}

label.upload-zone :is(svg, .upload-icon, .upload-symbol) {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--component-active);
}

label.upload-zone .upload-symbol {
  font-size: 24px;
  line-height: 24px;
}

label.upload-zone input[type="file"] {
  position: absolute !important;
  z-index: 1;
  inset: 0 !important;
  display: block;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip: auto !important;
  clip-path: none !important;
  opacity: 0;
  cursor: pointer;
}

label.upload-zone:focus-within,
label.upload-zone.is-dragover,
label.upload-zone.drag-over,
label.upload-zone[data-dragover="true"] {
  border-color: var(--component-active);
  outline: 2px solid var(--component-active);
  outline-offset: 3px;
}

.upload-status {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-block-start: 8px;
  color: var(--component-muted);
  font-size: 14px;
  line-height: 20px;
}

.upload-status[hidden],
.upload-file[hidden] {
  display: none !important;
}

.upload-file {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--component-line);
  background: var(--component-paper);
  color: var(--component-ink);
  overflow-wrap: anywhere;
}

.upload-file > :is(span, .upload-file-name) {
  flex: 1 1 160px;
  min-width: 0;
}

.upload-file progress {
  flex: 1 1 120px;
  width: 160px;
  max-width: 100%;
  height: 8px;
  accent-color: var(--component-active);
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 40px;
  height: 40px;
  max-width: 100%;
  padding: 8px 16px;
  border: 1px solid var(--component-line);
  border-radius:var(--radius-pill);
  background: var(--component-paper);
  color: var(--component-ink);
  font: inherit;
  font-weight: 400;
  line-height: 22px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.filter-pill:is(.is-active, [aria-selected="true"], [aria-pressed="true"]) {
  border-color: var(--component-active);
  background: var(--component-active);
  color: var(--component-active-text);
  font-weight: 700;
}

.filter-pill :is(.count, .filter-count) {
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}

.filter-pill:focus-visible {
  outline: 2px solid var(--component-active);
  outline-offset: 3px;
}

.dialog,
.dialog[open] {
  overflow: clip;
}

.dialog-body {
  position: relative;
}

@media (max-width: 780px) {
  body[data-page="admin"] .custom-select .select-trigger,
  body[data-page="admin"] .select-list .select-option {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .custom-select .select-trigger {
    min-height: 44px;
  }

  .select-list .select-option {
    min-height: 44px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  label.upload-zone {
    min-height: 120px;
    padding: 20px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .switch-row .switch-input::before {
    transition: none;
  }
}

@media (forced-colors: active) {
  :is(.consent-row, .check-row) input[type="checkbox"]:checked,
  .switch-row .switch-input:checked {
    border-color: Highlight;
    background: Highlight;
    color: HighlightText;
    forced-color-adjust: none;
  }

  .switch-row .switch-input {
    border: 1px solid ButtonText;
  }

  .switch-row .switch-input::before {
    width: 16px;
    height: 16px;
    background: ButtonText;
  }
}

.select-arrow{display:none}.dialog-footer>.switch-row{margin-right:auto;flex:none;min-height:36px}.upload-status progress{display:block;width:100%;height:6px;margin-top:6px}
