/* The native value stays focusable for existing form progression/validation. */
#profileForm #profileSex.profile-sex-picker-native {
  position: absolute !important; top: auto !important; left: 0 !important;
  width: 1px !important; min-width: 1px !important; max-width: 1px !important;
  height: 1px !important; min-height: 1px !important; max-height: 1px !important;
  padding: 0 !important; margin: 0 !important; border: 0 !important;
  overflow: hidden !important; opacity: 0 !important; clip-path: inset(50%) !important;
  pointer-events: none !important;
}
#profileForm .profile-identity-grid .profile-sex-picker-field::after { display: none; }
#profileForm .profile-sex-picker { min-width: 0; width: 100%; }
#profileForm .profile-sex-picker-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 0; min-height: var(--profile-main-field-height, 48px);
  padding: 11px 10px; margin: 0; border: 1px solid var(--line); border-radius: 17px;
  background: var(--field); color: var(--ink); box-shadow: var(--shadow-soft);
  font: inherit; font-size: 16px; font-weight: 800; line-height: 1.4;
  text-align: start; letter-spacing: 0; text-transform: none; touch-action: manipulation;
}
#profileForm .profile-sex-picker-value { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#profileForm .profile-sex-picker-trigger::after {
  content: ""; flex: 0 0 8px; width: 8px; height: 8px; margin-right: 3px; margin-top: -4px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
#profileForm .profile-sex-picker-trigger[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(225deg); }
#profileForm .profile-sex-picker-trigger:is(:focus-visible,[aria-expanded="true"]) {
  border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 2px;
}
#profileForm .profile-sex-picker-trigger[aria-invalid="true"] { border-color: var(--red); outline-color: var(--red); }
#profileForm .profile-sex-picker-trigger:disabled { opacity: .55; cursor: not-allowed; }
.profile-sex-picker-popup {
  position: fixed; z-index: 1700; display: grid; gap: 3px; padding: 6px; margin: 0;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink);
  box-shadow: var(--shadow); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent; touch-action: pan-y;
  font-family: var(--font-primary); font-size: 16px; line-height: 1.4; isolation: isolate;
}
.profile-sex-picker-popup[hidden] { display: none !important; }
.profile-sex-picker-option {
  display: grid; grid-template-columns: minmax(0, 1fr) 22px; align-items: center; gap: 12px;
  min-width: 0; min-height: 46px; padding: 11px 12px; margin: 0; border: 1px solid transparent;
  border-radius: 12px; background: transparent; color: var(--ink); cursor: pointer;
  font: inherit; font-weight: 650; text-align: start; overflow-wrap: anywhere;
}
.profile-sex-picker-option[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); background: var(--blue-soft);
}
.profile-sex-picker-option[aria-selected="true"]::after {
  content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue); color: var(--surface); font-size: 14px; font-weight: 900;
}
.profile-sex-picker-option.is-active { outline: 2px solid var(--blue); outline-offset: -3px; background: var(--blue-soft); }
.profile-sex-picker-option[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.profile-sex-picker-searchable {
  display: flex; flex-direction: column; gap: 6px; box-sizing: border-box;
  padding: 8px; border-radius: 16px; overflow: hidden; font-size: 15px;
}
.profile-picker-search { position: relative; flex: 0 0 auto; min-width: 0; }
.profile-picker-search::before {
  content: ""; position: absolute; left: 14px; top: 14px; width: 11px; height: 11px;
  border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none;
}
.profile-picker-search::after {
  content: ""; position: absolute; left: 25px; top: 26px; width: 6px; height: 1.5px;
  background: var(--muted); transform: rotate(45deg); pointer-events: none;
}
.profile-sex-picker-searchable .profile-picker-search input {
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; margin: 0;
  padding: 10px 12px 10px 36px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--field); color: var(--ink); font: inherit; font-size: 16px;
  font-weight: 500; line-height: 1.35; box-shadow: none; appearance: none;
}
.profile-sex-picker-searchable .profile-picker-search input:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.profile-picker-results {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.profile-picker-results .profile-sex-picker-option { min-height: 44px; padding: 10px; font-size: 14px; font-weight: 550; }
.profile-picker-results .profile-sex-picker-option[hidden] { display: none; }
.profile-picker-results[hidden] { display: none; }
.profile-picker-empty { margin: 0; padding: 14px 10px; color: var(--muted); font-size: 14px; line-height: 1.4; }

/* Project uses the same value-preserving control as Training and Profile. */
select.project-select-native {
  position: absolute !important; width: 1px !important; min-width: 1px !important; max-width: 1px !important;
  height: 1px !important; min-height: 1px !important; margin: 0 !important; padding: 0 !important;
  border: 0 !important; opacity: 0 !important; overflow: hidden !important; clip-path: inset(50%) !important; pointer-events: none !important;
}
.project-select-field { min-width: 0; }
.project-select-field>.profile-sex-picker { min-width: 0; width: 100%; }
.project-select-field .project-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; margin: 0;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--field); color: var(--ink); font: inherit; font-size: 16px;
  font-weight: 550; line-height: 1.35; text-align: start; letter-spacing: 0; text-transform: none; box-shadow: none;
}
.project-select-trigger>.profile-sex-picker-value { min-width: 0; overflow-wrap: anywhere; }
.project-select-trigger::after {
  content: ""; flex: 0 0 7px; width: 7px; height: 7px; margin-top: -4px;
  border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg);
}
.project-select-trigger[aria-expanded="true"]::after { margin-top: 4px; transform: rotate(225deg); }
.project-select-trigger:is(:focus-visible,[aria-expanded="true"]) { border-color: var(--blue); outline: 2px solid var(--blue); outline-offset: 2px; }
.project-select-trigger[aria-invalid="true"] { border-color: var(--red); }
.project-select-trigger:disabled { opacity: .55; cursor: not-allowed; }
@media (hover: hover) { .profile-sex-picker-option:not([aria-disabled="true"]):hover { background: var(--blue-soft); } }



