/* 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; }
@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. */
#modal .diary-day-modal 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;
}
#modal .diary-day-modal .profile-sex-picker { min-width:0; width:100%; }
#modal .diary-day-modal .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(--line); border-radius:12px; background:var(--surface-2);
  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;
}
#modal .diary-day-modal .profile-sex-picker-value { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#modal .diary-day-modal .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);
}
#modal .diary-day-modal .profile-sex-picker-trigger[aria-expanded="true"]::after { margin-top:4px; transform:rotate(225deg); }
#modal .diary-day-modal .profile-sex-picker-trigger:is(:focus-visible,[aria-expanded="true"]) {
  border-color:var(--blue); outline:2px solid var(--blue); outline-offset:2px;
}
#modal .diary-day-modal .profile-sex-picker-trigger:disabled { opacity:.55; cursor:not-allowed; }


@media (forced-colors: active) {
  #profileForm .profile-sex-picker-trigger, #modal .diary-day-modal .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; }
}
