.ysel {
  position: relative;
  display: inline-flex;
  min-width: 0;
  vertical-align: middle;
}

.ysel-native {
  display: none !important;
}

.ysel-trigger {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0 8px 0 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfbf6;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.ysel-trigger:hover {
  border-color: var(--line-strong);
}

.ysel-trigger:focus-visible {
  outline: 2px solid var(--maize-deep);
  outline-offset: 1px;
}

.ysel.is-open .ysel-trigger {
  border-color: var(--ink);
  background: #fffef9;
  box-shadow: 0 0 0 1px rgba(27, 30, 26, 0.04);
}

.ysel-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ysel-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 2px;
  color: var(--muted);
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.ysel-mark svg {
  width: 12px;
  height: 12px;
  transition: transform 0.22s var(--ease);
}

.ysel.is-open .ysel-mark {
  color: var(--ink);
  background: var(--paper-2);
}

.ysel.is-open .ysel-mark svg {
  transform: rotate(180deg);
}

.ysel.is-disabled .ysel-trigger {
  border-color: var(--line);
  background: var(--paper-2);
  color: var(--muted);
  cursor: not-allowed;
}

.ysel.is-disabled .ysel-mark {
  color: var(--muted-2);
  background: transparent;
}

.ysel-pop {
  position: fixed;
  z-index: 240;
  display: flex;
  flex-direction: column;
  min-width: 160px;
  padding: 0;
  background: #fdfcf5;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 26px 50px -30px rgba(20, 26, 20, 0.5), 0 8px 18px -12px rgba(20, 26, 20, 0.24);
  overflow: hidden;
  animation: ysel-in 0.16s var(--ease) both;
}

.ysel-pop[hidden] {
  display: none;
}

@keyframes ysel-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ysel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 8px 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.ysel-caption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ysel-caption::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  background: var(--maize);
}

.ysel-count {
  flex: none;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

.ysel-close {
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
}

.ysel-close:hover {
  background: var(--paper-2);
  color: var(--ink);
}

.ysel-close svg {
  width: 11px;
  height: 11px;
}

.ysel-list {
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.ysel-list::-webkit-scrollbar {
  width: 8px;
}

.ysel-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--line-strong);
  background-clip: content-box;
}

.ysel-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px 7px 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.ysel-option-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ysel-check {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--maize-deep);
  opacity: 0;
  transform: scale(0.65);
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease);
}

.ysel-option:hover,
.ysel-option.is-active {
  background: var(--paper-2);
}

.ysel-option.is-selected {
  background: rgba(242, 200, 75, 0.18);
  font-weight: 600;
}

.ysel-option.is-selected .ysel-check {
  opacity: 1;
  transform: none;
}