/* Diary uses the same combobox without opening a native picker inside the sheet. */
.diary-day-modal .diary-activity-control select.profile-sex-picker-native {
  position:absolute!important; width:1px!important; min-width:1px!important; max-width:1px!important;
  height:1px!important; min-height:1px!important; max-height:1px!important; padding:0!important;
  margin:0!important; border:0!important; opacity:0!important; clip-path:inset(50%)!important; pointer-events:none!important;
}
.diary-day-modal .diary-activity-control .profile-sex-picker { min-width:0; width:100%; }
.diary-day-modal .diary-activity-control .profile-sex-picker-trigger {
  display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; min-width:0; min-height:48px;
  margin:0; padding:11px 12px; border:1px solid var(--diary-resource-line); border-radius:12px; background:var(--card);
  color:var(--ink); font:inherit; font-size:16px; font-weight:750; line-height:1.4; letter-spacing:0;
  text-align:start; text-transform:none; touch-action:manipulation;
}
.diary-day-modal .diary-activity-control .profile-sex-picker-value { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.diary-day-modal .diary-activity-control .profile-sex-picker-trigger::after {
  content:""; flex:0 0 8px; width:8px; height:8px; margin-right:3px; margin-top:-4px;
  border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg);
}
.diary-day-modal .diary-activity-control .profile-sex-picker-trigger[aria-expanded="true"]::after { margin-top:4px; transform:rotate(225deg); }
.diary-day-modal .diary-activity-control .profile-sex-picker-trigger:is(:focus-visible,[aria-expanded="true"]) {
  border-color:var(--diary-resource-ink); outline:2px solid var(--diary-resource-ink); outline-offset:2px;
}
.diary-day-modal .diary-activity-control .profile-sex-picker-trigger:disabled { opacity:.55; cursor:not-allowed; }
.diary-activity-picker-popup {
  --blue: color-mix(in srgb, #75c3b4 46%, var(--ink));
  --blue-soft: color-mix(in srgb, #75c3b4 18%, var(--card));
  border-color: color-mix(in srgb, #75c3b4 50%, var(--line));
}
.diary-activity-picker-popup .profile-sex-picker-option { font-size: .88rem; }


@media (forced-colors: active) {
  #profileForm .profile-sex-picker-trigger, .diary-day-modal .diary-activity-control .profile-sex-picker-trigger, .profile-sex-picker-popup { background: Canvas; color: CanvasText; border-color: ButtonText; }
  .profile-sex-picker-option { color: CanvasText; }
  .profile-sex-picker-option[aria-selected="true"] { border-color: Highlight; }
  .profile-sex-picker-option.is-active { outline-color: Highlight; }
  .profile-sex-picker-option[aria-selected="true"]::after { background: Highlight; color: HighlightText; }
}
/* Kitchen stages and recipe registration keep the native values/events. */
:is(#recipeBuilder,.recipe-registration-sheet) select.profile-sex-picker-native {
  position:absolute!important; width:1px!important; min-width:1px!important; max-width:1px!important;
  height:1px!important; min-height:1px!important; max-height:1px!important; padding:0!important;
  margin:0!important; border:0!important; opacity:0!important; clip-path:inset(50%)!important; pointer-events:none!important;
}
:is(#recipeBuilder,.recipe-registration-sheet) .profile-sex-picker { width:100%; min-width:0; }
:is(#recipeBuilder,.recipe-registration-sheet) .profile-sex-picker-field::after { display:none; }
:is(#recipeBuilder,.recipe-registration-sheet) .recipe-select-trigger {
  display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; min-width:0; min-height:48px;
  margin:0; padding:11px 12px; border:1px solid var(--line); border-radius:14px; background:var(--field);
  color:var(--ink); font:inherit; font-size:16px; font-weight:650; line-height:1.4; letter-spacing:0;
  text-align:start; text-transform:none; touch-action:manipulation;
}
:is(#recipeBuilder,.recipe-registration-sheet) .profile-sex-picker-value { min-width:0; overflow-wrap:anywhere; }
.recipe-select-trigger::after {
  content:""; flex:0 0 8px; width:8px; height:8px; margin-right:3px; margin-top:-4px;
  border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg);
}
.recipe-select-trigger[aria-expanded="true"]::after { margin-top:4px; transform:rotate(225deg); }
:is(#recipeBuilder,.recipe-registration-sheet) .recipe-select-trigger:is(:focus-visible,[aria-expanded="true"]) {
  border-color:var(--blue); outline:2px solid var(--blue); outline-offset:2px;
}
:is(#recipeBuilder,.recipe-registration-sheet) .recipe-select-trigger:disabled { opacity:.55; cursor:not-allowed; }

@media (forced-colors:active) {
  :is(#recipeBuilder,.recipe-registration-sheet) .recipe-select-trigger { background:Canvas; color:CanvasText; border-color:ButtonText; }
}
/* Food registration uses the same accessible listbox as the Kitchen. */
#foodForm select.profile-sex-picker-native {
  position:absolute!important; width:1px!important; min-width:1px!important; max-width:1px!important;
  height:1px!important; min-height:1px!important; max-height:1px!important; padding:0!important;
  margin:0!important; border:0!important; opacity:0!important; clip-path:inset(50%)!important; pointer-events:none!important;
}
#foodForm .profile-sex-picker { width:100%; min-width:0; }
#foodForm .profile-sex-picker-field::after { display:none!important; }
#foodForm .food-select-trigger {
  display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; min-width:0; min-height:48px;
  margin:0; padding:11px 12px; border:1px solid var(--line); border-radius:14px; background:var(--field);
  color:var(--ink); font:inherit; font-size:16px; font-weight:650; line-height:1.4; letter-spacing:0;
  text-align:start; text-transform:none; touch-action:manipulation;
}
#foodForm .profile-sex-picker-value { min-width:0; overflow-wrap:anywhere; }
.food-select-trigger::after {
  content:""; flex:0 0 8px; width:8px; height:8px; margin-right:3px; margin-top:-4px;
  border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg);
}
.food-select-trigger[aria-expanded="true"]::after { margin-top:4px; transform:rotate(225deg); }
#foodForm .food-select-trigger:is(:focus-visible,[aria-expanded="true"]) {
  border-color:var(--blue); outline:2px solid var(--blue); outline-offset:2px;
}
#foodForm .food-select-trigger[aria-invalid="true"] { border-color:var(--red); outline-color:var(--red); }
#foodForm .food-select-trigger:disabled { opacity:.55; cursor:not-allowed; }

@media (forced-colors:active) {
  #foodForm .food-select-trigger { background:Canvas; color:CanvasText; border-color:ButtonText; }
}
