.dsel {
  position: relative;
  display: block;
}

.dsel-holder {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.dsel-display {
  padding-right: 2.4rem;
  cursor: pointer;
}
.dsel-readonly .dsel-display {
  cursor: default;
  background: var(--bs-secondary-bg);
}

.dsel.has-value:not(.dsel-readonly) .dsel-display {
  padding-right: 4rem;
}

.dsel-icon {
  position: absolute;
  top: 50%;
  right: 0.8rem;
  transform: translateY(-50%);
  color: var(--bs-secondary-color);
  pointer-events: auto;
  cursor: pointer;
  line-height: 1;
}
.dsel-readonly .dsel-icon {
  cursor: default;
}

.dsel-clear {
  position: absolute;
  top: 50%;
  right: 2.3rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 0.15rem;
  color: var(--bs-secondary-color);
  cursor: pointer;
}
.dsel-clear:hover {
  color: var(--bs-body-color);
  background: var(--bs-secondary-bg);
}
.dsel-clear[hidden] {
  display: none;
}

.dsel-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 1060;
  min-width: max-content;
  padding: 0.75rem;
  background: var(--genus-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.3rem;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
}
.dsel-panel.dsel-panel-right {
  left: auto;
  right: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .dsel-panel {
    animation: dsel-pop 0.12s ease;
  }
  @keyframes dsel-pop {
    from {
      opacity: 0;
      transform: translateY(-0.25rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
.dsel-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dsel-cal-label {
  padding: 0.15rem 0.5rem;
  border: 0;
  background: transparent;
  font-size: inherit;
  font-weight: 600;
  color: var(--bs-heading-color, inherit);
  text-transform: capitalize;
  border-radius: 0.2rem;
  cursor: pointer;
}
.dsel-cal-label:hover:not(.is-static) {
  background: var(--bs-tertiary-bg);
}
.dsel-cal-label:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}
.dsel-cal-label.is-static {
  cursor: default;
}

.dsel-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bs-secondary-color);
  border-radius: 0.2rem;
  cursor: pointer;
  font-size: 1.1rem;
}
.dsel-nav:hover {
  color: var(--bs-body-color);
  background: var(--bs-tertiary-bg);
}
.dsel-nav:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}

.dsel-grid {
  display: grid;
  grid-template-columns: repeat(7, 2.1rem);
  gap: 2px;
  justify-content: center;
}

.dsel-wd {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bs-secondary-color);
  padding: 0.2rem 0;
}

.dsel-day {
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bs-body-color);
  border-radius: 0.2rem;
  font-size: 0.855rem;
  cursor: pointer;
}
.dsel-day:hover:not(.is-disabled):not(.is-selected) {
  background: var(--bs-tertiary-bg);
}
.dsel-day:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}
.dsel-day.is-outside {
  color: var(--bs-secondary-color);
  opacity: 0.55;
}
.dsel-day.is-today {
  box-shadow: inset 0 0 0 1px var(--bs-primary);
}
.dsel-day.is-in-range {
  background: rgba(var(--bs-primary-rgb), 0.12);
  border-radius: 0;
}
.dsel-day.is-disabled {
  color: var(--bs-secondary-color);
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}
.dsel-day.is-selected {
  background: var(--bs-primary);
  color: #fff;
}
.dsel-day.is-selected.is-disabled {
  color: #fff;
  opacity: 0.8;
  text-decoration: none;
}

.dsel-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: calc(7 * 2.1rem + 12px);
}

.dsel-month {
  padding: 0.55rem 0;
  border: 0;
  background: transparent;
  color: var(--bs-body-color);
  border-radius: 0.2rem;
  font-size: 0.855rem;
  text-transform: capitalize;
  cursor: pointer;
}
.dsel-month:hover:not(.is-selected) {
  background: var(--bs-tertiary-bg);
}
.dsel-month:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 1px;
}
.dsel-month.is-selected {
  background: var(--bs-primary);
  color: #fff;
}

.dsel-times {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--bs-border-color);
}
.dsel-type-time .dsel-times {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.dsel-time-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dsel-time-pair {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.dsel-time {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

.dsel-time[data-unit=ap] {
  flex: 1.35 1 0;
}

.dsel-time-sep {
  color: var(--bs-secondary-color);
}

.dsel-time-label {
  flex: 0 0 2.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bs-secondary-color);
}

.dsel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--bs-border-color);
}
.dsel-foot .dsel-apply {
  margin-left: auto;
}