.ysel-option[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.ysel--dark .ysel-trigger {
  border-color: var(--ink-line-strong);
  background: var(--ink-soft);
  color: var(--paper);
}

.ysel--dark .ysel-trigger:hover {
  border-color: var(--maize);
}

.ysel--dark.is-open .ysel-trigger {
  border-color: var(--maize);
  background: var(--ink-3);
}

.ysel--dark .ysel-mark {
  color: var(--on-dark-muted);
}

.ysel--dark.is-open .ysel-mark {
  color: var(--ink);
  background: var(--maize);
}

.ysel-pop.ysel-pop--dark {
  border-color: var(--ink-line-strong);
  background: var(--ink-soft);
  box-shadow: 0 1px 0 rgba(242, 243, 233, 0.06) inset,
    0 30px 60px -28px rgba(0, 0, 0, 0.72);
}

.ysel-pop--dark .ysel-head {
  background: #1f231d;
  border-bottom-color: var(--ink-line);
}

.ysel-pop--dark .ysel-caption {
  color: var(--on-dark-muted);
}

.ysel-pop--dark .ysel-count {
  color: rgba(242, 243, 233, 0.45);
}

.ysel-pop--dark .ysel-option {
  color: var(--paper);
}

.ysel-pop--dark .ysel-option:hover,
.ysel-pop--dark .ysel-option.is-active {
  background: rgba(242, 243, 233, 0.08);
}

.ysel-pop--dark .ysel-option.is-selected {
  background: rgba(242, 200, 75, 0.16);
}

.ysel-pop--dark .ysel-check {
  color: var(--maize);
}

.ysel-pop--dark .ysel-list {
  scrollbar-color: var(--ink-line-strong) transparent;
}

.ysel-pop--dark .ysel-list::-webkit-scrollbar-thumb {
  background: var(--ink-line-strong);
  background-clip: content-box;
}

.cs-toolbar .ysel {
  flex: none;
}

.cs-toolbar .ysel-trigger {
  min-width: 138px;
}

.pg-head-left .ysel {
  max-width: 230px;
}

.pg-head-left .ysel-trigger {
  height: 32px;
  min-width: 156px;
  padding: 0 6px 0 9px;
  font-size: 11.5px;
}

.pg-field .ysel {
  width: 100%;
}

.pg-field .ysel-trigger {
  height: 34px;
  padding: 0 6px 0 9px;
  border-color: var(--line);
  background: var(--paper);
  font-size: 11.5px;
}

.form-field .ysel {
  width: 100%;
}

.form-field .ysel-trigger {
  height: 42px;
  padding: 0 8px 0 12px;
  border-color: var(--line-strong);
  font-size: 13px;
}

.field-pair .ysel {
  width: 100%;
}

.profile-field-grid .ysel.is-disabled .ysel-trigger {
  background: var(--paper-2);
  color: var(--muted);
}

.ydate {
  position: relative;
  width: 100%;
}

.ydate-native {
  display: none !important;
}

.ydate-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fbfbf6;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.ydate-trigger:hover {
  border-color: var(--line-strong);
}

.ydate-trigger:focus-visible {
  outline: 2px solid var(--maize-deep);
  outline-offset: 1px;
}

.ydate.is-open .ydate-trigger {
  border-color: var(--ink);
  background: #fffef9;
}

.ydate-value {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.ydate-week {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted-2);
}

.ydate-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.ydate-mark svg {
  width: 15px;
  height: 15px;
}

.ydate.is-open .ydate-mark {
  color: var(--ink);
}

.ydate-pop {
  position: fixed;
  z-index: 240;
  width: 288px;
  padding: 12px;
  background: #fdfcf5;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset,
    0 26px 50px -30px rgba(20, 26, 20, 0.5), 0 8px 18px -12px rgba(20, 26, 20, 0.24);
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: ysel-in 0.16s var(--ease) both;
}

.ydate-pop[hidden] {
  display: none;
}

.ydate-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ydate-title {
  flex: 1;
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ydate-nav {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.ydate-nav:hover {
  border-color: var(--line-strong);
  background: var(--paper-2);
}

.ydate-nav svg {
  width: 11px;
  height: 11px;
}

.ydate-close {
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
}

.ydate-close:hover {
  border-color: var(--line-strong);
  background: var(--paper-2);
  color: var(--ink);
}

.ydate-close svg {
  width: 11px;
  height: 11px;
}

.ydate-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 10px;
}

.ydate-week-row span {
  padding: 4px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

.ydate-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 4px;
}

.ydate-day {
  position: relative;
  height: 32px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}

.ydate-day:hover {
  background: var(--paper-2);
}

.ydate-day.is-out {
  color: var(--muted-2);
  opacity: 0.5;
}

.ydate-day.is-today {
  box-shadow: inset 0 0 0 1px var(--maize-deep);
}

.ydate-day.is-selected {
  background: var(--ink);
  color: var(--paper);
  box-shadow: none;
}

.ydate-day.is-selected.is-today {
  box-shadow: inset 0 0 0 1px var(--maize);
}

.ydate-day:focus-visible {
  outline: 2px solid var(--maize-deep);
  outline-offset: -2px;
}

.ydate-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.ydate-today-btn {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}

.ydate-today-btn:hover {
  border-color: var(--line-strong);
  background: var(--paper-2);
}

.ydate-foot-note {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
}

@media (max-width: 520px) {
  .ysel-pop.is-sheet,
  .ydate-pop.is-sheet {
    left: 10px !important;
    right: 10px !important;
    top: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-height: min(62vh, 460px) !important;
    border-radius: 5px;
    animation: ysel-sheet-in 0.2s var(--ease) both;
  }

  .ysel-pop.is-sheet .ysel-close {
    display: grid;
  }

  .ysel-pop.is-sheet .ysel-option {
    min-height: 42px;
  }

  .ydate-pop.is-sheet {
    max-height: none !important;
  }

  .ydate-pop.is-sheet .ydate-close {
    display: grid;
  }

  .ydate-pop.is-sheet .ydate-day {
    height: 38px;
  }
}

@keyframes ysel-sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ysel-pop,
  .ydate-pop,
  .ysel-mark svg,
  .ysel-check {
    animation: none;
    transition: none;
  }
}
